From 50eb7ba2fdc2381de7b1c92fb097805b657a59a0 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 22 Mar 2020 05:58:59 +0700 Subject: [PATCH] #1601 Fixed compatibility with OpenSSL 1.0.x. --- src/base/net/tls/TlsContext.cpp | 14 ++++++++++++++ src/base/net/tls/TlsGen.cpp | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/base/net/tls/TlsContext.cpp b/src/base/net/tls/TlsContext.cpp index 9c43a68af..d29c744b4 100644 --- a/src/base/net/tls/TlsContext.cpp +++ b/src/base/net/tls/TlsContext.cpp @@ -34,6 +34,20 @@ #include +// https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes#Compatibility_Layer +#if OPENSSL_VERSION_NUMBER < 0x10100000L +int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) +{ + assert(q == nullptr); + + dh->p = p; + dh->g = g; + + return 1; + } +#endif + + namespace xmrig { diff --git a/src/base/net/tls/TlsGen.cpp b/src/base/net/tls/TlsGen.cpp index 817e045d3..c56ef2a21 100644 --- a/src/base/net/tls/TlsGen.cpp +++ b/src/base/net/tls/TlsGen.cpp @@ -110,7 +110,7 @@ bool xmrig::TlsGen::generate_x509(const char *commonName) X509_gmtime_adj(X509_get_notAfter(m_x509), 315360000L); auto name = X509_get_subject_name(m_x509); - X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_ASC, reinterpret_cast(commonName), -1, -1, 0); + X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, reinterpret_cast(commonName), -1, -1, 0); X509_set_issuer_name(m_x509, name);