| Message ID | 20260322111131.8251-1-gert@greenie.muc.de |
|---|---|
| State | New |
| Headers | show |
| Series | [Openvpn-devel,v1] Use openssl_err_t typedef to deal with difference between TLS libraries | expand |
Looks reasonable, has ACK from Frank, and is so localized that it makes
sense to include this in 2.7 - "long term compatibility" things.
Lightly tested the 2.7 change on an linux/openssl build.
Your patch has been applied to the master and release/2.7 branch.
commit ee2af6655d1dae8b87d8128e2afeec4f5506d79b (master)
commit ca6c9a8886918ae85fe3295a920eace480aa3971 (release/2.7)
Author: Arne Schwabe
Date: Sun Mar 22 12:11:15 2026 +0100
Use openssl_err_t typedef to deal with difference between TLS libraries
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
Message-Id: <20260322111131.8251-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36242.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index 19cb9a9..9900d06 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -229,7 +229,7 @@ void crypto_print_openssl_errors(const unsigned int flags) { - unsigned long err = 0; + openssl_err_t err = 0; int line, errflags; const char *file, *data, *func; diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index ab011d3..8fdb39a 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -45,6 +45,15 @@ #include <openssl/x509.h> #include <openssl/err.h> +/* Define the type of error. This is something that is less + * intrusive than casts everywhere */ +#if defined(OPENSSL_IS_AWSLC) +typedef uint32_t openssl_err_t; +#else +typedef unsigned long openssl_err_t; +#endif + + /* Functionality missing in 1.1.0 */ #if OPENSSL_VERSION_NUMBER < 0x10101000L && !defined(ENABLE_CRYPTO_WOLFSSL) #define SSL_CTX_set1_groups SSL_CTX_set1_curves @@ -157,12 +166,12 @@ /* OpenSSL 1.1.1 and lower use only const EVP_MD, nothing to free */ } -static inline unsigned long +static inline openssl_err_t ERR_get_error_all(const char **file, int *line, const char **func, const char **data, int *flags) { static const char *empty = ""; *func = empty; - unsigned long err = ERR_get_error_line_data(file, line, data, flags); + openssl_err_t err = ERR_get_error_line_data(file, line, data, flags); return err; }