Fix compilation without deprecated APIs in OpenSSL 1.1

Prior commit was tested with 1.0.2. This one with 1.1.
This commit is contained in:
Rosen Penev
2018-11-23 19:17:12 -08:00
parent dddcef52b9
commit f6eb43673c
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -370,7 +370,7 @@ if test "x$SSL" != "xno"; then
#include <openssl/ssl.h>
#include <openssl/dh.h>
]], [[
SSL_CTX* ctx = SSL_CTX_new(TLSv1_method());
SSL_CTX* ctx = SSL_CTX_new(SSLv23_method());
SSL* ssl = SSL_new(ctx);
DH* dh = DH_new();
DH_free(dh);
+6 -2
View File
@@ -29,6 +29,10 @@
#include <openssl/ssl.h>
#include <openssl/bn.h>
#include <openssl/rsa.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define X509_getm_notBefore X509_get_notBefore
#define X509_getm_notAfter X509_get_notAfter
#endif
#endif /* HAVE_LIBSSL */
#include <memory>
#include <unistd.h>
@@ -95,8 +99,8 @@ void CUtils::GenerateCert(FILE* pOut, const CString& sHost) {
X509_set_version(pCert.get(), 2);
ASN1_INTEGER_set(X509_get_serialNumber(pCert.get()), serial);
X509_gmtime_adj(X509_get_notBefore(pCert.get()), 0);
X509_gmtime_adj(X509_get_notAfter(pCert.get()),
X509_gmtime_adj(X509_getm_notBefore(pCert.get()), 0);
X509_gmtime_adj(X509_getm_notAfter(pCert.get()),
(long)60 * 60 * 24 * days * years);
X509_set_pubkey(pCert.get(), pKey.get());