17 #ifndef GSSAPI_OPENSSL_H 18 #define GSSAPI_OPENSSL_H 26 #include "globus_config.h" 27 #include "globus_common.h" 32 #include "globus_gsi_callback.h" 33 #include "globus_gsi_proxy.h" 34 #include "globus_gsi_credential.h" 37 #include "openssl/ssl.h" 38 #include "openssl/err.h" 39 #include "openssl/bio.h" 40 #include "openssl/pem.h" 41 #include "openssl/x509.h" 42 #include "openssl/x509v3.h" 43 #include "openssl/stack.h" 45 #define GLOBUS_I_GSI_GSSAPI_IMPL_VERSION 1 47 #define GSS_I_CTX_INITIALIZED 1 48 #define GSS_I_DISALLOW_ENCRYPTION 2 49 #define GSS_I_PROTECTION_FAIL_ON_CONTEXT_EXPIRATION 4 50 #define GSS_I_APPLICATION_WILL_HANDLE_EXTENSIONS 8 52 #define GSS_C_QOP_GLOBUS_GSSAPI_OPENSSL_BIG 1 75 #define SSL3_RT_GSSAPI_OPENSSL 26 79 #define L2N(LONG_VAL, CHAR_ARRAY) \ 81 unsigned char * _char_array_ = CHAR_ARRAY; \ 82 *(_char_array_++) = (unsigned char) (((LONG_VAL) >> 24) & 0xff); \ 83 *(_char_array_++) = (unsigned char) (((LONG_VAL) >> 16) & 0xff); \ 84 *(_char_array_++) = (unsigned char) (((LONG_VAL) >> 8) & 0xff); \ 85 *(_char_array_++) = (unsigned char) (((LONG_VAL)) & 0xff); \ 88 #define N2L(CHAR_ARRAY, LONG_VAL) \ 90 const unsigned char * _char_array_ = CHAR_ARRAY; \ 91 (LONG_VAL) = ((*(_char_array_++)) << 24) & 0xff000000; \ 92 (LONG_VAL) |= ((*(_char_array_++)) << 16) & 0xff0000; \ 93 (LONG_VAL) |= ((*(_char_array_++)) << 8) & 0xff00; \ 94 (LONG_VAL) |= ((*(_char_array_++)) & 0xff); \ 97 #define N2S(CHAR_ARRAY, SHORT) \ 99 char * _char_array_ = CHAR_ARRAY; \ 100 (SHORT) = ((unsigned int) (*(_char_array_++))) << 8; \ 101 (SHORT) |= ((unsigned int) (*(_char_array_++))); \ 104 #define S2N(SHORT, CHAR_ARRAY) \ 106 char * _char_array_ = CHAR_ARRAY; \ 107 *(_char_array_++) = (unsigned char) (((SHORT) >> 8) & 0xff); \ 108 *(_char_array_++) = (unsigned char) ((SHORT) & 0xff); \ 111 #define U642N(U64VAL, CHAR_ARRAY) \ 113 unsigned char * _char_array_ = CHAR_ARRAY; \ 114 *(_char_array_++) = (unsigned char) (((U64VAL) >> 56) & 0xff); \ 115 *(_char_array_++) = (unsigned char) (((U64VAL) >> 48) & 0xff); \ 116 *(_char_array_++) = (unsigned char) (((U64VAL) >> 40) & 0xff); \ 117 *(_char_array_++) = (unsigned char) (((U64VAL) >> 32) & 0xff); \ 118 *(_char_array_++) = (unsigned char) (((U64VAL) >> 24) & 0xff); \ 119 *(_char_array_++) = (unsigned char) (((U64VAL) >> 16) & 0xff); \ 120 *(_char_array_++) = (unsigned char) (((U64VAL) >> 8) & 0xff); \ 121 *(_char_array_++) = (unsigned char) (((U64VAL) ) & 0xff); \ 124 #define N2U64(CHAR_ARRAY, U64VAL) \ 126 const unsigned char * _char_array_ = CHAR_ARRAY; \ 127 uint64_t _u64val_ = 0; \ 128 _u64val_ = (((uint64_t)(*(_char_array_++))) << 56) & 0xff00000000000000; \ 129 _u64val_ = (((uint64_t)(*(_char_array_++))) << 48) & 0xff000000000000; \ 130 _u64val_ = (((uint64_t)(*(_char_array_++))) << 40) & 0xff0000000000; \ 131 _u64val_ = (((uint64_t)(*(_char_array_++))) << 32) & 0xff00000000; \ 132 _u64val_ = (((uint64_t)(*(_char_array_++))) << 24) & 0xff000000; \ 133 _u64val_ = (((uint64_t)(*(_char_array_++))) << 16) & 0xff0000; \ 134 _u64val_ = (((uint64_t)(*(_char_array_++))) << 8) & 0xff00; \ 135 _u64val_ = (((uint64_t)(*(_char_array_++))) ) & 0xff; \ 136 (U64VAL) = _u64val_; \ 140 #define g_OID_equal(o1, o2) \ 143 ((o1)->length == (o2)->length) && \ 144 (memcmp((o1)->elements,(o2)->elements,(int) (o1)->length) == 0))) 146 typedef struct gss_name_desc_struct {
151 char * x509n_oneline;
152 GENERAL_NAMES * subjectAltNames;
161 typedef struct gss_cred_id_desc_struct {
162 globus_gsi_cred_handle_t cred_handle;
163 gss_name_desc * globusid;
164 gss_cred_usage_t cred_usage;
165 SSL_CTX * ssl_context;
169 typedef struct gss_ctx_id_desc_struct{
170 globus_mutex_t mutex;
171 globus_gsi_callback_data_t callback_data;
172 gss_cred_id_desc * peer_cred_handle;
173 gss_cred_id_desc * cred_handle;
174 gss_cred_id_desc * deleg_cred_handle;
175 globus_gsi_proxy_handle_t proxy_handle;
181 #if OPENSSL_VERSION_NUMBER >= 0x10000100L 183 uint64_t mac_read_sequence;
185 uint64_t mac_write_sequence;
187 unsigned char * mac_key;
192 unsigned char * mac_iv_fixed;
199 int locally_initiated;
201 gss_OID_set extension_oids;
202 gss_cred_id_t *sni_credentials;
203 size_t sni_credentials_count;
204 char *sni_servername;
210 const gss_OID_desc *
const gss_mech_globus_gssapi_openssl;
213 const gss_OID_desc *
const gss_mech_globus_gssapi_openssl_micv2;
216 const gss_OID_desc *
const gss_proxycertinfo_extension;
219 gss_OID_desc * gss_nt_host_ip;
222 gss_OID_desc * gss_nt_x509;
225 const gss_OID_desc *
const gss_ext_server_name_oid;
228 const gss_OID_desc *
const gss_ext_alpn_oid;
232 globus_bool_t globus_i_backward_compatible_mic;
234 globus_bool_t globus_i_accept_backward_compatible_mic;
236 #define GLOBUS_GSS_C_NT_HOST_IP gss_nt_host_ip 237 #define GLOBUS_GSS_C_NT_X509 gss_nt_x509 243 globus_l_gsi_gssapi_activate_once(
void);
247 OM_uint32 *minor_status,
248 const gss_ctx_id_t context_handle,
249 const EVP_MD ** hash,
250 const EVP_CIPHER ** cipher);
254 globus_i_gssapi_gsi_gmac(
255 OM_uint32 * minor_status,
256 const EVP_CIPHER * evp_cipher,
257 const unsigned char * iv,
258 const unsigned char * key,
259 const gss_buffer_desc *message_buffer,
260 unsigned char tag[
static 16]);
gss_delegation_state_t
Delegation State Type.
Definition: globus_gsi_gss_constants.h:110
globus_thread_once_t once_control
Definition: module.c:115
gss_con_st_t
Connection State Type.
Definition: globus_gsi_gss_constants.h:98
Globus GSI GSS constants.
OM_uint32 globus_i_gss_get_hash(OM_uint32 *minor_status, const gss_ctx_id_t context_handle, const EVP_MD **hash, const EVP_CIPHER **cipher)
Find the hash and cipher functions used by a context.
Definition: get_hash.c:24