10 #if !defined(_OSSL_OPENSSL_MISSING_H_) 11 #define _OSSL_OPENSSL_MISSING_H_ 13 #include "ruby/config.h" 16 #if !defined(OPENSSL_NO_EC) 17 #if !defined(HAVE_EC_CURVE_NIST2NID) 19 # define EC_curve_nist2nid ossl_EC_curve_nist2nid 23 #if !defined(HAVE_X509_REVOKED_DUP) 24 # define X509_REVOKED_dup(rev) (X509_REVOKED *)ASN1_dup((i2d_of_void *)i2d_X509_REVOKED, \ 25 (d2i_of_void *)d2i_X509_REVOKED, (char *)(rev)) 28 #if !defined(HAVE_X509_STORE_CTX_GET0_STORE) 29 # define X509_STORE_CTX_get0_store(x) ((x)->ctx) 32 #if !defined(HAVE_SSL_IS_SERVER) 33 # define SSL_is_server(s) ((s)->server) 37 #if !defined(HAVE_BN_GENCB_NEW) 38 # define BN_GENCB_new() ((BN_GENCB *)OPENSSL_malloc(sizeof(BN_GENCB))) 41 #if !defined(HAVE_BN_GENCB_FREE) 42 # define BN_GENCB_free(cb) OPENSSL_free(cb) 45 #if !defined(HAVE_BN_GENCB_GET_ARG) 46 # define BN_GENCB_get_arg(cb) (cb)->arg 49 #if !defined(HAVE_EVP_MD_CTX_NEW) 50 # define EVP_MD_CTX_new EVP_MD_CTX_create 53 #if !defined(HAVE_EVP_MD_CTX_FREE) 54 # define EVP_MD_CTX_free EVP_MD_CTX_destroy 57 #if !defined(HAVE_HMAC_CTX_NEW) 59 # define HMAC_CTX_new ossl_HMAC_CTX_new 62 #if !defined(HAVE_HMAC_CTX_FREE) 64 # define HMAC_CTX_free ossl_HMAC_CTX_free 67 #if !defined(HAVE_X509_STORE_GET_EX_DATA) 68 # define X509_STORE_get_ex_data(x, idx) \ 69 CRYPTO_get_ex_data(&(x)->ex_data, (idx)) 72 #if !defined(HAVE_X509_STORE_SET_EX_DATA) 73 # define X509_STORE_set_ex_data(x, idx, data) \ 74 CRYPTO_set_ex_data(&(x)->ex_data, (idx), (data)) 75 # define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ 76 CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, (l), (p), \ 77 (newf), (dupf), (freef)) 80 #if !defined(HAVE_X509_CRL_GET0_SIGNATURE) 82 # define X509_CRL_get0_signature ossl_X509_CRL_get0_signature 85 #if !defined(HAVE_X509_REQ_GET0_SIGNATURE) 87 # define X509_REQ_get0_signature ossl_X509_REQ_get0_signature 90 #if !defined(HAVE_X509_REVOKED_GET0_SERIALNUMBER) 91 # define X509_REVOKED_get0_serialNumber(x) ((x)->serialNumber) 94 #if !defined(HAVE_X509_REVOKED_GET0_REVOCATIONDATE) 95 # define X509_REVOKED_get0_revocationDate(x) ((x)->revocationDate) 98 #if !defined(HAVE_X509_GET0_TBS_SIGALG) 99 # define X509_get0_tbs_sigalg(x) ((x)->cert_info->signature) 102 #if !defined(HAVE_X509_STORE_CTX_GET0_UNTRUSTED) 103 # define X509_STORE_CTX_get0_untrusted(x) ((x)->untrusted) 106 #if !defined(HAVE_X509_STORE_CTX_GET0_CERT) 107 # define X509_STORE_CTX_get0_cert(x) ((x)->cert) 110 #if !defined(HAVE_X509_STORE_CTX_GET0_CHAIN) 111 # define X509_STORE_CTX_get0_chain(ctx) X509_STORE_CTX_get_chain(ctx) 114 #if !defined(HAVE_OCSP_SINGLERESP_GET0_ID) 115 # define OCSP_SINGLERESP_get0_id(s) ((s)->certId) 118 #if !defined(HAVE_SSL_CTX_GET_CIPHERS) 119 # define SSL_CTX_get_ciphers(ctx) ((ctx)->cipher_list) 122 #if !defined(HAVE_X509_UP_REF) 123 # define X509_up_ref(x) \ 124 CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509) 127 #if !defined(HAVE_X509_CRL_UP_REF) 128 # define X509_CRL_up_ref(x) \ 129 CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_CRL); 132 #if !defined(HAVE_X509_STORE_UP_REF) 133 # define X509_STORE_up_ref(x) \ 134 CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_STORE); 137 #if !defined(HAVE_SSL_SESSION_UP_REF) 138 # define SSL_SESSION_up_ref(x) \ 139 CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION); 142 #if !defined(HAVE_EVP_PKEY_UP_REF) 143 # define EVP_PKEY_up_ref(x) \ 144 CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_EVP_PKEY); 147 #if !defined(HAVE_OPAQUE_OPENSSL) 148 #define IMPL_PKEY_GETTER(_type, _name) \ 149 static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \ 150 return pkey->pkey._name; } 151 #define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \ 152 static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \ 153 if (a1) *a1 = obj->a1; \ 154 if (a2) *a2 = obj->a2; } \ 155 static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \ 156 if (_fail_cond) return 0; \ 157 BN_clear_free(obj->a1); obj->a1 = a1; \ 158 BN_clear_free(obj->a2); obj->a2 = a2; \ 160 #define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \ 161 static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \ 162 if (a1) *a1 = obj->a1; \ 163 if (a2) *a2 = obj->a2; \ 164 if (a3) *a3 = obj->a3; } \ 165 static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \ 166 if (_fail_cond) return 0; \ 167 BN_clear_free(obj->a1); obj->a1 = a1; \ 168 BN_clear_free(obj->a2); obj->a2 = a2; \ 169 BN_clear_free(obj->a3); obj->a3 = a3; \ 172 #if !defined(OPENSSL_NO_RSA) 176 IMPL_KEY_ACCESSOR3(RSA, crt_params, dmp1, dmq1, iqmp, (dmp1 == obj->dmp1 || dmq1 == obj->dmq1 || iqmp == obj->iqmp))
179 #if !defined(OPENSSL_NO_DSA) 185 #if !defined(OPENSSL_NO_DH) 187 IMPL_KEY_ACCESSOR2(DH, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
188 IMPL_KEY_ACCESSOR3(DH, pqg, p, q, g, (p == obj->p || obj->q && q == obj->q || g == obj->g))
189 static inline ENGINE *DH_get0_engine(DH *dh) {
return dh->engine; }
192 #if !defined(OPENSSL_NO_EC) 196 #undef IMPL_PKEY_GETTER 197 #undef IMPL_KEY_ACCESSOR2 198 #undef IMPL_KEY_ACCESSOR3 201 #if !defined(EVP_CTRL_AEAD_GET_TAG) 202 # define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG 203 # define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG 204 # define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN 207 #if !defined(HAVE_X509_GET0_NOTBEFORE) 208 # define X509_get0_notBefore(x) X509_get_notBefore(x) 209 # define X509_get0_notAfter(x) X509_get_notAfter(x) 210 # define X509_CRL_get0_lastUpdate(x) X509_CRL_get_lastUpdate(x) 211 # define X509_CRL_get0_nextUpdate(x) X509_CRL_get_nextUpdate(x) 214 #if !defined(HAVE_SSL_SESSION_GET_PROTOCOL_VERSION) 215 # define SSL_SESSION_get_protocol_version(s) ((s)->ssl_version) void ossl_HMAC_CTX_free(HMAC_CTX *)
#define IMPL_PKEY_GETTER(_type, _name)
void ossl_X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, const X509_ALGOR **)
#define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond)
int ossl_EC_curve_nist2nid(const char *)
HMAC_CTX * ossl_HMAC_CTX_new(void)
void ossl_X509_CRL_get0_signature(const X509_CRL *, const ASN1_BIT_STRING **, const X509_ALGOR **)
#define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond)