[Openvpn-devel,v7] ssl_openssl: Fix type of sslopts argument to SSL_CTX_set_options

Message ID 20250826184148.21534-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,v7] ssl_openssl: Fix type of sslopts argument to SSL_CTX_set_options | expand

Commit Message

Gert Doering Aug. 26, 2025, 6:41 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

The argument changed type in OpenSSL 3.0.

Change-Id: Ia5e0aad8a97d38f8d309a29ecfe3c578edff9595
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1101
This mail reflects revision 7 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>

Comments

Gert Doering Sept. 2, 2025, 6:28 p.m. UTC | #1
This is actually an interesting one - in OpenSSL 1.1.x, the "sslopt"
argument to SSL_CTX_set_options() is a "long", so back then, our code
had the correct data type.  With 3.0, this is now an "uint64_t", and
for master/2.7, this is the right thing to do - even if it will cause
some warnings on FreeBSD 13, for example, which still ships 1.1.1w

Your patch has been applied to the master branch.

commit 80c5cdef00fdef89738df1c17441f0bb987ccc97
Author: Frank Lichtenheld
Date:   Tue Aug 26 20:41:38 2025 +0200

     ssl_openssl: Fix type of sslopts argument to SSL_CTX_set_options

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Message-Id: <20250826184148.21534-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32690.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index 1948d12..aa1ac11 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -308,7 +308,7 @@ 
     ASSERT(NULL != ctx);
 
     /* process SSL options */
-    long sslopt = SSL_OP_SINGLE_DH_USE | SSL_OP_NO_TICKET;
+    uint64_t sslopt = SSL_OP_SINGLE_DH_USE | SSL_OP_NO_TICKET;
 #ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
     sslopt |= SSL_OP_CIPHER_SERVER_PREFERENCE;
 #endif