ITS#8753, ITS#8774 - Fix compilation with older versions of OpenSSL

This commit is contained in:
Quanah Gibson-Mount 2017-11-17 14:30:45 -08:00
parent 36da75830f
commit f5da6638ec

View File

@ -867,7 +867,11 @@ tlso_session_pinning( LDAP *ld, tls_session *sess, char *hashalg, struct berval
goto done;
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000
mdctx = EVP_MD_CTX_new();
#else
mdctx = EVP_MD_CTX_create();
#endif
if ( !mdctx ) {
rc = -1;
goto done;
@ -877,7 +881,11 @@ tlso_session_pinning( LDAP *ld, tls_session *sess, char *hashalg, struct berval
EVP_DigestUpdate( mdctx, key.bv_val, key.bv_len );
EVP_DigestFinal_ex( mdctx, (unsigned char *)keyhash.bv_val, &len );
keyhash.bv_len = len;
#if OPENSSL_VERSION_NUMBER >= 0x10100000
EVP_MD_CTX_free( mdctx );
#else
EVP_MD_CTX_destroy( mdctx );
#endif
} else {
keyhash = key;
}