Browse Source

Let autoconf detect presence of EVP_MD_CTX_new

Fixes LibreSSL compatibility
0.14
Luke Dashjr 8 years ago
parent
commit
0388afe69d
  1. 7
      configure.ac
  2. 4
      src/qt/paymentrequestplus.cpp

7
configure.ac

@ -832,6 +832,13 @@ else
fi fi
fi fi
save_CXXFLAGS="${CXXFLAGS}"
CXXFLAGS="${CXXFLAGS} ${CRYPTO_CFLAGS} ${SSL_CFLAGS}"
AC_CHECK_DECLS([EVP_MD_CTX_new],,,[AC_INCLUDES_DEFAULT
#include <openssl/x509_vfy.h>
])
CXXFLAGS="${save_CXXFLAGS}"
dnl univalue check dnl univalue check
need_bundled_univalue=yes need_bundled_univalue=yes

4
src/qt/paymentrequestplus.cpp

@ -159,7 +159,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
std::string data_to_verify; // Everything but the signature std::string data_to_verify; // Everything but the signature
rcopy.SerializeToString(&data_to_verify); rcopy.SerializeToString(&data_to_verify);
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if HAVE_DECL_EVP_MD_CTX_NEW
EVP_MD_CTX *ctx = EVP_MD_CTX_new(); EVP_MD_CTX *ctx = EVP_MD_CTX_new();
if (!ctx) throw SSLVerifyError("Error allocating OpenSSL context."); if (!ctx) throw SSLVerifyError("Error allocating OpenSSL context.");
#else #else
@ -174,7 +174,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
!EVP_VerifyFinal(ctx, (const unsigned char*)paymentRequest.signature().data(), (unsigned int)paymentRequest.signature().size(), pubkey)) { !EVP_VerifyFinal(ctx, (const unsigned char*)paymentRequest.signature().data(), (unsigned int)paymentRequest.signature().size(), pubkey)) {
throw SSLVerifyError("Bad signature, invalid payment request."); throw SSLVerifyError("Bad signature, invalid payment request.");
} }
#if OPENSSL_VERSION_NUMBER >= 0x10100000L #if HAVE_DECL_EVP_MD_CTX_NEW
EVP_MD_CTX_free(ctx); EVP_MD_CTX_free(ctx);
#endif #endif

Loading…
Cancel
Save