1 /* Compatibility stuff for API changes in OpenSSL 1.1 */
2 #include <openssl/opensslv.h>
3 #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL
4 #define HAS_OPENSSL11_API 1
5 #elif !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100001L
6 #define HAS_OPENSSL11_API 1
7 #endif
8 
9 #ifdef HAS_OPENSSL11_API
10 #define MY_EVP_PKEY_get0_RSA EVP_PKEY_get0_RSA
11 #define MY_EVP_PKEY_get0_DSA EVP_PKEY_get0_DSA
12 #define MY_EVP_PKEY_get0_EC_KEY EVP_PKEY_get0_EC_KEY
13 #define MY_RSA_set0_key RSA_set0_key
14 #define MY_RSA_set0_factors RSA_set0_factors
15 #define MY_RSA_set0_crt_params RSA_set0_crt_params
16 #define MY_RSA_get0_key RSA_get0_key
17 #define MY_RSA_get0_factors RSA_get0_factors
18 #define MY_RSA_get0_crt_params RSA_get0_crt_params
19 #define MY_DSA_set0_pqg DSA_set0_pqg
20 #define MY_DSA_set0_key DSA_set0_key
21 #define MY_DSA_get0_pqg DSA_get0_pqg
22 #define MY_DSA_get0_key DSA_get0_key
23 #define MY_X509_get0_signature X509_get0_signature
24 #define MY_ECDSA_SIG_get0 ECDSA_SIG_get0
25 #define MY_ECDSA_SIG_set0 ECDSA_SIG_set0
26 
27 #else
28 
29 RSA *MY_EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
30 DSA *MY_EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
31 EC_KEY *MY_EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
32 int MY_RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
33 int MY_RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
34 int MY_RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
35 void MY_RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
36 void MY_RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
37 void MY_RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, const BIGNUM **iqmp);
38 int MY_DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
39 int MY_DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
40 void MY_DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
41 void MY_DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key);
42 void MY_X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg, const X509 *x);
43 void MY_ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
44 int MY_ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
45 
46 #endif
47