34 #ifndef OPENSSL_COMPAT_H_
35 #define OPENSSL_COMPAT_H_
43 #include <openssl/rsa.h>
44 #include <openssl/ssl.h>
45 #include <openssl/x509.h>
46 #include <openssl/err.h>
49 #if OPENSSL_VERSION_NUMBER < 0x10101000L && !defined(ENABLE_CRYPTO_WOLFSSL)
50 #define SSL_CTX_set1_groups SSL_CTX_set1_curves
54 #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050000fL
61 X509_OBJECT_free(X509_OBJECT *obj)
65 X509_OBJECT_free_contents(obj);
70 #define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG
71 #define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG
74 #if defined(LIBRESSL_VERSION_NUMBER)
75 #define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT RSA_F_RSA_EAY_PRIVATE_ENCRYPT
78 #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3050400fL
79 #define SSL_get_peer_tmp_key SSL_get_server_tmp_key
83 #if OPENSSL_VERSION_NUMBER < 0x30000000L && !defined(OPENSSL_NO_EC)
93 const EC_KEY *ec = EVP_PKEY_get0_EC_KEY(pkey);
98 const EC_GROUP *group = EC_KEY_get0_group(ec);
99 int nid = EC_GROUP_get_curve_name(group);
105 const char *curve = OBJ_nid2sn(nid);
108 curve =
"(error fetching curve name)";
114 *gname_len = strlen(curve);
119 #if OPENSSL_VERSION_NUMBER < 0x30000000L
120 #define EVP_MD_get0_name EVP_MD_name
121 #define EVP_CIPHER_get0_name EVP_CIPHER_name
122 #define EVP_CIPHER_CTX_get_mode EVP_CIPHER_CTX_mode
125 #define SSL_CTX_new_ex(libctx, propq, method) \
126 SSL_CTX_new((method))
134 static inline const EVP_CIPHER *
139 return EVP_get_cipherbyname(algorithm);
142 static inline const EVP_MD *
147 return EVP_get_digestbyname(algorithm);
162 static inline unsigned long
165 const char **data,
int *flags)
167 static const char *empty =
"";
169 unsigned long err = ERR_get_error_line_data(file, line, data, flags);