summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-09-05 13:53:08 +0000
committerTor Brede Vekterli <vekterli@oath.com>2018-09-05 13:53:08 +0000
commitcd9f4b62dbaba2fbf26372f57960a067c38f4fc4 (patch)
tree51e39249b4fdfb152c0b978f6aa58b0b47c31a00 /vespalib
parent3bcb5407524034b3206aef269fef52a196023504 (diff)
Try to make TLS context compile on < OpenSSL 1.0.2
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp
index c868f695b98..606e10599e7 100644
--- a/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp
+++ b/vespalib/src/vespa/vespalib/net/tls/impl/openssl_tls_context_impl.cpp
@@ -88,7 +88,7 @@ void ensure_openssl_initialized_once() {
BioPtr bio_from_string(vespalib::stringref str) {
LOG_ASSERT(str.size() <= INT_MAX);
- BioPtr bio(::BIO_new_mem_buf(str.data(), static_cast<int>(str.size())));
+ BioPtr bio(::BIO_new_mem_buf(&str[0], static_cast<int>(str.size())));
if (!bio) {
throw CryptoException("BIO_new_mem_buf");
}
@@ -222,14 +222,16 @@ void OpenSslTlsContextImpl::verify_private_key() {
void OpenSslTlsContextImpl::enable_ephemeral_key_exchange() {
// Always enabled by default on higher versions.
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10002000L) && (OPENSSL_VERSION_NUMBER < 0x10100000L)
// Auto curve selection is preferred over using SSL_CTX_set_ecdh_tmp
if (!::SSL_CTX_set_ecdh_auto(_ctx, 1)) {
throw CryptoException("SSL_CTX_set_ecdh_auto");
}
-#endif
// New ECDH key per connection.
::SSL_CTX_set_options(_ctx, SSL_OP_SINGLE_ECDH_USE);
+#else
+ // TODO make this work on OpenSSL 1.0.1 as well
+#endif
}
void OpenSslTlsContextImpl::disable_compression() {