From d8a34131e1ea40976802261565a8a977a91e1259 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 14 Apr 2018 18:01:50 +0900 Subject: [PATCH] libressl 2.7 has SSL_CTX_get0_certificate --- src/shrpx_tls.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/shrpx_tls.cc b/src/shrpx_tls.cc index fc65137d..81c66f5b 100644 --- a/src/shrpx_tls.cc +++ b/src/shrpx_tls.cc @@ -1555,16 +1555,15 @@ int cert_lookup_tree_add_ssl_ctx( SSL_CTX *ssl_ctx) { std::array buf; -#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10002000L +#if LIBRESSL_2_7_API || \ + (!LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L) auto cert = SSL_CTX_get0_certificate(ssl_ctx); -#else // defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < - // 0x10002000L +#else // !LIBRESSL_2_7_API && OPENSSL_VERSION_NUMBER < 0x10002000L auto tls_ctx_data = static_cast(SSL_CTX_get_app_data(ssl_ctx)); auto cert = load_certificate(tls_ctx_data->cert_file); auto cert_deleter = defer(X509_free, cert); -#endif // defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < - // 0x10002000L +#endif // !LIBRESSL_2_7_API && OPENSSL_VERSION_NUMBER < 0x10002000L auto altnames = static_cast( X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr));