17 #ifndef GLOBUS_I_GSI_GSS_UTILS_H 18 #define GLOBUS_I_GSI_GSS_UTILS_H 20 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL 32 #define GLOBUS_GSI_GSSAPI_ERROR_RESULT(_MIN_RESULT_, _MIN_, \ 34 if (_MIN_RESULT_ != NULL) \ 37 globus_common_create_string _ERRSTR_; \ 38 *_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_result( \ 39 _MIN_, __FILE__, __func__, \ 40 __LINE__, tmpstr, NULL); \ 41 globus_libc_free(tmpstr); \ 44 #define GLOBUS_GSI_GSSAPI_OPENSSL_ERROR_RESULT(_MIN_RESULT_, \ 45 _ERRORTYPE_, _ERRORSTR_) \ 48 globus_common_create_string _ERRORSTR_; \ 50 (OM_uint32) globus_i_gsi_gssapi_openssl_error_result( \ 51 _ERRORTYPE_, __FILE__, __func__, __LINE__, tmpstr, NULL); \ 52 globus_libc_free(tmpstr); \ 55 #define GLOBUS_GSI_GSSAPI_ERROR_CHAIN_RESULT(_MIN_RESULT_, _TOP_RESULT_, \ 57 *_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_chain_result( \ 58 (globus_result_t)_TOP_RESULT_, \ 59 _ERRORTYPE_, __FILE__, \ 60 __func__, __LINE__, NULL, NULL) 62 #define GLOBUS_GSI_GSSAPI_LONG_ERROR_RESULT(_MIN_RESULT_, _MIN_, \ 63 _ERRSTR_, _LONG_DESC_) \ 66 globus_common_create_string _ERRSTR_; \ 67 *_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_result( \ 68 _MIN_, __FILE__, __func__, \ 69 __LINE__, tmpstr, _LONG_DESC_); \ 70 globus_libc_free(tmpstr); \ 73 #define GLOBUS_GSI_GSSAPI_OPENSSL_LONG_ERROR_RESULT(_MIN_RESULT_, \ 79 globus_common_create_string _ERRORSTR_; \ 81 (OM_uint32) globus_i_gsi_gssapi_openssl_error_result( \ 82 _ERRORTYPE_, __FILE__, __func__, \ 83 __LINE__, tmpstr, _LONG_DESC_); \ 84 globus_libc_free(tmpstr); \ 87 #define GLOBUS_GSI_GSSAPI_LONG_ERROR_CHAIN_RESULT(_MIN_RESULT_, _TOP_RESULT_, \ 88 _ERRORTYPE_, _LONG_DESC_) \ 89 *_MIN_RESULT_ = (OM_uint32) globus_i_gsi_gssapi_error_chain_result( \ 90 (globus_result_t)_TOP_RESULT_, \ 91 _ERRORTYPE_, __FILE__, \ 92 __func__, __LINE__, NULL, _LONG_DESC_) 94 #define GLOBUS_GSI_GSSAPI_MALLOC_ERROR(_MIN_RESULT_) \ 97 globus_l_gsi_gssapi_error_strings[ \ 98 GLOBUS_GSI_GSSAPI_ERROR_OUT_OF_MEMORY]; \ 99 *_MIN_RESULT_ = (OM_uint32) globus_error_put( \ 100 globus_error_wrap_errno_error( \ 101 GLOBUS_GSI_GSSAPI_MODULE, \ 103 GLOBUS_GSI_GSSAPI_ERROR_OUT_OF_MEMORY, \ 114 extern int globus_i_gsi_gssapi_debug_level;
115 extern FILE * globus_i_gsi_gssapi_debug_fstream;
116 extern globus_mutex_t globus_i_gssapi_activate_mutex;
117 extern globus_bool_t globus_i_gssapi_active;
122 #define GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_) \ 123 (globus_i_gsi_gssapi_debug_level >= (_LEVEL_)) 125 #define GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \ 127 if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \ 129 globus_libc_fprintf _MESSAGE_; \ 133 #define GLOBUS_I_GSI_GSSAPI_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \ 135 if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \ 138 globus_common_create_nstring _MESSAGE_; \ 139 globus_libc_fprintf(globus_i_gsi_gssapi_debug_fstream, \ 141 globus_libc_free(_tmp_str_); \ 145 #define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \ 147 if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \ 149 globus_libc_fprintf( \ 150 globus_i_gsi_gssapi_debug_fstream, \ 155 #define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT_OBJECT(_LEVEL_, _TYPE_, _OBJ_) \ 157 if (GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_)) \ 160 globus_i_gsi_gssapi_debug_fstream, \ 167 #define GLOBUS_I_GSI_GSSAPI_DEBUG(_LEVEL_) 0 168 #define GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) 169 #define GLOBUS_I_GSI_GSSAPI_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) 170 #define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT(_LEVEL_, _MESSAGE_) 171 #define GLOBUS_I_GSI_GSSAPI_DEBUG_PRINT_OBJECT(_LEVEL,_TYPE_, _OBJ_) 175 #define GLOBUS_I_GSI_GSSAPI_DEBUG_ENTER \ 176 GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \ 177 1, (globus_i_gsi_gssapi_debug_fstream, \ 178 "%s entering\n", __func__)) 180 #define GLOBUS_I_GSI_GSSAPI_DEBUG_EXIT \ 181 GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \ 182 1, (globus_i_gsi_gssapi_debug_fstream, \ 183 "%s exiting: major_status=%d\n", \ 184 __func__, (int)major_status)) 186 #define GLOBUS_I_GSI_GSSAPI_INTERNAL_DEBUG_EXIT \ 187 GLOBUS_I_GSI_GSSAPI_DEBUG_FPRINTF( \ 188 1, (globus_i_gsi_gssapi_debug_fstream, \ 192 extern int globus_i_gsi_gssapi_min_tls_protocol;
193 extern int globus_i_gsi_gssapi_max_tls_protocol;
194 extern const char * globus_i_gsi_gssapi_cipher_list;
195 extern globus_bool_t globus_i_gsi_gssapi_server_cipher_order;
199 GLOBUS_I_GSI_GSS_DEFAULT_CONTEXT,
200 GLOBUS_I_GSI_GSS_ANON_CONTEXT
201 } globus_i_gsi_gss_context_type_t;
204 globus_i_gsi_gss_copy_name_to_name(
205 OM_uint32 * minor_status,
206 gss_name_desc ** output,
207 const gss_name_desc * input);
210 globus_i_gsi_gss_create_and_fill_context(
211 OM_uint32 * minor_status,
212 gss_ctx_id_desc ** context_handle,
214 gss_cred_id_desc * cred_handle,
215 const gss_cred_usage_t cred_usage,
216 OM_uint32 req_flags);
219 globus_i_gsi_gss_create_anonymous_cred(
220 OM_uint32 * minor_status,
221 gss_cred_id_t * output_cred_handle,
222 const gss_cred_usage_t cred_usage);
225 globus_i_gsi_gss_cred_read_bio(
226 OM_uint32 * minor_status,
227 const gss_cred_usage_t cred_usage,
228 gss_cred_id_t * cred_id_handle,
232 globus_i_gsi_gss_cred_read(
233 OM_uint32 * minor_status,
234 const gss_cred_usage_t cred_usage,
235 gss_cred_id_t * cred_handle,
236 const X509_NAME * desired_subject);
239 globus_i_gsi_gss_create_cred(
240 OM_uint32 * minor_status,
241 const gss_cred_usage_t cred_usage,
242 gss_cred_id_t * output_cred_handle_P,
243 globus_gsi_cred_handle_t * cred_handle);
245 int globus_i_gsi_gss_verify_extensions_callback(
246 globus_gsi_callback_data_t callback_data,
247 X509_EXTENSION * extension);
250 globus_i_gsi_gss_handshake(
251 OM_uint32 * minor_status,
252 gss_ctx_id_desc * context_handle);
255 globus_i_gsi_gss_get_token(
256 OM_uint32 * minor_status,
257 const gss_ctx_id_desc * context_handle,
259 const gss_buffer_t output_token);
262 globus_i_gsi_gss_put_token(
263 OM_uint32 * minor_status,
264 const gss_ctx_id_desc * context_handle,
266 const gss_buffer_t input_token);
269 globus_i_gsi_gss_retrieve_peer(
270 OM_uint32 * minor_status,
271 gss_ctx_id_desc * context_handle,
272 const gss_cred_usage_t cred_usage);
274 #if LINK_WITH_INTERNAL_OPENSSL_API 276 globus_i_gsi_gss_SSL_write_bio(
277 OM_uint32 * minor_status,
278 gss_ctx_id_desc * context,
282 globus_i_gsi_gss_SSL_read_bio(
283 OM_uint32 * minor_status,
284 gss_ctx_id_desc * context,
289 globus_i_gsi_gss_get_context_goodtill(
290 OM_uint32 * minor_status,
291 gss_ctx_id_t context,
295 globus_i_gsi_gssapi_init_ssl_context(
296 OM_uint32 * minor_status,
297 gss_cred_id_t credential,
298 globus_i_gsi_gss_context_type_t anon_ctx);
301 globus_i_gsi_gssapi_openssl_error_result(
303 const char * filename,
304 const char * function_name,
306 const char * short_desc,
307 const char * long_desc);
310 globus_i_gsi_gssapi_error_result(
311 const OM_uint32 minor_status,
312 const char * filename,
313 const char * function_name,
315 const char * short_desc,
316 const char * long_desc);
319 globus_i_gsi_gssapi_error_chain_result(
320 globus_result_t chain_result,
322 const char * filename,
323 const char * function_name,
325 const char * short_desc,
326 const char * long_desc);
329 globus_i_gsi_gssapi_error_join_chains_result(
330 globus_result_t outer_error,
331 globus_result_t inner_error);
334 globus_i_gsi_gssapi_get_hostname(
335 OM_uint32 * minor_status,
336 gss_name_desc * name);
341 GSS_I_COMPATIBILITY_HYBRID,
342 GSS_I_COMPATIBILITY_STRICT_GT2,
343 GSS_I_COMPATIBILITY_STRICT_RFC2818
345 gss_i_name_compatibility_mode_t;
347 extern gss_i_name_compatibility_mode_t gss_i_name_compatibility_mode;