From patchwork Mon Feb 25 07:35:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Strogin X-Patchwork-Id: 696 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id UNBBG8A1dFymGQAAIUCqbw for ; Mon, 25 Feb 2019 13:36:48 -0500 Received: from proxy10.mail.ord1d.rsapps.net ([172.30.191.6]) by director12.mail.ord1d.rsapps.net with LMTP id 8KNLG8A1dFwdZQAAIasKDg ; Mon, 25 Feb 2019 13:36:48 -0500 Received: from smtp19.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy10.mail.ord1d.rsapps.net with LMTP id +MzAGsA1dFz2HQAAfSg8FQ ; Mon, 25 Feb 2019 13:36:48 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp19.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 4ed831d4-392c-11e9-bef9-525400d67fa8-1-1 Received: from [216.105.38.7] ([216.105.38.7:45769] helo=lists.sourceforge.net) by smtp19.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 3B/44-30680-FB5347C5; Mon, 25 Feb 2019 13:36:48 -0500 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gyL6c-0007C1-Vm; Mon, 25 Feb 2019 18:35:58 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gyL6b-0007Br-5C for openvpn-devel@lists.sourceforge.net; Mon, 25 Feb 2019 18:35:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B6tSL07ANPyDaqXfUw836+9BLYN3Ggbq8l1jLqI4F/Q=; b=MInF3KUbIn05Z8HJbdwzdxD4pT yQ5Q57Fu+7TLD7KfLekbWOIyOZzTHKO6ZzYlLaIWtleD5I7gnCv4THp7kcFkekwUlI9TTq6DVorQl zX5CaOpgJG5V4wXcOBW6wf/y+M49nIjMhUeJLNhewxl5TmN0F3uer4LCsRmObf81ckgg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=B6tSL07ANPyDaqXfUw836+9BLYN3Ggbq8l1jLqI4F/Q=; b=h E2y5aKV2tZ38LPIjtLjkWno+PrYisoZCWuQ/H1rUTxvwQEoefJznpmSHJCRyhHiRQnKS4d4IyGcyS tQCsDqb5cZB9i+KVyvQg3EL+CQi6oOmZq+ex9md8KwW79eVyu13Z5pqQ/GHLl0szPP6JMSrDJKyFN O5hObyDozggdOmho=; Received: from mail-ed1-f41.google.com ([209.85.208.41]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1gyL6Z-00FNaS-EQ for openvpn-devel@lists.sourceforge.net; Mon, 25 Feb 2019 18:35:57 +0000 Received: by mail-ed1-f41.google.com with SMTP id j89so8417577edb.9 for ; Mon, 25 Feb 2019 10:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B6tSL07ANPyDaqXfUw836+9BLYN3Ggbq8l1jLqI4F/Q=; b=CUFmLSNVQBuoH2WLG5MV4k8rEqZ0tqDdCxLs1gBinVnpOXhr0hET5ZeMSuw1O1qph6 aXAtV3iUke+QAWeaJ2EQcaCLCvccAHHkot4GwEVMWf00jIMSv1M5mOIHMnpLVJJSpAbY nvPlboY7XzuDihhOPYSlgkdRwGCZuLMsxt2cbmgaI5srFEyayWhg1KL/RIBBMxFoBqhD Nsnr71tRcUyQ+KFa3EPyV9LlufQW7mLhoc+/BttZ2NodAWVnNeVt1KdbrQAgPw36D0WU 541Fv0E23D1YEC2YrN8336v2kFRL4Tm3NNJSz+lD5jmvNLSEehut1Bo/6/Y+MDIAs4NO SmPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=B6tSL07ANPyDaqXfUw836+9BLYN3Ggbq8l1jLqI4F/Q=; b=UkEbMvJJAG7nr+SxEq3u5HXwTqFvHVx9UfahU+D5floLXMS+U7yuS5ylrU71vqZbWG nK5nLEjdETZN5f1RFA+UE4GdZbh75AJhiq0uxcbVoqpluOsqrWTH0tzD5rW8xRtGC0Fi CrrqMazdASzoZqXv5EEADJ+0EMzUPDqIQUZ6xC+wGX/xSCExuh3tD1uvL4nmxtwIVlgs /N4MY/jDXleeUwBiVnh106ja1VwbIoWuqWdLZ8f2yetjO6yCuMHzRvCa6KZms95Q/XIh 45gnU0fI/5pZLHrVWvwAIsRuqWvUYPN0//xKitxpVyjjKzESEuupxJm3aQOb6GlzlGwX hVYA== X-Gm-Message-State: AHQUAuZo8R4ujp/ATjWKpV+TJ++Cq/O2sJHta5tWMpCmS+s5sJGUHyFQ mz8VdkUZxovnrlEQxsTALd0NpNUHQg== X-Google-Smtp-Source: AHgI3IYhztAd0JjLsKnofAS+3uGLPMsWdtpyuff294X4gtGffvibSg9ya7o/O+fWNOEYJtAerSCpow== X-Received: by 2002:a50:f599:: with SMTP id u25mr10480152edm.48.1551119748149; Mon, 25 Feb 2019 10:35:48 -0800 (PST) Received: from localhost.localdomain (pripet.hukot.net. [46.36.39.187]) by smtp.gmail.com with ESMTPSA id a4sm1846186eje.66.2019.02.25.10.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 10:35:47 -0800 (PST) From: Stefan Strogin To: openvpn-devel@lists.sourceforge.net, Arne Schwabe Date: Mon, 25 Feb 2019 20:35:31 +0200 Message-Id: <20190225183531.27399-1-stefan.strogin@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefan.strogin[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.208.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1gyL6Z-00FNaS-EQ Subject: [Openvpn-devel] [PATCH v2] Use correct ifdefs for LibreSSL support X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox - TLS 1.3 is not ready yet in LibreSSL. Also there is a theoretical possibility of OpenSSL >=1.1.1 built without TLS 1.3 support. - EC_KEY_METHOD API and SSL_get1_supported_ciphers are added into LibreSSL master (not yet released in 2.9.0). - Some methods that are available since LibreSSL 2.7.0 were thrown away in ssl_openssl.c regardless of LibreSSL version. Use them with newer LibreSSL. Signed-off-by: Stefan Strogin Acked-By: Arne Schwabe --- src/openvpn/ssl_openssl.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index ddb78da7..8bcebac4 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -465,7 +465,7 @@ tls_ctx_restrict_ciphers_tls13(struct tls_root_ctx *ctx, const char *ciphers) return; } -#if (OPENSSL_VERSION_NUMBER < 0x1010100fL) +#if !defined(TLS1_3_VERSION) crypto_msg(M_WARN, "Not compiled with OpenSSL 1.1.1 or higher. " "Ignoring TLS 1.3 only tls-ciphersuites '%s' setting.", ciphers); @@ -526,7 +526,8 @@ tls_ctx_check_cert_time(const struct tls_root_ctx *ctx) ASSERT(ctx); -#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) +#if (OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)) \ + || LIBRESSL_VERSION_NUMBER >= 0x2070000fL /* OpenSSL 1.0.2 and up */ cert = SSL_CTX_get0_certificate(ctx->ctx); #else @@ -561,7 +562,8 @@ tls_ctx_check_cert_time(const struct tls_root_ctx *ctx) } cleanup: -#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER < 0x10002000L \ + || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) SSL_free(ssl); #endif return; @@ -1209,7 +1211,9 @@ err: return 0; } -#if OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_EC) && !defined(LIBRESSL_VERSION_NUMBER) +#if ((OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)) \ + || LIBRESSL_VERSION_NUMBER > 0x2090000fL) \ + && !defined(OPENSSL_NO_EC) /* called when EC_KEY is destroyed */ static void @@ -1331,7 +1335,7 @@ err: } return 0; } -#endif /* OPENSSL_VERSION_NUMBER > 1.1.0 dev */ +#endif /* OPENSSL_VERSION_NUMBER > 1.1.0 dev && !defined(OPENSSL_NO_EC) */ int tls_ctx_use_management_external_key(struct tls_root_ctx *ctx) @@ -1340,7 +1344,8 @@ tls_ctx_use_management_external_key(struct tls_root_ctx *ctx) ASSERT(NULL != ctx); -#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) +#if (OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER)) \ + || LIBRESSL_VERSION_NUMBER >= 0x2070000fL /* OpenSSL 1.0.2 and up */ X509 *cert = SSL_CTX_get0_certificate(ctx->ctx); #else @@ -1362,7 +1367,9 @@ tls_ctx_use_management_external_key(struct tls_root_ctx *ctx) goto cleanup; } } -#if OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_EC) && !defined(LIBRESSL_VERSION_NUMBER) +#if ((OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)) \ + || LIBRESSL_VERSION_NUMBER > 0x2090000fL) \ + && !defined(OPENSSL_NO_EC) else if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) { if (!tls_ctx_use_external_ec_key(ctx, pkey)) @@ -1375,17 +1382,18 @@ tls_ctx_use_management_external_key(struct tls_root_ctx *ctx) crypto_msg(M_WARN, "management-external-key requires an RSA or EC certificate"); goto cleanup; } -#else /* if OPENSSL_VERSION_NUMBER > 0x10100000L && !defined(OPENSSL_NO_EC) && !defined(LIBRESSL_VERSION_NUMBER) */ +#else /* OPENSSL_VERSION_NUMBER > 1.1.0 dev && !defined(OPENSSL_NO_EC) */ else { crypto_msg(M_WARN, "management-external-key requires an RSA certificate"); goto cleanup; } -#endif /* OPENSSL_VERSION_NUMBER > 1.1.0 dev */ +#endif /* OPENSSL_VERSION_NUMBER > 1.1.0 dev && !defined(OPENSSL_NO_EC) */ ret = 0; cleanup: -#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined(LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER < 0x10002000L \ + || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) if (ssl) { SSL_free(ssl); @@ -1998,7 +2006,7 @@ show_available_tls_ciphers_list(const char *cipher_list, crypto_msg(M_FATAL, "Cannot create SSL_CTX object"); } -#if (OPENSSL_VERSION_NUMBER >= 0x1010100fL) +#if defined(TLS1_3_VERSION) if (tls13) { SSL_CTX_set_min_proto_version(tls_ctx.ctx, TLS1_3_VERSION); @@ -2019,7 +2027,8 @@ show_available_tls_ciphers_list(const char *cipher_list, crypto_msg(M_FATAL, "Cannot create SSL object"); } -#if (OPENSSL_VERSION_NUMBER < 0x1010000fL) +#if (OPENSSL_VERSION_NUMBER < 0x1010000fL) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER <= 0x2090000fL) STACK_OF(SSL_CIPHER) *sk = SSL_get_ciphers(ssl); #else STACK_OF(SSL_CIPHER) *sk = SSL_get1_supported_ciphers(ssl);