[Openvpn-devel] Do not assume that SSL_CTX_get/set_min/max_proto_version are macros
| Message ID | 1520185442-22901-1-git-send-email-selva.nair@gmail.com |
|---|---|
| State | Superseded |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.27.255.1]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id SyvgKakwnFoPPgAAIUCqbw for <patchwork@openvpn.net>; Sun, 04 Mar 2018 12:45:13 -0500 Received: from proxy9.mail.iad3a.rsapps.net ([172.27.255.1]) by director8.mail.ord1d.rsapps.net (Dovecot) with LMTP id YQVWFakwnFp5aAAAfY0hYg ; Sun, 04 Mar 2018 12:45:13 -0500 Received: from smtp15.gate.iad3a ([172.27.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy9.mail.iad3a.rsapps.net with LMTP id cJSrIqkwnFoEZgAAGuSQww ; Sun, 04 Mar 2018 12:45:13 -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: smtp15.gate.iad3a.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-Classification-ID: ca22fac2-1fd3-11e8-acfc-525400f46865-1-1 Received: from [216.105.38.7] ([216.105.38.7:41739] helo=lists.sourceforge.net) by smtp15.gate.iad3a.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 07/D9-09394-9A03C9A5; Sun, 04 Mar 2018 12:45:13 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.89) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1esXgV-000AW9-26; Sun, 04 Mar 2018 17:44:31 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from <selva.nair@gmail.com>) id 1esXgU-000AW3-1n for openvpn-devel@lists.sourceforge.net; Sun, 04 Mar 2018 17:44:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding: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=e3jE70UcONKDlch0oryym2qWT2UMAIa2Xzf8Pq3jJCs=; b=GGNzHVczKFSZfhDZN5IFaT6JCf weEBP4nnl4FiguXe2Qtwdopegb/otthmErZQLZh/lYHQ11ne8peCyR5u9/4vetOck6VqRPZIeXhTa WwMAlT8t4GO9BhyHR3CQ9I5447rp8OrZ+RpFeAB3grqoLzEP7ygXMHOTQ6TXa+SDUAiA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding: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=e3jE70UcONKDlch0oryym2qWT2UMAIa2Xzf8Pq3jJCs=; b=Y/dVpm3+B9mAZFM9lDk7jxkt8e NpOXyi2W3q1Uct6aYfnHVTGjvf2faiwViijG2aB2eJ8R6UN6/BxncWm22LiRH0mG6MHSC5sfjKqdN 8XxcBb7EO13LyOUCuAhW5GvJIXtCx1psddWQrJVdR6DJyHbM9Iw4IakJxENEY9I2QZGQ=; Received: from sfi-lb-mx.v20.lw.sourceforge.com ([172.30.20.201] helo=mail-io0-f193.google.com) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1esXgM-000pCw-Hz for openvpn-devel@lists.sourceforge.net; Sun, 04 Mar 2018 17:44:29 +0000 Received: by mail-io0-f193.google.com with SMTP id d71so15523895iog.4 for <openvpn-devel@lists.sourceforge.net>; Sun, 04 Mar 2018 09:44:22 -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; bh=e3jE70UcONKDlch0oryym2qWT2UMAIa2Xzf8Pq3jJCs=; b=iPHxqfR3cDlcZvR6GSBmKB61jS4i3Yv/aeNeRRWyYiLSE1pTEkcxBO/UDSCKVv6f5+ 5tUNBtgRjXIjBwVBwDRM9TAEkh9ZjtSbE1N1dhhiyBeIfVh7Anelvv1YorekKOwNIcrn 8DJl04AilIXQOWXyybLG8BbbUf8G588V6dvdJsU3OBxJAkW0g4q53wUNMl/l9Zjmh+Kd jRMu2s1T+MqLq8eB6UOx9ji1CbNgfv9uWWI0wAzMTXOa0kmeye11+zvH5jTRZtGMiiZH oJ2FtgFkNdNqmeT+B8kdHIWqLfgk1vndxEMv3QgRJxdFhQECHyinLfOJloVWZT4e4/lq dOTQ== 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; bh=e3jE70UcONKDlch0oryym2qWT2UMAIa2Xzf8Pq3jJCs=; b=SBgmM/W36uEkcnlO+VfXhO8zu7c4/81megg1puV5I2hLSnWe07Q/El3xyYCy6ilsk6 TROREDeSaIpW/3cX0yIlpovQGAoxC+KuT7psmdB5ORaHYLZeOozKZ55TSfzccgcGyGSL VTEMRaF4Wijd1iFSK32QKC6syGK3S3UoV1JRkZ4EGuovSev+W8+CxoIimgwmVec7Aq9O DJua6NL6YZcV3E+zUiVrtNeKhxp6vvuTcMxGypnK0PPceDtScUnrQeWqMH6fRgIhL/zH sDuIDJ3FCVePnIxivSDk3ULT6bEU7XZxKejFE5HtRsoXNB5rsgI9Wefsdk/SqDKFdn7i YPlQ== X-Gm-Message-State: AElRT7HrDG2kAWLmnNBZFdlFDS4SfIZxDbfaJ3wtZw73Oito+8xe3ka9 lYzyavMsH7nwLQRpK56LlR+GdWLX X-Google-Smtp-Source: AG47ELvkIGS2SqoUgDXPiWdU8pizYhUHokTtsivHdJuCHfsqvQzDRUDUcCNUgpo/WnWxqUGiYbBVig== X-Received: by 10.107.190.67 with SMTP id o64mr13791430iof.94.1520185456703; Sun, 04 Mar 2018 09:44:16 -0800 (PST) Received: from saturn.home.sansel.ca (CPE40167ea0e1c2-CM788df74daaa0.cpe.net.cable.rogers.com. [99.228.215.92]) by smtp.gmail.com with ESMTPSA id p10sm3415433itb.24.2018.03.04.09.44.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 09:44:15 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Sun, 4 Mar 2018 12:44:02 -0500 Message-Id: <1520185442-22901-1-git-send-email-selva.nair@gmail.com> X-Mailer: git-send-email 2.1.4 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 (selva.nair[at]gmail.com) 3.6 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL [99.228.215.92 listed in zen.spamhaus.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.7 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1esXgM-000pCw-Hz Subject: [Openvpn-devel] [PATCH] Do not assume that SSL_CTX_get/set_min/max_proto_version are macros X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] Do not assume that SSL_CTX_get/set_min/max_proto_version are macros
|
|
Commit Message
Selva Nair
March 4, 2018, 6:44 a.m. UTC
From: Selva Nair <selva.nair@gmail.com> Openssl docs do not explicitly state these to be macros although they are currently defined as such. Use AC_CHECK_DECLS to test for these so that both function and macro forms could be detected. Signed-off-by: Selva Nair <selva.nair@gmail.com> --- Though not meant as a fixup for libressl, as a side effect this also makes 2.4.5 build with newer libressl versions. (built on freebsd 11 using libressl 2.6.4 while testing patch 238) Notes: (i) libressl defines only the set functions and neither are macros. So get functions will get used from the compat layer. configure.ac | 12 ++++++++++++ src/openvpn/openssl_compat.h | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
Comments
Great, Thank You! ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
On Sun, Mar 04 2018, selva.nair@gmail.com wrote: > From: Selva Nair <selva.nair@gmail.com> > > Openssl docs do not explicitly state these to be macros although they > are currently defined as such. Actually they are documented as macros by OpenSSL since day 1, see NOTES. > Use AC_CHECK_DECLS to test for these so that > both function and macro forms could be detected. Looks like the right way to handle such a situation. Your diff looks good, and works for me against LibreSSL HEAD on OpenBSD-current: checking whether SSL_CTX_get_min_proto_version is declared... no checking whether SSL_CTX_get_max_proto_version is declared... no checking whether SSL_CTX_set_min_proto_version is declared... yes checking whether SSL_CTX_set_max_proto_version is declared... yes PASS: t_lpback.sh The following test will take about two minutes. If the addresses are in use, this test will retry up to two times. PASS: t_cltsrv.sh ==================== All 2 tests passed (1 test was not run) ==================== > Signed-off-by: Selva Nair <selva.nair@gmail.com> > --- > Though not meant as a fixup for libressl, as a side effect > this also makes 2.4.5 build with newer libressl versions. > (built on freebsd 11 using libressl 2.6.4 while testing patch 238) > Notes: (i) libressl defines only the set functions and neither > are macros. So get functions will get used from the compat layer. More notes, possibly relevant: - LibreSSL implement those as functions to provide better type checking. IIUC this is inspired by the same choice done in BoringSSL. - yesterday I added macros for compatibility in LibreSSL HEAD, see https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libssl/ssl.h This should land in LibreSSL 2.7.0. - adding the getters part is planned > configure.ac | 12 ++++++++++++ > src/openvpn/openssl_compat.h | 8 ++++---- > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 626b4dd..2a8e87f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -948,6 +948,18 @@ if test "${with_crypto_library}" = "openssl"; then > EC_GROUP_order_bits > ] > ) > + AC_CHECK_DECLS( > + [ > + SSL_CTX_get_min_proto_version, > + SSL_CTX_get_max_proto_version, > + SSL_CTX_set_min_proto_version, > + SSL_CTX_set_max_proto_version, > + ], > + , > + , > + [[#include <openssl/ssl.h>]] > + > + ) > > CFLAGS="${saved_CFLAGS}" > LIBS="${saved_LIBS}" > diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h > index d375fab..340d452 100644 > --- a/src/openvpn/openssl_compat.h > +++ b/src/openvpn/openssl_compat.h > @@ -661,7 +661,7 @@ EC_GROUP_order_bits(const EC_GROUP *group) > #define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT RSA_F_RSA_EAY_PRIVATE_ENCRYPT > #endif > > -#ifndef SSL_CTX_get_min_proto_version > +#if !HAVE_DECL_SSL_CTX_GET_MIN_PROTO_VERSION > /** Return the min SSL protocol version currently enabled in the context. > * If no valid version >= TLS1.0 is found, return 0. */ > static inline int > @@ -684,7 +684,7 @@ SSL_CTX_get_min_proto_version(SSL_CTX *ctx) > } > #endif /* SSL_CTX_get_min_proto_version */ > > -#ifndef SSL_CTX_get_max_proto_version > +#if !HAVE_DECL_SSL_CTX_GET_MAX_PROTO_VERSION > /** Return the max SSL protocol version currently enabled in the context. > * If no valid version >= TLS1.0 is found, return 0. */ > static inline int > @@ -707,7 +707,7 @@ SSL_CTX_get_max_proto_version(SSL_CTX *ctx) > } > #endif /* SSL_CTX_get_max_proto_version */ > > -#ifndef SSL_CTX_set_min_proto_version > +#if !HAVE_DECL_SSL_CTX_SET_MIN_PROTO_VERSION > /** Mimics SSL_CTX_set_min_proto_version for OpenSSL < 1.1 */ > static inline int > SSL_CTX_set_min_proto_version(SSL_CTX *ctx, long tls_ver_min) > @@ -736,7 +736,7 @@ SSL_CTX_set_min_proto_version(SSL_CTX *ctx, long tls_ver_min) > } > #endif /* SSL_CTX_set_min_proto_version */ > > -#ifndef SSL_CTX_set_max_proto_version > +#if !HAVE_DECL_SSL_CTX_SET_MAX_PROTO_VERSION > /** Mimics SSL_CTX_set_max_proto_version for OpenSSL < 1.1 */ > static inline int > SSL_CTX_set_max_proto_version(SSL_CTX *ctx, long tls_ver_max)
Hi, On Sun, Mar 4, 2018 at 1:48 PM, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote: > On Sun, Mar 04 2018, selva.nair@gmail.com wrote: >> From: Selva Nair <selva.nair@gmail.com> >> >> Openssl docs do not explicitly state these to be macros although they >> are currently defined as such. > > Actually they are documented as macros by OpenSSL since day 1, see > NOTES. You are right, I missed that in the docs. In that case my patch is not needed especially so if libressl will provide those macros. I'm still concerned about set and get functions coming from different sources and may be we should fix that by requiring that if set is defined we need get too. But that will once again break libressl compatibility. Selva ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
On Sun, Mar 04 2018, Selva Nair <selva.nair@gmail.com> wrote: > Hi, > > On Sun, Mar 4, 2018 at 1:48 PM, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote: >> On Sun, Mar 04 2018, selva.nair@gmail.com wrote: >>> From: Selva Nair <selva.nair@gmail.com> >>> >>> Openssl docs do not explicitly state these to be macros although they >>> are currently defined as such. >> >> Actually they are documented as macros by OpenSSL since day 1, see >> NOTES. > > You are right, I missed that in the docs. In that case my patch is not > needed especially so if libressl will provide those macros. It all depends if you want to support LibreSSL 2.6.x installations, as I'm not sure I'll be able to backport this in the 2.6 branch (which is supposed to receive security/reliability fixes only). > I'm still concerned about set and get functions coming from different > sources Indeed. A diff is floating to also add the getters to LibreSSL, hopefully this will make it in the upcoming 2.7.x release. > and may be we should fix that by requiring that if set is > defined we need get too. But that will once again break libressl > compatibility. From a mail I sent recently: --8<-- [...]. OpenSSL itself only provided said setters (since 2015)[2]. The getters were added to OpenSSL later (Sep 2017)[3]. [2] https://github.com/openssl/openssl/commit/7946ab33cecce60afcc00afc8fc18f31f9e66bff [3] https://github.com/openssl/openssl/commit/3edabd3ccb7aac89af5a63cfb2378e33a8be05d7 -->8-- IIUC there are OpenSSL 1.1.0 releases out there that provide only the setters, and that would also be affected by the requirement you propose. Github suggests that besides the master branch, the following tags have the setters[2]: OpenSSL_1_1_1-pre2 OpenSSL_1_1_1-pre1 OpenSSL_1_1_0 OpenSSL_1_1_0g OpenSSL_1_1_0f OpenSSL_1_1_0e OpenSSL_1_1_0d OpenSSL_1_1_0c OpenSSL_1_1_0b OpenSSL_1_1_0a OpenSSL_1_1_0-pre6 OpenSSL_1_1_0-pre5 OpenSSL_1_1_0-pre4 OpenSSL_1_1_0-pre3 OpenSSL_1_1_0-pre2 while support for getters[3] is only in: OpenSSL_1_1_1-pre2 OpenSSL_1_1_1-pre1
On 05-03-18 00:13, Jeremie Courreges-Anglas wrote: > On Sun, Mar 04 2018, Selva Nair <selva.nair@gmail.com> wrote: > --8<-- > [...]. OpenSSL itself only provided said setters (since 2015)[2]. The > getters were added to OpenSSL later (Sep 2017)[3]. > > [2] https://github.com/openssl/openssl/commit/7946ab33cecce60afcc00afc8fc18f31f9e66bff > [3] https://github.com/openssl/openssl/commit/3edabd3ccb7aac89af5a63cfb2378e33a8be05d7 > -->8-- > > IIUC there are OpenSSL 1.1.0 releases out there that provide only the > setters, and that would also be affected by the requirement you propose. > > Github suggests that besides the master branch, the following tags have > the setters[2]: > > OpenSSL_1_1_1-pre2 OpenSSL_1_1_1-pre1 OpenSSL_1_1_0 OpenSSL_1_1_0g > OpenSSL_1_1_0f OpenSSL_1_1_0e OpenSSL_1_1_0d OpenSSL_1_1_0c > OpenSSL_1_1_0b OpenSSL_1_1_0a OpenSSL_1_1_0-pre6 OpenSSL_1_1_0-pre5 > OpenSSL_1_1_0-pre4 OpenSSL_1_1_0-pre3 OpenSSL_1_1_0-pre2 > > while support for getters[3] is only in: > > OpenSSL_1_1_1-pre2 OpenSSL_1_1_1-pre1 That commit was cherry-picked to the OpenSSL_1_1_0-stable branch, and is available int 1.1.0g+: https://github.com/openssl/openssl/commit/af51a74ade8bbab5ed49a3560dcb70d89896dc29 But yeah, that's still something we might need to think about. -Steffan ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On Sun, Mar 4, 2018 at 6:22 PM, Steffan Karger <steffan@karger.me> wrote: > > On 05-03-18 00:13, Jeremie Courreges-Anglas wrote: >> On Sun, Mar 04 2018, Selva Nair <selva.nair@gmail.com> wrote: >> --8<-- >> [...]. OpenSSL itself only provided said setters (since 2015)[2]. The >> getters were added to OpenSSL later (Sep 2017)[3]. >> >> [2] https://github.com/openssl/openssl/commit/7946ab33cecce60afcc00afc8fc18f31f9e66bff >> [3] https://github.com/openssl/openssl/commit/3edabd3ccb7aac89af5a63cfb2378e33a8be05d7 >> -->8-- >> >> IIUC there are OpenSSL 1.1.0 releases out there that provide only the >> setters, and that would also be affected by the requirement you propose. >> >> Github suggests that besides the master branch, the following tags have >> the setters[2]: >> >> OpenSSL_1_1_1-pre2 OpenSSL_1_1_1-pre1 OpenSSL_1_1_0 OpenSSL_1_1_0g >> OpenSSL_1_1_0f OpenSSL_1_1_0e OpenSSL_1_1_0d OpenSSL_1_1_0c >> OpenSSL_1_1_0b OpenSSL_1_1_0a OpenSSL_1_1_0-pre6 OpenSSL_1_1_0-pre5 >> OpenSSL_1_1_0-pre4 OpenSSL_1_1_0-pre3 OpenSSL_1_1_0-pre2 >> >> while support for getters[3] is only in: >> >> OpenSSL_1_1_1-pre2 OpenSSL_1_1_1-pre1 > > That commit was cherry-picked to the OpenSSL_1_1_0-stable branch, and is > available int 1.1.0g+: > https://github.com/openssl/openssl/commit/af51a74ade8bbab5ed49a3560dcb70d89896dc29 > > But yeah, that's still something we might need to think about. Yes this is troubling. I had tested Windows build using 1.1.0g, but our release is built with 1.1.0f. So, for example, --tls-version-min 1.2 will not get read back as 1.2. Most likely it'll only lead to less than ideal UX in some corner cases (e.g. the error check min <= max in cryptoapi.c will not work as expected). Selva ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On Sun, Mar 04, 2018 at 12:44:02PM -0500, selva.nair@gmail.com wrote: > From: Selva Nair <selva.nair@gmail.com> > > Openssl docs do not explicitly state these to be macros although they > are currently defined as such. Use AC_CHECK_DECLS to test for these so that > both function and macro forms could be detected. > > Signed-off-by: Selva Nair <selva.nair@gmail.com> > --- > Though not meant as a fixup for libressl, as a side effect > this also makes 2.4.5 build with newer libressl versions. > (built on freebsd 11 using libressl 2.6.4 while testing patch 238) > Notes: (i) libressl defines only the set functions and neither > are macros. So get functions will get used from the compat layer. So, going through open patches in patchwork I came to this one. Reading through the thread, I'm not sure what the final outcome on the patch and the problem was? LibreSSL seems to be fixed (thanks, Jeremie :-) ) and if we build with OpenSSL 1.1.0g+, all is good? Phrased differently: does anything need to be done with this patch or should I click on "superceded" in patchwork now? gert
Hi, On Sun, Oct 7, 2018 at 3:38 AM Gert Doering <gert@greenie.muc.de> wrote: > Hi, > > On Sun, Mar 04, 2018 at 12:44:02PM -0500, selva.nair@gmail.com wrote: > > From: Selva Nair <selva.nair@gmail.com> > > > > Openssl docs do not explicitly state these to be macros although they > > are currently defined as such. Use AC_CHECK_DECLS to test for these so > that > > both function and macro forms could be detected. > > > > Signed-off-by: Selva Nair <selva.nair@gmail.com> > > --- > > Though not meant as a fixup for libressl, as a side effect > > this also makes 2.4.5 build with newer libressl versions. > > (built on freebsd 11 using libressl 2.6.4 while testing patch 238) > > Notes: (i) libressl defines only the set functions and neither > > are macros. So get functions will get used from the compat layer. > > So, going through open patches in patchwork I came to this one. > > Reading through the thread, I'm not sure what the final outcome on > the patch and the problem was? LibreSSL seems to be fixed (thanks, > Jeremie :-) ) and if we build with OpenSSL 1.1.0g+, all is good? > > Phrased differently: does anything need to be done with this patch or > should I click on "superceded" in patchwork now? > Agreed, if LibreSSL has got those macros defined now, we should just drop this patch. I'm marking these as superseded. Selva <div dir="ltr">Hi,<br><div><br><div class="gmail_quote"><div dir="ltr">On Sun, Oct 7, 2018 at 3:38 AM Gert <span class="" style="" id=":363.1" tabindex="-1">Doering</span> <<span class="" style="" id=":363.2" tabindex="-1">gert</span>@<span class="" style="" id=":363.3" tabindex="-1">greenie</span>.<span class="" style="" id=":363.4" tabindex="-1">muc</span>.<span class="" style="" id=":363.5" tabindex="-1">de</span>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br> <br> On Sun, Mar 04, 2018 at 12:44:02PM -0500, <a href="mailto:selva.nair@gmail.com" target="_blank">selva.nair@gmail.com</a> wrote:<br> > From: Selva Nair <<a href="mailto:selva.nair@gmail.com" target="_blank">selva.nair@gmail.com</a>><br> > <br> > Openssl docs do not explicitly state these to be macros although they<br> > are currently defined as such. Use AC_CHECK_DECLS to test for these so that<br> > both function and macro forms could be detected.<br> > <br> > Signed-off-by: Selva Nair <<a href="mailto:selva.nair@gmail.com" target="_blank">selva.nair@gmail.com</a>><br> > ---<br> > Though not meant as a fixup for libressl, as a side effect<br> > this also makes 2.4.5 build with newer libressl versions.<br> > (built on freebsd 11 using libressl 2.6.4 while testing patch 238)<br> > Notes: (i) libressl defines only the set functions and neither<br> > are macros. So get functions will get used from the compat layer.<br> <br> So, going through open patches in patchwork I came to this one.<br> <br> Reading through the thread, I'm not sure what the final outcome on<br> the patch and the problem was? LibreSSL seems to be fixed (thanks,<br> Jeremie :-) ) and if we build with OpenSSL 1.1.0g+, all is good?<br> <br> Phrased differently: does anything need to be done with this patch or<br> should I click on "superceded" in patchwork now?<br></blockquote><div><br></div><div>Agreed, if <span class="" style="" id=":363.6" tabindex="-1">LibreSSL</span> has got those macros defined now, we should just drop<br>this patch.<br></div><div> <br></div><div>I'm marking these as superseded.<br><br></div><div><span class="" style="" id=":363.7" tabindex="-1">Selva</span><br></div></div></div></div>
diff --git a/configure.ac b/configure.ac index 626b4dd..2a8e87f 100644 --- a/configure.ac +++ b/configure.ac @@ -948,6 +948,18 @@ if test "${with_crypto_library}" = "openssl"; then EC_GROUP_order_bits ] ) + AC_CHECK_DECLS( + [ + SSL_CTX_get_min_proto_version, + SSL_CTX_get_max_proto_version, + SSL_CTX_set_min_proto_version, + SSL_CTX_set_max_proto_version, + ], + , + , + [[#include <openssl/ssl.h>]] + + ) CFLAGS="${saved_CFLAGS}" LIBS="${saved_LIBS}" diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index d375fab..340d452 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -661,7 +661,7 @@ EC_GROUP_order_bits(const EC_GROUP *group) #define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT RSA_F_RSA_EAY_PRIVATE_ENCRYPT #endif -#ifndef SSL_CTX_get_min_proto_version +#if !HAVE_DECL_SSL_CTX_GET_MIN_PROTO_VERSION /** Return the min SSL protocol version currently enabled in the context. * If no valid version >= TLS1.0 is found, return 0. */ static inline int @@ -684,7 +684,7 @@ SSL_CTX_get_min_proto_version(SSL_CTX *ctx) } #endif /* SSL_CTX_get_min_proto_version */ -#ifndef SSL_CTX_get_max_proto_version +#if !HAVE_DECL_SSL_CTX_GET_MAX_PROTO_VERSION /** Return the max SSL protocol version currently enabled in the context. * If no valid version >= TLS1.0 is found, return 0. */ static inline int @@ -707,7 +707,7 @@ SSL_CTX_get_max_proto_version(SSL_CTX *ctx) } #endif /* SSL_CTX_get_max_proto_version */ -#ifndef SSL_CTX_set_min_proto_version +#if !HAVE_DECL_SSL_CTX_SET_MIN_PROTO_VERSION /** Mimics SSL_CTX_set_min_proto_version for OpenSSL < 1.1 */ static inline int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, long tls_ver_min) @@ -736,7 +736,7 @@ SSL_CTX_set_min_proto_version(SSL_CTX *ctx, long tls_ver_min) } #endif /* SSL_CTX_set_min_proto_version */ -#ifndef SSL_CTX_set_max_proto_version +#if !HAVE_DECL_SSL_CTX_SET_MAX_PROTO_VERSION /** Mimics SSL_CTX_set_max_proto_version for OpenSSL < 1.1 */ static inline int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, long tls_ver_max)