[Libreoffice-commits] online.git: Branch 'libreoffice-5-4' - net/Ssl.cpp
Christian Glombek
christian.glombek at rwth-aachen.de
Wed Sep 20 08:05:34 UTC 2017
net/Ssl.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
New commits:
commit fa6cdb4db0a80b85042d2ebc43bbf28d2e30d7eb
Author: Christian Glombek <christian.glombek at rwth-aachen.de>
Date: Sat Sep 16 08:38:01 2017 +0200
Add Support for OpenSSL 1.1.0
Change-Id: I0aa58b893e8577bba94fa45c0c4c81449b12e4e2
Reviewed-on: https://gerrit.libreoffice.org/42511
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/net/Ssl.cpp b/net/Ssl.cpp
index e350257c..64f279d4 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);
@@ -233,10 +238,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");
More information about the Libreoffice-commits
mailing list