Crypto and NetSSL fixes for OpenSSL 1.1

This commit is contained in:
Günter Obiltschnig
2016-11-27 23:58:39 +01:00
parent daa2db3c53
commit 75a7ee4b0f
6 changed files with 103 additions and 20 deletions

View File

@@ -494,6 +494,17 @@ void Context::initDH(const std::string& dhParamsFile)
std::string msg = Utility::getLastError();
throw SSLContextException("Error creating Diffie-Hellman parameters", msg);
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
BIGNUM* p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
BIGNUM* g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
DH_set0_pqg(dh, p, 0, g);
DH_set_length(dh, 160);
if (!p || !g)
{
DH_free(dh);
throw SSLContextException("Error creating Diffie-Hellman parameters");
}
#else
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
dh->length = 160;
@@ -502,6 +513,7 @@ void Context::initDH(const std::string& dhParamsFile)
DH_free(dh);
throw SSLContextException("Error creating Diffie-Hellman parameters");
}
#endif
}
SSL_CTX_set_tmp_dh(_pSSLContext, dh);
SSL_CTX_set_options(_pSSLContext, SSL_OP_SINGLE_DH_USE);