summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Glombek <christian.glombek@rwth-aachen.de>2017-09-16 08:38:01 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-09-20 03:48:08 +0200
commit702bbdd5d8dd31eda8a2dfdb726be3c6cd978ec2 (patch)
treef8463a20cabae7eb328ff6b140611cf67b19934d
parent0d870d444cbbcd1141319f60834bacb80e8d233f (diff)
Add Support for OpenSSL 1.1.0
Change-Id: I0aa58b893e8577bba94fa45c0c4c81449b12e4e2 Reviewed-on: https://gerrit.libreoffice.org/42356 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--net/Ssl.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/Ssl.cpp b/net/Ssl.cpp
index 7c04cbd95..5a9f8280b 100644
--- a/net/Ssl.cpp
+++ b/net/Ssl.cpp
@@ -42,13 +42,18 @@ SslContext::SslContext(const std::string& certFilePath,
_mutexes.emplace_back(new std::mutex);
}
-#if OPENSSL_VERSION_NUMBER >= 0x0907000L
+#if OPENSSL_VERSION_NUMBER >= 0x0907000L && OPENSSL_VERSION_NUMBER < 0x10100003L
OPENSSL_config(nullptr);
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x10100003L
+ SSL_CTX_set_options(nullptr, 0);
+ OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
+#else
SSL_library_init();
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
+#endif
CRYPTO_set_locking_callback(&SslContext::lock);
CRYPTO_set_id_callback(&SslContext::id);
@@ -234,10 +239,19 @@ void SslContext::initDH()
throw std::runtime_error("Error creating Diffie-Hellman parameters: " + msg);
}
+#if OPENSSL_VERSION_NUMBER >= 0x10100003L
+ // OpenSSL v1.1.0 has public API changes
+ // p, g and length of the Diffie-Hellman param can't be set directly anymore,
+ // instead DH_set0_pqg and DH_set_length are used
+ BIGNUM* p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
+ BIGNUM* g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
+ if ((DH_set0_pqg(dh, p, NULL, g) == 0) || (DH_set_length(dh, 160) == 0))
+#else
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
dh->length = 160;
if ((!dh->p) || (!dh->g))
+#endif
{
DH_free(dh);
throw std::runtime_error("Error creating Diffie-Hellman parameters");