openssl: use macro to guard the opaque EVP_PKEY branch

This commit is contained in:
Viktor Szakats 2016-02-16 00:22:54 +01:00 committed by Daniel Stenberg
parent ae01698ea4
commit 71398487e7

View File

@ -108,6 +108,7 @@
#define SSLeay_add_ssl_algorithms() SSL_library_init() #define SSLeay_add_ssl_algorithms() SSL_library_init()
#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER #define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
#define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */ #define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */
#define HAVE_OPAQUE_EVP_PKEY 1 /* since 1.1.0 -pre3 */
#endif #endif
#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* 1.0.2 or later */ \ #if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* 1.0.2 or later */ \
@ -2357,8 +2358,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
infof(data, " Unable to load public key\n"); infof(data, " Unable to load public key\n");
else { else {
int pktype; int pktype;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ #ifdef HAVE_OPAQUE_EVP_PKEY
!defined(LIBRESSL_VERSION_NUMBER)
pktype = EVP_PKEY_id(pubkey); pktype = EVP_PKEY_id(pubkey);
#else #else
pktype = pubkey->type; pktype = pubkey->type;
@ -2367,8 +2367,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
case EVP_PKEY_RSA: case EVP_PKEY_RSA:
{ {
RSA *rsa; RSA *rsa;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ #ifdef HAVE_OPAQUE_EVP_PKEY
!defined(LIBRESSL_VERSION_NUMBER)
rsa = EVP_PKEY_get0_RSA(pubkey); rsa = EVP_PKEY_get0_RSA(pubkey);
#else #else
rsa = pubkey->pkey.rsa; rsa = pubkey->pkey.rsa;
@ -2389,8 +2388,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
case EVP_PKEY_DSA: case EVP_PKEY_DSA:
{ {
DSA *dsa; DSA *dsa;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ #ifdef HAVE_OPAQUE_EVP_PKEY
!defined(LIBRESSL_VERSION_NUMBER)
dsa = EVP_PKEY_get0_DSA(pubkey); dsa = EVP_PKEY_get0_DSA(pubkey);
#else #else
dsa = pubkey->pkey.dsa; dsa = pubkey->pkey.dsa;
@ -2405,8 +2403,7 @@ static CURLcode get_cert_chain(struct connectdata *conn,
case EVP_PKEY_DH: case EVP_PKEY_DH:
{ {
DH *dh; DH *dh;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ #ifdef HAVE_OPAQUE_EVP_PKEY
!defined(LIBRESSL_VERSION_NUMBER)
dh = EVP_PKEY_get0_DH(pubkey); dh = EVP_PKEY_get0_DH(pubkey);
#else #else
dh = pubkey->pkey.dh; dh = pubkey->pkey.dh;