globus_gsi_proxy_core  7.7
 All Files Functions Typedefs Enumerations Enumerator Modules Pages
globus_i_gsi_proxy.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
18 
25 #include "globus_gsi_proxy.h"
26 #include "proxycertinfo.h"
27 #include "globus_common.h"
28 
29 #ifndef GLOBUS_I_GSI_PROXY_H
30 #define GLOBUS_I_GSI_PROXY_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* DEBUG MACROS */
37 
38 #ifdef BUILD_DEBUG
39 
40 extern int globus_i_gsi_proxy_debug_level;
41 extern FILE * globus_i_gsi_proxy_debug_fstream;
42 
43 #define GLOBUS_I_GSI_PROXY_DEBUG(_LEVEL_) \
44  (globus_i_gsi_proxy_debug_level >= (_LEVEL_))
45 
46 #define GLOBUS_I_GSI_PROXY_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
47  { \
48  if (GLOBUS_I_GSI_PROXY_DEBUG(_LEVEL_)) \
49  { \
50  globus_libc_fprintf _MESSAGE_; \
51  } \
52  }
53 
54 #define GLOBUS_I_GSI_PROXY_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
55  { \
56  if (GLOBUS_I_GSI_PROXY_DEBUG(_LEVEL_)) \
57  { \
58  char * _tmp_str_ = \
59  globus_common_create_nstring _MESSAGE_; \
60  globus_libc_fprintf(globus_i_gsi_proxy_debug_fstream, \
61  _tmp_str_); \
62  globus_libc_free(_tmp_str_); \
63  } \
64  }
65 
66 #define GLOBUS_I_GSI_PROXY_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
67  { \
68  if (GLOBUS_I_GSI_PROXY_DEBUG(_LEVEL_)) \
69  { \
70  globus_libc_fprintf(globus_i_gsi_proxy_debug_fstream, _MESSAGE_); \
71  } \
72  }
73 
74 #define GLOBUS_I_GSI_PROXY_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
75  { \
76  if (GLOBUS_I_GSI_PROXY_DEBUG(_LEVEL_)) \
77  { \
78  _OBJ_NAME_##_print_fp(globus_i_gsi_proxy_debug_fstream, _OBJ_); \
79  } \
80  }
81 
82 #else
83 
84 #define GLOBUS_I_GSI_PROXY_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
85 #define GLOBUS_I_GSI_PROXY_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
86 #define GLOBUS_I_GSI_PROXY_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
87 #define GLOBUS_I_GSI_PROXY_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
88 
89 #endif
90 
91 #define GLOBUS_I_GSI_PROXY_DEBUG_ENTER \
92  GLOBUS_I_GSI_PROXY_DEBUG_FPRINTF( \
93  1, (globus_i_gsi_proxy_debug_fstream, \
94  "%s entering\n", _function_name_))
95 
96 #define GLOBUS_I_GSI_PROXY_DEBUG_EXIT \
97  GLOBUS_I_GSI_PROXY_DEBUG_FPRINTF( \
98  1, (globus_i_gsi_proxy_debug_fstream, \
99  "%s exiting\n", _function_name_))
100 
101 /* ERROR MACROS */
102 
103 #define GLOBUS_GSI_PROXY_OPENSSL_ERROR_RESULT(_RESULT_, \
104  _ERRORTYPE_, _ERRORSTR_) \
105  char * _tmp_string_ = \
106  globus_common_create_string _ERRORSTR_; \
107  _RESULT_ = globus_i_gsi_proxy_openssl_error_result( \
108  _ERRORTYPE_, \
109  __FILE__, \
110  _function_name_, \
111  __LINE__, \
112  _tmp_string_, \
113  NULL); \
114  globus_libc_free(_tmp_string_)
115 
116 #define GLOBUS_GSI_PROXY_ERROR_RESULT(_RESULT_, \
117  _ERRORTYPE_, _ERRORSTR_) \
118  char * _tmp_string_ = \
119  globus_common_create_string _ERRORSTR_; \
120  _RESULT_ = globus_i_gsi_proxy_error_result( \
121  _ERRORTYPE_, \
122  __FILE__, \
123  _function_name_, \
124  __LINE__, \
125  _tmp_string_, \
126  NULL); \
127  globus_libc_free(_tmp_string_)
128 
129 #define GLOBUS_GSI_PROXY_ERROR_CHAIN_RESULT(_RESULT_, \
130  _ERRORTYPE_) \
131  _RESULT_ = globus_i_gsi_proxy_error_chain_result( \
132  (_RESULT_), \
133  (_ERRORTYPE_), \
134  __FILE__, \
135  _function_name_, \
136  __LINE__, \
137  NULL, \
138  NULL)
139 
140 #define GLOBUS_GSI_PROXY_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
141  _ERRORTYPE_, \
142  _ERRORSTR_, \
143  _LONG_DESC_) \
144  char * _tmp_string_ = \
145  globus_common_create_string _ERRORSTR_; \
146  _RESULT_ = globus_i_gsi_proxy_openssl_error_result( \
147  _ERRORTYPE_, \
148  __FILE__, \
149  _function_name_, \
150  __LINE__, \
151  _tmp_string_, \
152  _LONG_DESC_); \
153  globus_libc_free(_tmp_string_)
154 
155 #define GLOBUS_GSI_PROXY_LONG_ERROR_RESULT(_RESULT_, \
156  _ERRORTYPE_, \
157  _ERRORSTR_, \
158  _LONG_DESC_) \
159  char * _tmp_string_ = \
160  globus_common_create_string _ERRORSTR_; \
161  _RESULT_ = globus_i_gsi_proxy_error_result( \
162  _ERRORTYPE_, \
163  __FILE__, \
164  _function_name_, \
165  __LINE__, \
166  _tmp_string_, \
167  NULL, \
168  _LONG_DESC_); \
169  globus_libc_free(_tmp_string_)
170 
171 #define GLOBUS_GSI_PROXY_LONG_ERROR_CHAIN_RESULT(_RESULT_, \
172  _ERRORTYPE_, \
173  _LONG_DESC_) \
174  _RESULT_ = globus_i_gsi_proxy_error_chain_result( \
175  _RESULT_, \
176  _ERRORTYPE_, \
177  __FILE__, \
178  _function_name_, \
179  __LINE__, \
180  NULL, \
181  _LONG_DESC_)
182 
184 
198 typedef struct globus_l_gsi_proxy_handle_attrs_s
199 {
204  int key_bits;
209  int init_prime;
214  EVP_MD * signing_algorithm;
220  int clock_skew;
225  void (*key_gen_callback)(int, int, void *);
226 
227 } globus_i_gsi_proxy_handle_attrs_t;
228 
240 typedef struct globus_l_gsi_proxy_handle_s
241 {
243  X509_REQ * req;
245  EVP_PKEY * proxy_key;
249  PROXYCERTINFO * proxy_cert_info;
251  int time_valid;
253  globus_gsi_cert_utils_cert_type_t type;
255  char * common_name;
257  STACK_OF(X509_EXTENSION)* extensions;
258 } globus_i_gsi_proxy_handle_t;
259 
260 
261 /* used for printing the status of a private key generating algorithm */
262 void
263 globus_i_gsi_proxy_create_private_key_cb(
264  int num1,
265  int num2,
266  BIO * output);
267 
268 globus_result_t
269 globus_i_gsi_proxy_set_pc_times(
270  X509 * new_pc,
271  X509 * issuer_cert,
272  int clock_skew,
273  int time_valid);
274 
275 globus_result_t
276 globus_i_gsi_proxy_set_subject(
277  X509 * new_pc,
278  X509 * issuer_cert,
279  char * common_name);
280 
281 globus_result_t
282 globus_i_gsi_proxy_openssl_error_result(
283  int error_type,
284  const char * filename,
285  const char * function_name,
286  int line_number,
287  const char * short_desc,
288  const char * long_desc);
289 
290 globus_result_t
291 globus_i_gsi_proxy_error_result(
292  int error_type,
293  const char * filename,
294  const char * function_name,
295  int line_number,
296  const char * short_desc,
297  const char * long_desc);
298 
299 globus_result_t
300 globus_i_gsi_proxy_error_chain_result(
301  globus_result_t chain_result,
302  int error_type,
303  const char * filename,
304  const char * function_name,
305  int line_number,
306  const char * short_desc,
307  const char * long_desc);
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 
313 #endif /* GLOBUS_I_GSI_PROXY_H */
314 
315 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Globus GSI Proxy API.
GSI Proxy Constants.
struct globus_l_gsi_proxy_handle_attrs_s * globus_gsi_proxy_handle_attrs_t
Definition: globus_gsi_proxy.h:153