OpenSSL 3.0 improvements for OpenVPN
v2 cover OpenSSL 3.0 improvements for OpenVPN
This patchset removes almost all deprecation warnings from OpenVPN that related to OpenSSL 3.0. The patchset has already been tested with users and OpenSSL 3.0 as part of my OpenVPN for Android client.
Some patches also improve interaction with new features of OpenSSL 3.0, mainly with providers.
The patchset does not address using a provider to replace the RSA_method/EC_method. This is a separate patchset currently prepared by Selva.
Arne Schwabe (20):
[OSSL 3.0] Use new EVP_MAC API for HMAC implementation
[OSSL 3.0] Add --with-openssl-engine autoconf option (auto|yes|no) [OSSL 3.0] Implement DES ECB encrypt via EVP_CIPHER api
[OSSL 3.0] Remove DES check with OpenSSL 3.0
[OSSL 3.0] Use EVP_PKEY based API for loading DH keys
[OSSL 3.0] Deprecate --ecdh-curve with OpenSSL 3.0 and adjust mbed TLS message [OSSL 3.0] Remove DES key fixup code
[OSSL 3.0] Use EVP_PKEY_get_group_name to query group name Refactor early initialisation and uninitialisation into methods [OSSL 3.0] Replace EVP_get_cipherbyname with EVP_CIPHER_fetch [OSSL 3.0] USe EVP_MD_get0_name instead EV_MD_name
[OSSL 3.0] Allow loading of non default providers
[OSSL 3.0] Remove dependency on BF-CBC existance from test_ncp [OSSL 3.0] Use TYPE_do_all_provided function for listing cipher/digest [OSSL 3.0] Do not allow CTS ciphers
Add message when decoding PKCS12 file fails.
Add small unit test for testing HMAC
Fix error when BF-CBC is not available
Add insecure tls-cert-profile options
Add macos OpenSSL 3.0 and ASAN builds
.github/workflows/build.yaml | 28 ++- configure.ac | 68 ++++-- doc/man-sections/generic-options.rst | 10 + doc/man-sections/tls-options.rst | 6 + src/openvpn/crypto.c | 46 ---- src/openvpn/crypto.h | 2 - src/openvpn/crypto_backend.h | 18 +- src/openvpn/crypto_mbedtls.c | 34 +-- src/openvpn/crypto_openssl.c | 288 +++++++++++++++++++------ src/openvpn/crypto_openssl.h | 8 + src/openvpn/ntlm.c | 1 - src/openvpn/openssl_compat.h | 61 ++++++ src/openvpn/openvpn.c | 27 ++- src/openvpn/options.c | 7 + src/openvpn/options.h | 1 + src/openvpn/ssl.c | 18 -- src/openvpn/ssl_mbedtls.c | 8 +- src/openvpn/ssl_openssl.c | 57 +++-- tests/unit_tests/openvpn/test_crypto.c | 61 +++++- tests/unit_tests/openvpn/test_ncp.c | 13 +- 20 files changed, 540 insertions(+), 222 deletions(-)
Signature · 1 line
2.33.0
PATCH v2 1/20 Use new EVP_MAC API for HMAC implementation
The old API is deprecated in OpenSSL 3.0 and the new API does not yet exist in OpenSSL 1.1. Emulating the new API would be more complex than just having two implementations. So this switches to a new hmac implementation for OpenSSL 3.0.
Unfortunately the new API does not have an easy to reset an HMAC, so we need to keep the key around to emulate a reset functionality.
--- src/openvpn/crypto_backend.h | 2 +- src/openvpn/crypto_mbedtls.c | 2 +- src/openvpn/crypto_openssl.c | 96 +++++++++++++++++++++++++++++++++++- src/openvpn/crypto_openssl.h | 8 +++ 4 files changed, 104 insertions(+), 4 deletions(-)
src/openvpn/crypto_backend.h +1 -1
@@ -643,7 +643,7 @@ void hmac_ctx_cleanup(hmac_ctx_t *ctx);* * @return Size of the HMAC, or \0 if ctx is NULL. */ -int hmac_ctx_size (const hmac_ctx_t *ctx); +int hmac_ctx_size (hmac_ctx_t *ctx);/* * Resets the given HMAC context, preserving the associated key information
src/openvpn/crypto_mbedtls.c +1 -1
@@ -939,7 +939,7 @@ hmac_ctx_cleanup(mbedtls_md_context_t *ctx) }int -hmac_ctx_size (const mbedtls_md_context_t *ctx) +hmac_ctx_size (mbedtls_md_context_t *ctx) {if (NULL == ctx) {
src/openvpn/crypto_openssl.c +94 -2
114 lines not on this page · raw message
src/openvpn/crypto_openssl.h +8 -0
@@ -47,7 +47,15 @@ typedef EVP_CIPHER_CTX cipher_ctx_t;typedef EVP_MD_CTX md_ctx_t ;/** Generic HMAC %context. */ +#if OPENSSL_VERSION_NUMBER <0x30000000L typedef HMAC_CTX hmac_ctx_t ; +#else +typedef struct { +OSSL_PARAM params[3 ]; +uint8_t key[EVP_MAX_KEY_LENGTH ]; +EVP_MAC_CTX *ctx; +}hmac_ctx_t ; +#endif /** Maximum length of an IV */ #define OPENVPN_MAX_IV_LENGTH EVP_MAX_IV_LENGTH
Signature · 1 line
2.33.0
PATCH v2 2/20 Add --with-openssl-engine autoconf option (auto|yes|no)
In reply to Arne SchwabeThis allows to select engine support at configure time. For OpenSSL 1.1 the default is not changed and we detect if engine support is available.
Engine support is deprecated in OpenSSL 3.0 and for OpenSSL 3.0 the default is to disable engine support as engine support is deprecated and generates compiler warnings which in turn also break -Werror.
By using --with-openssl-engine=no or --with-openssl-engine=yes engine support can be forced on or off. If it is enabled but not detected an error will be thown.
This commit cleans up the configurelogic a bit and removes the ENGINE_cleanup checks as we can just assume that it will be also available as macro or function if the other engine functions are available. Before the cleanup we would only check for the existance of engine.h if ENGINE_cleanup was not found.
--- configure.ac | 68 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 17 deletions(-)
configure.ac +51 -17
@@ -267,6 +267,18 @@ AC_ARG_ENABLE( [enable_wolfssl_options_h="yes"] ) +AC_ARG_WITH( + [openssl-engine], + [AS_HELP_STRING([--with-openssl-engine], [enable engine support with OpenSSL. Default enabled for OpenSSL < 3.0, auto,yes,no @<:@default=auto@:>@])], + [ + case "${withval}" in + auto|yes|no) ;; + *) AC_MSG_ERROR([bad value ${withval} for --with-engine]) ;; + esac + ], + [with_openssl_engine="auto"] +) + AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@]) if test -n "${PLUGINDIR}"; then plugindir="${PLUGINDIR}"
@@ -800,23 +812,45 @@ if test "${with_crypto_library}" = "openssl"; then [AC_MSG_ERROR([openssl check failed])] ) - have_openssl_engine="yes" - AC_CHECK_FUNCS( - [ \ - ENGINE_load_builtin_engines \ - ENGINE_register_all_complete \ - ENGINE_cleanup \ - ], - , - [have_openssl_engine="no"; break] - ) - if test "${have_openssl_engine}" = "no"; then - AC_CHECK_DECL( [ENGINE_cleanup], [have_openssl_engine="yes"],, - [[ - #include <openssl/engine.h> - ]] - ) - fi + if test "${with_openssl_engine}" = "auto"; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include <openssl/opensslv.h> + ]], + [[ + /* Version encoding: MNNFFPPS - see opensslv.h for details */ + #if OPENSSL_VERSION_NUMBER >= 0x30000000L + #error Engine supported disabled by default in OpenSSL 3.0+ + #endif + ]] + )], + [have_openssl_engine="yes"], + [have_openssl_engine="no"] + ) + if test "${have_openssl_engine}" = "yes"; then + AC_CHECK_FUNCS( + [ \ + ENGINE_load_builtin_engines \ + ENGINE_register_all_complete \ + ], + , + [have_openssl_engine="no"; break] + ) + fi + else + have_openssl_engine="${with_openssl_engine}" + if test "${have_openssl_engine}" = "yes"; then + AC_CHECK_FUNCS( + [ \ + ENGINE_load_builtin_engines \ + ENGINE_register_all_complete \ + ], + , + [AC_MSG_ERROR([OpenSSL engine support not found])] + ) + fi + fi if test "${have_openssl_engine}" = "yes"; then AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [OpenSSL engine support available]) fi
Signature · 1 line
2.33.0
PATCH v2 2/16 Disable engine support for OpenSSL 3.0
In reply to Arne SchwabeEngine support is deprecated in OpenSSL 3.0. No longer use the deprecated API when running with OpenSSL 3.0
--- configure.ac | 2 ++ src/openvpn/crypto_openssl.c | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-)
configure.ac +2 -0
@@ -813,7 +813,9 @@ if test "${with_crypto_library}" = "openssl"; then if test "${have_openssl_engine}" = "no"; then AC_CHECK_DECL( [ENGINE_cleanup], [have_openssl_engine="yes"],, [[ + #if OPENSSL_VERSION_NUMBER < 0x30000000L #include <openssl/engine.h> + #endif ]] ) fi
src/openvpn/crypto_openssl.c +7 -6
@@ -67,7 +67,7 @@#warning Some OpenSSL HMAC message digests now support key lengths greater than MAX_HMAC_KEY_LENGTH -- consider increasing MAX_HMAC_KEY_LENGTH#endif -#if HAVE_OPENSSL_ENGINE +#if HAVE_OPENSSL_ENGINE &&OPENSSL_VERSION_NUMBER <0x30000000L #include <openssl/ui.h> #include <openssl/engine.h>
@@ -132,7 +132,7 @@ setup_engine(const char *engine)void crypto_init_lib_engine (const char *engine_name) { -#if HAVE_OPENSSL_ENGINE +#if HAVE_OPENSSL_ENGINE &&OPENSSL_VERSION_NUMBER <0x30000000L if (!engine_initialized) {ASSERT (engine_name);
@@ -182,7 +182,7 @@ crypto_uninit_lib(void)fclose (fp);#endif -#if HAVE_OPENSSL_ENGINE +#if HAVE_OPENSSL_ENGINE &&OPENSSL_VERSION_NUMBER <0x30000000L if (engine_initialized) {ENGINE_cleanup ();
@@ -368,7 +368,8 @@ show_available_digests(void)void show_available_engines (void ) { -#if HAVE_OPENSSL_ENGINE /* Only defined for OpenSSL */ +#if HAVE_OPENSSL_ENGINE &&OPENSSL_VERSION_NUMBER <0x30000000L +/* Only defined for OpenSSL */ ENGINE *e;printf ("OpenSSL Crypto Engines\n\n" );
@@ -1165,7 +1166,7 @@ memcmp_constant_time(const void *a, const void *b, size_t size)return CRYPTO_memcmp (a, b, size); } -#if HAVE_OPENSSL_ENGINE +#if HAVE_OPENSSL_ENGINE &&OPENSSL_VERSION_NUMBER <0x30000000L static int ui_reader (UI *ui,UI_STRING *uis) {
@@ -1189,7 +1190,7 @@ ui_reader(UI *ui, UI_STRING *uis)EVP_PKEY *engine_load_key (const char *file,SSL_CTX *ctx) { -#if HAVE_OPENSSL_ENGINE +#if HAVE_OPENSSL_ENGINE &&OPENSSL_VERSION_NUMBER <0x30000000L UI_METHOD *ui;EVP_PKEY *pkey;
Signature · 1 line
2.33.0
PATCH v2 3/20 Implement DES ECB encrypt via EVP_CIPHER api
In reply to Arne SchwabeEven though DES is super outdated and also NTLM is super outdated, eliminating the warnings for OpenSSL 3.0 is still a step in the right direction and using the correct APIs.
--- src/openvpn/crypto_openssl.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
src/openvpn/crypto_openssl.c +19 -3
@@ -879,10 +879,26 @@ cipher_des_encrypt_ecb(const unsigned char key[DES_KEY_LENGTH], unsigned char src[DES_KEY_LENGTH], unsigned char dst[DES_KEY_LENGTH]) { -DES_key_schedule sched; +EVP_CIPHER_CTX *ctx =EVP_CIPHER_CTX_new (); +if (!ctx) + { +crypto_msg (M_FATAL ,"%s: EVP_CIPHER_CTX_new() failed" , __func__); + } +if (!EVP_EncryptInit_ex (ctx,EVP_bf_ecb (),NULL , key,0 )) + { +crypto_msg (M_FATAL ,"%s: EVP_EncryptInit_ex() failed" , __func__); + } -DES_set_key_unchecked ((DES_cblock *)key, &sched); -DES_ecb_encrypt ((DES_cblock *)src, (DES_cblock *)dst, &sched,DES_ENCRYPT ); +int len; +if (!EVP_EncryptUpdate (ctx, dst, &len, src,DES_KEY_LENGTH )) + { +crypto_msg (M_FATAL ,"%s: EVP_EncryptUpdate() failed" , __func__); + } + +if (!EVP_EncryptFinal (ctx, dst + len, &len)) + { +crypto_msg (M_FATAL ,"%s: EVP_EncryptFinal() failed" , __func__); + } }/*
Signature · 1 line
2.33.0
PATCH v2 4/20 Remove DES check with OpenSSL 3.0
In reply to Arne SchwabeDES is very deprecated and accidently getting on the of the 16 insecure keys that OpenSSL checks is extremely unlikely so we no longer use the deprecated functions without replacement in OpenSSL 3.0.
--- src/openvpn/crypto_openssl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
src/openvpn/crypto_openssl.c +8 -0
@@ -521,6 +521,11 @@ key_des_num_cblocks(const EVP_CIPHER *kt)bool key_des_check (uint8_t *key,int key_len,int ndc) { +#if OPENSSL_VERSION_NUMBER <0x30000000L +/* DES is deprecated and the method to even check the keys is deprecated +* in OpenSSL 3.0. Instead of checking for the 16 weak/semi-weak keys +* we just accept them in OpenSSL 3.0 since the risk of randomly getting +* these is pretty weak */ int i;struct buffer b;
@@ -553,6 +558,9 @@ key_des_check(uint8_t *key, int key_len, int ndc) err:ERR_clear_error ();return false; +#else +return true; +#endif }void
Signature · 1 line
2.33.0
PATCH v2 5/20 Use EVP_PKEY based API for loading DH keys
In reply to Arne SchwabeOpenSSL 3.0 replaces the DH API with a generic EVP_KEY based API to load DH parameters.
--- src/openvpn/ssl_openssl.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
src/openvpn/ssl_openssl.c +21 -2
@@ -649,7 +649,6 @@ void tls_ctx_load_dh_params(struct tls_root_ctx *ctx, const char *dh_file, bool dh_file_inline) { - DH *dh; BIO *bio;ASSERT (NULL != ctx);
@@ -670,7 +669,26 @@ tls_ctx_load_dh_params(struct tls_root_ctx *ctx, const char *dh_file, } } - dh =PEM_read_bio_DHparams (bio,NULL ,NULL ,NULL ); +#if OPENSSL_VERSION_NUMBER >=0x30000000L +EVP_PKEY *dh =PEM_read_bio_Parameters (bio,NULL ); +BIO_free (bio); + +if (!dh) + { +crypto_msg (M_FATAL ,"Cannot load DH parameters from %s" , +print_key_filename (dh_file, dh_file_inline)); + } +if (!SSL_CTX_set0_tmp_dh_pkey (ctx->ctx, dh)) + { +crypto_msg (M_FATAL ,"SSL_CTX_set_tmp_dh" ); + } + +msg (D_TLS_DEBUG_LOW ,"Diffie-Hellman initialized with %d bit key" , +8 *EVP_PKEY_get_size (dh)); + +EVP_PKEY_free (dh); +#else +DH *dh =PEM_read_bio_DHparams (bio,NULL ,NULL ,NULL );BIO_free (bio);if (!dh)
@@ -687,6 +705,7 @@ tls_ctx_load_dh_params(struct tls_root_ctx *ctx, const char *dh_file, 8 * DH_size(dh));DH_free (dh); +#endif }void
Signature · 1 line
2.33.0
PATCH v2 6/20 Deprecate --ecdh-curve with OpenSSL 3.0 and adjust mbed TLS message
In reply to Arne SchwabeOpenSSL 3.0 deprecates SSL_CTX_set_tmp_ecdh() in favour of SSL_CTX_set1_groups(3). We already support the SSL_CTX_set1_groups using the --tls-groups. Adjust both mbed TLS and OpenSSL 3.0 to say that --ecdh-curve is ingored and --tls-groups should be used.
--- src/openvpn/ssl_mbedtls.c | 5 +++-- src/openvpn/ssl_openssl.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-)
src/openvpn/ssl_mbedtls.c +3 -2
@@ -440,8 +440,9 @@ tls_ctx_load_ecdh_params(struct tls_root_ctx *ctx, const char *curve_name {if (NULL != curve_name) { -msg (M_WARN ,"WARNING: mbed TLS builds do not support specifying an ECDH " -"curve, using default curves." ); +msg (M_WARN ,"WARNING: mbed TLS builds do not support specifying an " +"ECDH curve with --ecdh-curve, using default curves. Use " +"--tls-groups to specify curves." ); } }
src/openvpn/ssl_openssl.c +9 -3
@@ -709,10 +709,16 @@ tls_ctx_load_dh_params(struct tls_root_ctx *ctx, const char *dh_file, }void -tls_ctx_load_ecdh_params (struct tls_root_ctx *ctx,const char *curve_name - ) +tls_ctx_load_ecdh_params (struct tls_root_ctx *ctx,const char *curve_name) { -#ifndef OPENSSL_NO_EC +#if OPENSSL_VERSION_NUMBER >=0x30000000L +if (curve_name !=NULL ) + { +msg (M_WARN ,"WARNING: OpenSSL 3.0+ builds do not support specifying an " +"ECDH curve with --ecdh-curve, using default curves. Use " +"--tls-groups to specify groups." ); + } +#elif !defined(OPENSSL_NO_EC )int nid = NID_undef;EC_KEY *ecdh =NULL ;const char *sname =NULL ;
Signature · 1 line
2.33.0
PATCH v2 7/20 Remove DES key fixup code
In reply to Arne SchwabeThis code mainly sets the parity bits in the DES keys. As mbed TLS and OpenSSL already ignore these bits in the DES key and since DES is deprecated, remove this special DES code that is not even needed by the libraries.
--- src/openvpn/crypto.c | 46 ------------------------------------ src/openvpn/crypto.h | 2 -- src/openvpn/crypto_backend.h | 9 ------- src/openvpn/crypto_mbedtls.c | 24 ------------------- src/openvpn/crypto_openssl.c | 27 --------------------- src/openvpn/ntlm.c | 1 - src/openvpn/ssl.c | 18 -------------- 7 files changed, 127 deletions(-)
src/openvpn/crypto.c +0 -46
@@ -956,45 +956,6 @@ check_key(struct key *key, const struct key_type *kt)return true; } -/* -* Make safe mutations to key to ensure it is valid, -* such as ensuring correct parity on DES keys. -* -* This routine cannot guarantee it will generate a good -* key. You must always call check_key after this routine -* to make sure. -*/ -void -fixup_key (struct key *key,const struct key_type *kt) -{ -struct gc_arena gc =gc_new (); -if (kt->cipher) - { -#ifdef ENABLE_DEBUG -const struct key orig = *key; -#endif -const int ndc =key_des_num_cblocks (kt->cipher); - -if (ndc) - { -key_des_fixup (key->cipher, kt->cipher_length, ndc); - } - -#ifdef ENABLE_DEBUG -if (check_debug_level (D_CRYPTO_DEBUG )) - { -if (memcmp (orig.cipher, key->cipher, kt->cipher_length)) - { -dmsg (D_CRYPTO_DEBUG ,"CRYPTO INFO: fixup_key: before=%s after=%s" , -format_hex (orig.cipher, kt->cipher_length,0 , &gc), -format_hex (key->cipher, kt->cipher_length,0 , &gc)); - } - } -#endif - } -gc_free (&gc); -} -void check_replay_consistency (const struct key_type *kt,bool packet_id) {
@@ -1043,10 +1004,6 @@ generate_key_random(struct key *key, const struct key_type *kt)dmsg (D_SHOW_KEY_SOURCE ,"Cipher source entropy: %s" ,format_hex (key->cipher, cipher_len,0 , &gc));dmsg (D_SHOW_KEY_SOURCE ,"HMAC source entropy: %s" ,format_hex (key->hmac, hmac_len,0 , &gc)); -if (kt) - { -fixup_key (key, kt); - } }while (kt && !check_key (key, kt));gc_free (&gc);
@@ -1589,9 +1546,6 @@ verify_fix_key2(struct key2 *key2, const struct key_type *kt, const char *sharedfor (i =0 ; i < key2->n; ++i) { -/* Fix parity for DES keys and make sure not a weak key */ -fixup_key (&key2->keys[i], kt); -/* This should be a very improbable failure */ if (!check_key (&key2->keys[i], kt)) {
src/openvpn/crypto.h +0 -2
@@ -288,8 +288,6 @@ void check_replay_consistency(const struct key_type *kt, bool packet_id);bool check_key (struct key *key,const struct key_type *kt); -void fixup_key (struct key *key,const struct key_type *kt); -bool write_key (const struct key *key,const struct key_type *kt,struct buffer *buf);
src/openvpn/crypto_backend.h +0 -9
@@ -170,15 +170,6 @@ int key_des_num_cblocks(const cipher_kt_t *kt);*/ bool key_des_check (uint8_t *key,int key_len,int ndc); -/* -* Fix the given DES key, setting its parity to odd. -* -* @param key Key to check -* @param key_len Length of the key, in bytes -* @param ndc Number of DES cblocks that the key is made up of. -*/ -void key_des_fixup (uint8_t *key,int key_len,int ndc); -/** * Encrypt the given block, using DES ECB mode *
src/openvpn/crypto_mbedtls.c +0 -24
@@ -422,11 +422,6 @@ key_des_check(uint8_t *key, int key_len, int ndc)msg (D_CRYPT_ERRORS ,"CRYPTO INFO: check_key_DES: weak key detected" ); goto err; } -if (0 !=mbedtls_des_key_check_key_parity (key)) - { -msg (D_CRYPT_ERRORS ,"CRYPTO INFO: check_key_DES: bad parity detected" ); - goto err; - } }return true;
@@ -434,25 +429,6 @@ err:return false; } -void -key_des_fixup (uint8_t *key,int key_len,int ndc) -{ -int i; -struct buffer b; - -buf_set_read (&b, key, key_len); -for (i =0 ; i < ndc; ++i) - { -unsigned char *key =buf_read_alloc (&b,MBEDTLS_DES_KEY_SIZE ); -if (!key) - { -msg (D_CRYPT_ERRORS ,"CRYPTO INFO: fixup_key_DES: insufficient key material" ); -return ; - } -mbedtls_des_key_set_parity (key); - } -} -/* * * Generic cipher key type functions
src/openvpn/crypto_openssl.c +0 -27
@@ -546,12 +546,6 @@ key_des_check(uint8_t *key, int key_len, int ndc) "CRYPTO INFO: check_key_DES: weak key detected"); goto err; } -if (!DES_check_key_parity (dc)) - { -crypto_msg (D_CRYPT_ERRORS , -"CRYPTO INFO: check_key_DES: bad parity detected" ); - goto err; - } }return true;
@@ -563,27 +557,6 @@ err:#endif } -void -key_des_fixup (uint8_t *key,int key_len,int ndc) -{ -int i; -struct buffer b; - -buf_set_read (&b, key, key_len); -for (i =0 ; i < ndc; ++i) - { -DES_cblock *dc = (DES_cblock *)buf_read_alloc (&b,sizeof (DES_cblock)); -if (!dc) - { -msg (D_CRYPT_ERRORS ,"CRYPTO INFO: fixup_key_DES: insufficient key material" ); -ERR_clear_error (); -return ; - } -DES_set_odd_parity (dc); - } -} - -/* * * Generic cipher key type functions
src/openvpn/ntlm.c +0 -1
@@ -67,7 +67,6 @@ create_des_keys(const unsigned char *hash, unsigned char *key) key[5 ] = ((hash[4 ] &31 ) <<3 ) | (hash[5 ] >>5 ); key[6 ] = ((hash[5 ] &63 ) <<2 ) | (hash[6 ] >>6 ); key[7 ] = ((hash[6 ] &127 ) <<1 ); -key_des_fixup (key,8 ,1 ); } static void
src/openvpn/ssl.c +0 -18
@@ -1739,24 +1739,6 @@ generate_key_expansion_openvpn_prf(const struct tls_session *session, struct key }secure_memzero (&master,sizeof (master)); - - -/* -* fixup_key only correctly sets DES parity bits if the cipher is a -* DES variant. -* -* The newer OpenSSL and mbed TLS libraries (those that support EKM) -* ignore these bits. -* -* We keep the DES fixup here as compatibility. -* OpenVPN3 never did this fixup anyway. So this code is *probably* not -* required but we keep it for compatibility until we remove DES support -* since it does not hurt either. -*/ -for (int i =0 ; i <2 ; ++i) - { -fixup_key (&key2->keys[i], &session->opt->key_type); - } key2->n =2 ;return true;
Signature · 1 line
2.33.0
PATCH v2 8/20 Use EVP_PKEY_get_group_name to query group name
In reply to Arne SchwabeEC_Key methods are deprecated in OpenSSL 3.0. Use EVP_PKEY_get_group_name instead to query the EC group name from an EVP_PKEY and add a compatibility function for older OpenSSL versions.
--- src/openvpn/openssl_compat.h | 42 ++++++++++++++++++++++++++++++++++++ src/openvpn/ssl_openssl.c | 14 ++++++------ 2 files changed, 50 insertions(+), 6 deletions(-)
src/openvpn/openssl_compat.h +42 -0
@@ -718,4 +718,46 @@ SSL_CTX_set_max_proto_version(SSL_CTX *ctx, long tls_ver_max)return 1 ; }#endif /* if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(ENABLE_CRYPTO_WOLFSSL) */ + +/* Functionality missing in 1.1.1 */ +#if OPENSSL_VERSION_NUMBER <0x30000000L && !defined(OPENSSL_NO_EC ) + +/* Note that this is not a perfect emulation of the new function but +* is good enough for our case of printing certificate details during +* handshake */ +static inline +int EVP_PKEY_get_group_name (EVP_PKEY *pkey,char *gname,size_t gname_sz, +size_t *gname_len) +{ +const EC_KEY * ec =EVP_PKEY_get0_EC_KEY (pkey); +if (ec ==NULL ) + { +return 0 ; + } +const EC_GROUP * group =EC_KEY_get0_group (ec); +int nid =EC_GROUP_get_curve_name (group); + +if (nid ==0 ) + { +return 0 ; + } +const char *curve =OBJ_nid2sn (nid); + +strncpynt (gname, curve, gname_sz); + *gname_len =min_int (strlen (curve), gname_sz); +return 1 ; +} +#endif + +/** Mimics SSL_CTX_new_ex for OpenSSL < 3 */ +#if OPENSSL_VERSION_NUMBER <0x30000000L +static inline SSL_CTX * +SSL_CTX_new_ex (void *libctx,const char *propq,const SSL_METHOD *method) +{ + (void ) libctx; + (void ) propq; +return SSL_CTX_new (method); +} +#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -6
@@ -2053,13 +2053,15 @@ print_cert_details(X509 *cert, char *buf, size_t buflen)int typeid =EVP_PKEY_id (pkey);#ifndef OPENSSL_NO_EC -if (typeid ==EVP_PKEY_EC &&EVP_PKEY_get0_EC_KEY (pkey) !=NULL ) +char groupname[256 ]; +if (typeid ==EVP_PKEY_EC ) { -const EC_KEY *ec =EVP_PKEY_get0_EC_KEY (pkey); -const EC_GROUP *group =EC_KEY_get0_group (ec); - -int nid =EC_GROUP_get_curve_name (group); -if (nid ==0 || (curve =OBJ_nid2sn (nid)) ==NULL ) +size_t len; +if (EVP_PKEY_get_group_name (pkey, groupname,sizeof (groupname), &len)) + { + curve = groupname; + } +else { curve ="(error getting curve name)" ; }
Signature · 1 line
2.33.0
PATCH v2 9/20 Refactor early initialisation and uninitialisation into methods
In reply to Arne SchwabeThis put the early initialisation and uninitialisation that needs to happen between option parsing and post processing into small methods.
--- src/openvpn/openvpn.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
src/openvpn/openvpn.c +18 -5
@@ -105,6 +105,20 @@ tunnel_point_to_point(struct context *c)#undef PROCESS_SIGNAL_P2P +void init_early (struct context *c) +{ +net_ctx_init (c, &(*c).net_ctx); + +/* init verbosity and mute levels */ +init_verb_mute (c,IVM_LEVEL_1 ); + +} + +static void uninit_early (struct context *c) +{ +net_ctx_free (&(*c).net_ctx); +} +/**************************************************************************/ /**
@@ -193,10 +207,9 @@ openvpn_main(int argc, char *argv[])open_plugins (&c, true,OPENVPN_PLUGIN_INIT_PRE_CONFIG_PARSE );#endif -net_ctx_init (&c, &c.net_ctx); - -/* init verbosity and mute levels */ -init_verb_mute (&c,IVM_LEVEL_1 ); +/* Early initialisation that need to happen before option +* post processing and other early startup but after parsing */ +init_early (&c);/* set dev options */ init_options_dev (&c.options);
@@ -308,7 +321,7 @@ openvpn_main(int argc, char *argv[])env_set_destroy (c.es);uninit_options (&c.options);gc_reset (&c.gc); -net_ctx_free (&c.net_ctx); +uninit_early (&c); }while (c.sig->signal_received ==SIGHUP ); }
Signature · 1 line
2.33.0
PATCH v2 10/20 Replace EVP_get_cipherbyname with EVP_CIPHER_fetch
In reply to Arne SchwabeIn OpenSSL 3.0 EVP_get_cipherbyname return a non NULL algorithm even if the algorithm is not avaialble with the currently available provider. Luckily EVP_get_cipherbyname can be used here as drop in replacement and returns only non NULL if the algorithm is actually currently supported.
--- src/openvpn/crypto_openssl.c | 6 +++--- src/openvpn/openssl_compat.h | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-)
src/openvpn/crypto_openssl.c +3 -3
@@ -572,7 +572,7 @@ cipher_kt_get(const char *ciphername)ASSERT (ciphername); ciphername =translate_cipher_name_from_openvpn (ciphername); - cipher =EVP_get_cipherbyname (ciphername); + cipher =EVP_CIPHER_fetch (NULL , ciphername,NULL );if (NULL == cipher) {
@@ -658,7 +658,7 @@ cipher_kt_block_size(const EVP_CIPHER *cipher)strcpy (mode_str,"-CBC" ); - cbc_cipher =EVP_get_cipherbyname (translate_cipher_name_from_openvpn (name)); + cbc_cipher =EVP_CIPHER_fetch (NULL ,translate_cipher_name_from_openvpn (name),NULL );if (cbc_cipher) { block_size =EVP_CIPHER_block_size (cbc_cipher);
@@ -894,7 +894,7 @@ md_kt_get(const char *digest) {const EVP_MD *md =NULL ;ASSERT (digest); - md =EVP_get_digestbyname (digest); + md =EVP_MD_fetch (NULL , digest,NULL );if (!md) {crypto_msg (M_FATAL ,"Message hash algorithm '%s' not found" , digest);
src/openvpn/openssl_compat.h +17 -0
@@ -758,6 +758,23 @@ SSL_CTX_new_ex(void *libctx, const char *propq, const SSL_METHOD *method) (void ) propq;return SSL_CTX_new (method); } +/* Mimics the functions but only when the default context without +* options is chosen */ +static inline const EVP_CIPHER * +EVP_CIPHER_fetch (void *ctx,const char *algorithm,const char *properties) +{ +ASSERT (!ctx); +ASSERT (!properties); +return EVP_get_cipherbyname (algorithm); +} + +static inline const EVP_MD * +EVP_MD_fetch (void *ctx,const char *algorithm,const char *properties) +{ +ASSERT (!ctx); +ASSERT (!properties); +return EVP_get_digestbyname (algorithm); +}#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ #endif /* OPENSSL_COMPAT_H_ */
Signature · 1 line
2.33.0
PATCH v2 11/16 Allow loading of non default providers
In reply to Arne SchwabeThis allows OpenVPN to load non-default providers. This is mainly useful for loading the legacy provider with --provider legacy:default
--- doc/man-sections/generic-options.rst | 10 ++++++++++ src/openvpn/crypto_backend.h | 7 +++++++ src/openvpn/crypto_mbedtls.c | 8 ++++++++ src/openvpn/crypto_openssl.c | 29 ++++++++++++++++++++++++++++ src/openvpn/openvpn.c | 4 ++++ src/openvpn/options.c | 4 ++++ src/openvpn/options.h | 1 + 7 files changed, 63 insertions(+)
doc/man-sections/generic-options.rst +10 -0
@@ -280,6 +280,16 @@ which mode OpenVPN is configured as. This option solves the problem by persisting keys across :code:`SIGUSR1` resets, so they don't need to be re-read. +--provider providers + Load the : separated list of (OpenSSL) providers. This is mainly useful for + using an external provider for key management like tpm2-openssl or to load + the legacy provider with + + :: + + --provider "legacy:default" + + --remap-usr1 signal Control whether internally or externally generated :code:`SIGUSR1` signals are remapped to :code:`SIGHUP` (restart without persisting state) or
src/openvpn/crypto_backend.h +7 -0
@@ -78,6 +78,13 @@ void crypto_clear_error(void);*/ void crypto_init_lib_engine (const char *engine_name); + +/** +* Load the given (OpenSSL) providers +* @param providers list of providers to load, seperated by : +*/ +void crypto_init_lib_provider (const char *providers); +#ifdef DMALLOC /* * OpenSSL memory debugging. If dmalloc debugging is enabled, tell
src/openvpn/crypto_mbedtls.c +8 -0
@@ -70,6 +70,14 @@ crypto_init_lib_engine(const char *engine_name) "available"); } +void crypto_init_lib_provider (const char *providers) +{ +if (providers) + { +msg (M_WARN ,"Note: mbed TLS provider functionality is not available" ); + } +} +/* * * Functions related to the core crypto library
src/openvpn/crypto_openssl.c +29 -0
@@ -54,6 +54,9 @@#if (OPENSSL_VERSION_NUMBER >=0x10100000L ) && !defined(LIBRESSL_VERSION_NUMBER )#include <openssl/kdf.h> #endif +#if OPENSSL_VERSION_NUMBER >=0x30000000L +#include <openssl/provider.h> +#endif /* * Check for key size creepage.
@@ -145,6 +148,32 @@ crypto_init_lib_engine(const char *engine_name)#endif } +void +crypto_init_lib_provider (const char *providers) +{ +if (!providers) + { +return ; + } +#if OPENSSL_VERSION_NUMBER >=0x30000000L +struct gc_arena gc =gc_new (); +char *tmp_providers =string_alloc (providers, &gc); + +const char *provname; +while ((provname =strsep (&tmp_providers,":" ))) + { +/* Load providers into the default (NULL) library context */ +OSSL_PROVIDER * provider =OSSL_PROVIDER_load (NULL , provname); +if (!provider) + { +crypto_msg (M_FATAL ,"failed to load provider '%s'" , provname); + } + } +#else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */ +msg (M_WARN ,"Note: OpenSSL hardware crypto engine functionality is not available" ); +#endif +} +/* * * Functions related to the core crypto library
src/openvpn/openvpn.c +4 -0
@@ -112,6 +112,10 @@ void init_early(struct context *c)/* init verbosity and mute levels */ init_verb_mute (c,IVM_LEVEL_1 ); +/* Initialise OpenVPN provider, this needs to be intialised this +* early since option post processing and also openssl info +* printing depends on it */ +crypto_init_lib_provider ((*c).options.providers); }static void uninit_early (struct context *c)
src/openvpn/options.c +4 -0
@@ -8178,6 +8178,10 @@ add_option(struct options *options, options->engine = "auto"; } } +else if (streq (p[0 ],"provider" ) && p[1 ] && !p[2 ]) + { + options->providers = p[1 ]; + }#endif /* ENABLE_CRYPTO_MBEDTLS */ #ifdef ENABLE_PREDICTION_RESISTANCE else if (streq(p[0], "use-prediction-resistance") && !p[1])
src/openvpn/options.h +1 -0
@@ -521,6 +521,7 @@ struct optionsconst char *prng_hash;int prng_nonce_secret_len;const char *engine; +const char *providers;bool replay;bool mute_replay_warnings;int replay_window;
Signature · 1 line
2.33.0
PATCH v2 11/20 USe EVP_MD_get0_name instead EV_MD_name
In reply to Arne SchwabeUse the new name for the function as it indicates with get0 the ownership of the returned value
--- src/openvpn/crypto_openssl.c | 2 +- src/openvpn/openssl_compat.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
src/openvpn/crypto_openssl.c +1 -1
@@ -916,7 +916,7 @@ md_kt_name(const EVP_MD *kt) {return "[null-digest]" ; } -return EVP_MD_name (kt); +return EVP_MD_get0_name (kt); }unsigned char
src/openvpn/openssl_compat.h +2 -0
@@ -751,6 +751,8 @@ int EVP_PKEY_get_group_name(EVP_PKEY *pkey, char *gname, size_t gname_sz,/** Mimics SSL_CTX_new_ex for OpenSSL < 3 */ #if OPENSSL_VERSION_NUMBER <0x30000000L +#define EVP_MD_get0_name EVP_MD_name +static inline SSL_CTX *SSL_CTX_new_ex (void *libctx,const char *propq,const SSL_METHOD *method) {
Signature · 1 line
2.33.0
PATCH v2 12/20 Allow loading of non default providers
In reply to Arne SchwabeThis allows OpenVPN to load non-default providers. This is mainly useful for loading the legacy provider with --provider legacy:default
--- doc/man-sections/generic-options.rst | 10 ++++++++++ src/openvpn/crypto_backend.h | 7 +++++++ src/openvpn/crypto_mbedtls.c | 8 ++++++++ src/openvpn/crypto_openssl.c | 29 ++++++++++++++++++++++++++++ src/openvpn/openvpn.c | 4 ++++ src/openvpn/options.c | 4 ++++ src/openvpn/options.h | 1 + 7 files changed, 63 insertions(+)
doc/man-sections/generic-options.rst +10 -0
@@ -280,6 +280,16 @@ which mode OpenVPN is configured as. This option solves the problem by persisting keys across :code:`SIGUSR1` resets, so they don't need to be re-read. +--provider providers + Load the : separated list of (OpenSSL) providers. This is mainly useful for + using an external provider for key management like tpm2-openssl or to load + the legacy provider with + + :: + + --provider "legacy:default" + + --remap-usr1 signal Control whether internally or externally generated :code:`SIGUSR1` signals are remapped to :code:`SIGHUP` (restart without persisting state) or
src/openvpn/crypto_backend.h +7 -0
@@ -78,6 +78,13 @@ void crypto_clear_error(void);*/ void crypto_init_lib_engine (const char *engine_name); + +/** +* Load the given (OpenSSL) providers +* @param providers list of providers to load, seperated by : +*/ +void crypto_init_lib_provider (const char *providers); +#ifdef DMALLOC /* * OpenSSL memory debugging. If dmalloc debugging is enabled, tell
src/openvpn/crypto_mbedtls.c +8 -0
@@ -70,6 +70,14 @@ crypto_init_lib_engine(const char *engine_name) "available"); } +void crypto_init_lib_provider (const char *providers) +{ +if (providers) + { +msg (M_WARN ,"Note: mbed TLS provider functionality is not available" ); + } +} +/* * * Functions related to the core crypto library
src/openvpn/crypto_openssl.c +29 -0
@@ -54,6 +54,9 @@#if (OPENSSL_VERSION_NUMBER >=0x10100000L ) && !defined(LIBRESSL_VERSION_NUMBER )#include <openssl/kdf.h> #endif +#if OPENSSL_VERSION_NUMBER >=0x30000000L +#include <openssl/provider.h> +#endif /* * Check for key size creepage.
@@ -145,6 +148,32 @@ crypto_init_lib_engine(const char *engine_name)#endif } +void +crypto_init_lib_provider (const char *providers) +{ +if (!providers) + { +return ; + } +#if OPENSSL_VERSION_NUMBER >=0x30000000L +struct gc_arena gc =gc_new (); +char *tmp_providers =string_alloc (providers, &gc); + +const char *provname; +while ((provname =strsep (&tmp_providers,":" ))) + { +/* Load providers into the default (NULL) library context */ +OSSL_PROVIDER * provider =OSSL_PROVIDER_load (NULL , provname); +if (!provider) + { +crypto_msg (M_FATAL ,"failed to load provider '%s'" , provname); + } + } +#else /* OPENSSL_VERSION_NUMBER >= 0x30000000L */ +msg (M_WARN ,"Note: OpenSSL hardware crypto engine functionality is not available" ); +#endif +} +/* * * Functions related to the core crypto library
src/openvpn/openvpn.c +4 -0
@@ -112,6 +112,10 @@ void init_early(struct context *c)/* init verbosity and mute levels */ init_verb_mute (c,IVM_LEVEL_1 ); +/* Initialise OpenVPN provider, this needs to be intialised this +* early since option post processing and also openssl info +* printing depends on it */ +crypto_init_lib_provider ((*c).options.providers); }static void uninit_early (struct context *c)
src/openvpn/options.c +4 -0
@@ -8178,6 +8178,10 @@ add_option(struct options *options, options->engine = "auto"; } } +else if (streq (p[0 ],"provider" ) && p[1 ] && !p[2 ]) + { + options->providers = p[1 ]; + }#endif /* ENABLE_CRYPTO_MBEDTLS */ #ifdef ENABLE_PREDICTION_RESISTANCE else if (streq(p[0], "use-prediction-resistance") && !p[1])
src/openvpn/options.h +1 -0
@@ -521,6 +521,7 @@ struct optionsconst char *prng_hash;int prng_nonce_secret_len;const char *engine; +const char *providers;bool replay;bool mute_replay_warnings;int replay_window;
Signature · 1 line
2.33.0
PATCH v2 12/16 Remove dependency on BF-CBC existance from test_ncp
In reply to Arne SchwabeThe test_check_ncp_ciphers_list test assumed that BF-CBC is always available, which is no longer the case with OpenSSL 3.0. Rewrite the test to not rely on BF-CBC to be available.
--- tests/unit_tests/openvpn/test_ncp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
tests/unit_tests/openvpn/test_ncp.c +10 -3
@@ -41,6 +41,7 @@/* Defines for use in the tests and the mock parse_line() */ const char *bf_chacha ="BF-CBC:CHACHA20-POLY1305" ; +const char *aes_chacha ="AES-128-CBC:CHACHA20-POLY1305" ;const char *aes_ciphers ="AES-256-GCM:AES-128-GCM" ;
@@ -59,6 +60,7 @@ test_check_ncp_ciphers_list(void **state) {struct gc_arena gc =gc_new ();bool have_chacha =cipher_kt_get ("CHACHA20-POLY1305" ); +bool have_blowfish=cipher_kt_get ("BF-CBC" );assert_string_equal (mutate_ncp_cipher_list ("none" , &gc),"none" ); assert_string_equal(mutate_ncp_cipher_list("AES-256-GCM:none", &gc),
@@ -66,7 +68,12 @@ test_check_ncp_ciphers_list(void **state)assert_string_equal (mutate_ncp_cipher_list (aes_ciphers, &gc), aes_ciphers); -if (have_chacha) +if (have_chacha) + { +assert_string_equal (mutate_ncp_cipher_list (aes_chacha, &gc), aes_chacha); + } + +if (have_chacha && have_blowfish) {assert_string_equal (mutate_ncp_cipher_list (bf_chacha, &gc), bf_chacha); assert_string_equal(mutate_ncp_cipher_list("BF-CBC:CHACHA20-POLY1305", &gc),
@@ -82,8 +89,8 @@ test_check_ncp_ciphers_list(void **state)bool have_chacha_mixed_case =cipher_kt_get ("ChaCha20-Poly1305" );if (have_chacha_mixed_case) { -assert_string_equal (mutate_ncp_cipher_list ("BF-CBC:ChaCha20-Poly1305" , &gc), - bf_chacha); +assert_string_equal (mutate_ncp_cipher_list ("AES-128-CBC:ChaCha20-Poly1305" , &gc), + aes_chacha); }assert_ptr_equal (mutate_ncp_cipher_list ("vollbit" , &gc),NULL );
Signature · 1 line
2.33.0
PATCH v2 13/16 Add message when decoding PKCS12 file fails.
In reply to Arne SchwabeCurrently we never display the OpenSSL error stack when decoding a PCKS12 file fails. With LibreSSL defaulting to RC2-40-CBC, the failure might not be a wrong password but can actually be an unsupported encoding, seeing the error stack is really helpful (example from OpenSSL 3.0):
error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:346:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
to pinpoint the issue
--- src/openvpn/ssl_openssl.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/ssl_openssl.c +2 -0
@@ -831,6 +831,8 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file, ca =NULL ;if (!PKCS12_parse (p12, password, &pkey, &cert, &ca)) { +crypto_msg (M_WARN ,"Decoding PKCS12 failed. Probably wrong password " +"or unsupported/legacy encryption" );#ifdef ENABLE_MANAGEMENT if (management && (ERR_GET_REASON (ERR_peek_error ()) ==PKCS12_R_MAC_VERIFY_FAILURE )) {
Signature · 1 line
2.33.0
PATCH v2 13/20 Remove dependency on BF-CBC existance from test_ncp
In reply to Arne SchwabeThe test_check_ncp_ciphers_list test assumed that BF-CBC is always available, which is no longer the case with OpenSSL 3.0. Rewrite the test to not rely on BF-CBC to be available.
--- tests/unit_tests/openvpn/test_ncp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
tests/unit_tests/openvpn/test_ncp.c +10 -3
@@ -41,6 +41,7 @@/* Defines for use in the tests and the mock parse_line() */ const char *bf_chacha ="BF-CBC:CHACHA20-POLY1305" ; +const char *aes_chacha ="AES-128-CBC:CHACHA20-POLY1305" ;const char *aes_ciphers ="AES-256-GCM:AES-128-GCM" ;
@@ -59,6 +60,7 @@ test_check_ncp_ciphers_list(void **state) {struct gc_arena gc =gc_new ();bool have_chacha =cipher_kt_get ("CHACHA20-POLY1305" ); +bool have_blowfish=cipher_kt_get ("BF-CBC" );assert_string_equal (mutate_ncp_cipher_list ("none" , &gc),"none" ); assert_string_equal(mutate_ncp_cipher_list("AES-256-GCM:none", &gc),
@@ -66,7 +68,12 @@ test_check_ncp_ciphers_list(void **state)assert_string_equal (mutate_ncp_cipher_list (aes_ciphers, &gc), aes_ciphers); -if (have_chacha) +if (have_chacha) + { +assert_string_equal (mutate_ncp_cipher_list (aes_chacha, &gc), aes_chacha); + } + +if (have_chacha && have_blowfish) {assert_string_equal (mutate_ncp_cipher_list (bf_chacha, &gc), bf_chacha); assert_string_equal(mutate_ncp_cipher_list("BF-CBC:CHACHA20-POLY1305", &gc),
@@ -82,8 +89,8 @@ test_check_ncp_ciphers_list(void **state)bool have_chacha_mixed_case =cipher_kt_get ("ChaCha20-Poly1305" );if (have_chacha_mixed_case) { -assert_string_equal (mutate_ncp_cipher_list ("BF-CBC:ChaCha20-Poly1305" , &gc), - bf_chacha); +assert_string_equal (mutate_ncp_cipher_list ("AES-128-CBC:ChaCha20-Poly1305" , &gc), + aes_chacha); }assert_ptr_equal (mutate_ncp_cipher_list ("vollbit" , &gc),NULL );
Signature · 1 line
2.33.0
PATCH v2 14/16 Add small unit test for testing HMAC
In reply to Arne SchwabeThis just adds a very simple unit test to check that the HMAC implementation produces a well known hash.
--- tests/unit_tests/openvpn/test_crypto.c | 61 +++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 7 deletions(-)
tests/unit_tests/openvpn/test_crypto.c +54 -7
@@ -141,6 +141,11 @@ static uint8_t good_prf[32] = {0xd9, 0x8c, 0x85, 0x18, 0xc8, 0x5e, 0x94, 0x69,0x27 ,0x91 ,0x6a ,0xcf ,0xc2 ,0xd5 ,0x92 ,0xfb ,0xb1 ,0x56 ,0x7e ,0x4b ,0x4b ,0x14 ,0x59 ,0xe6 , 0xa9, 0x04, 0xac, 0x2d, 0xda, 0xb7, 0x2d, 0x67}; + +static const char * ipsumlorem ="Lorem ipsum dolor sit amet, consectetur " +"adipisici elit, sed eiusmod tempor incidunt " +"ut labore et dolore magna aliqua." ; +static void crypto_test_tls_prf (void **state) {
@@ -150,12 +155,6 @@ crypto_test_tls_prf(void **state)const size_t seed_len =strlen (seedstr); - - -const char * ipsumlorem ="Lorem ipsum dolor sit amet, consectetur " -"adipisici elit, sed eiusmod tempor incidunt ut " -"labore et dolore magna aliqua." ; -const unsigned char *secret = (const unsigned char *) ipsumlorem;size_t secret_len =strlen ((const char *)secret);
@@ -166,13 +165,61 @@ crypto_test_tls_prf(void **state)assert_memory_equal (good_prf, out,sizeof (out)); } +static uint8_t testkey[20 ] = {0x0b ,0x00 }; +static uint8_t goodhash[20 ] = {0x58 ,0xea ,0x5a ,0xf0 ,0x42 ,0x94 ,0xe9 ,0x17 , +0xed ,0x84 ,0xb9 ,0xf0 ,0x83 ,0x30 ,0x23 ,0xae , +0x8b ,0xa7 ,0x7e ,0xb8 }; + +static void +crypto_test_hmac (void **state) +{ +hmac_ctx_t *hmac =hmac_ctx_new (); +const md_kt_t *sha1 =md_kt_get ("SHA1" ); + +assert_int_equal (md_kt_size (sha1),20 ); + +uint8_t key[20 ]; +memcpy (key, testkey,sizeof (key)); + +hmac_ctx_init (hmac, key,20 , sha1); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); + +uint8_t hash[20 ]; +hmac_ctx_final (hmac, hash); + +assert_memory_equal (hash, goodhash,sizeof (hash)); +memset (hash,0x00 ,sizeof (hash)); + +/* try again */ +hmac_ctx_reset (hmac); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_final (hmac, hash); + +assert_memory_equal (hash, goodhash,sizeof (hash)); + +/* Fill our key with random data to ensure it is not used by hmac anymore */ +memset (key,0x55 ,sizeof (key)); + +hmac_ctx_reset (hmac); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_final (hmac, hash); + +assert_memory_equal (hash, goodhash,sizeof (hash)); +hmac_ctx_cleanup (hmac); +hmac_ctx_free (hmac); +} +int main (void ) {const struct CMUnitTest tests[] = {cmocka_unit_test (crypto_pem_encode_decode_loopback),cmocka_unit_test (crypto_translate_cipher_names), -cmocka_unit_test (crypto_test_tls_prf) +cmocka_unit_test (crypto_test_tls_prf), +cmocka_unit_test (crypto_test_hmac) };#if defined(ENABLE_CRYPTO_OPENSSL )
Signature · 1 line
2.33.0
PATCH v2 14/20 Use TYPE_do_all_provided function for listing cipher/digest
In reply to Arne SchwabeWith OpenSSL 3.0 the use of nid values is deprecated and new algorithms do not even have NID values anymore.
This also works nicely with providers now:
openvpn --provider legacy:default --show-ciphers
shows more ciphers (e.g. BF-CBC) than just
openvpn --show-ciphers
when compiled with OpenSSL 3.0
--- src/openvpn/crypto_openssl.c | 95 +++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 34 deletions(-)
src/openvpn/crypto_openssl.c +61 -34
@@ -311,86 +311,113 @@ cipher_name_cmp(const void *a, const void *b)return strcmp (cipher_kt_name (*cipher_a),cipher_kt_name (*cipher_b)); } +struct collect_ciphers { +/* If we ever exceed this, we must be more selective */ +const EVP_CIPHER *list[1000 ]; +size_t num; +}; + +static void collect_ciphers (EVP_CIPHER *cipher,void *list) +{ +struct collect_ciphers * cipher_list = list; +if (cipher_list->num == (sizeof (cipher_list->list)/sizeof (*cipher_list->list))) + { +msg (M_WARN ,"WARNING: Too many ciphers, not showing all" ); +return ; + } + + if (cipher && (cipher_kt_mode_cbc(cipher) +#ifdef ENABLE_OFB_CFB_MODE + ||cipher_kt_mode_ofb_cfb (cipher) +#endif + ||cipher_kt_mode_aead (cipher) + )) + { + cipher_list->list[cipher_list->num++] = cipher; + } +} +void show_available_ciphers (void ) { -int nid; -size_t i; +struct collect_ciphers cipher_list = {0 }; -/* If we ever exceed this, we must be more selective */ -const EVP_CIPHER *cipher_list[1000 ]; -size_t num_ciphers =0 ;#ifndef ENABLE_SMALL printf ("The following ciphers and cipher modes are available for use\n" "with " PACKAGE_NAME ". Each cipher shown below may be used as a\n" "parameter to the --data-ciphers (or --cipher) option. In static \n" -"key mode only CBC mode is allowed.\n\n" ); +"key mode only CBC mode is allowed.\n" ); +printf ("See also openssl list -cipher-algorithms\n\n" );#endif -for (nid =0 ; nid <10000 ; ++nid) +#if OPENSSL_VERSION_NUMBER >=0x30000000L +EVP_CIPHER_do_all_provided (NULL , collect_ciphers, &cipher_list); +#else +for (int nid =0 ; nid <10000 ; ++nid) {const EVP_CIPHER *cipher =EVP_get_cipherbynid (nid); - if (cipher && (cipher_kt_mode_cbc(cipher) -#ifdef ENABLE_OFB_CFB_MODE - ||cipher_kt_mode_ofb_cfb (cipher) -#endif - ||cipher_kt_mode_aead (cipher) - )) - { - cipher_list[num_ciphers++] = cipher; - } -if (num_ciphers == (sizeof (cipher_list)/sizeof (*cipher_list))) - { -msg (M_WARN ,"WARNING: Too many ciphers, not showing all" ); -break ; - } +/* We cast the const away so we can keep the function prototype +* compatible with EVP_CIPHER_do_all_provided */ +collect_ciphers ((EVP_CIPHER *)cipher, &cipher_list); } +#endif /* cast to non-const to prevent warning */ -qsort ((EVP_CIPHER *)cipher_list, num_ciphers,sizeof (*cipher_list), cipher_name_cmp); +qsort ((EVP_CIPHER *)cipher_list.list, cipher_list.num,sizeof (*cipher_list.list), cipher_name_cmp); -for (i =0 ; i < num_ciphers; i++) +for (size_t i =0 ; i < cipher_list.num; i++) { -if (!cipher_kt_insecure (cipher_list[i])) +if (!cipher_kt_insecure (cipher_list.list[i])) { -print_cipher (cipher_list[i]); +print_cipher (cipher_list.list[i]); } }printf ("\nThe following ciphers have a block size of less than 128 bits, \n" "and are therefore deprecated. Do not use unless you have to.\n\n" ); -for (i =0 ; i < num_ciphers; i++) +for (int i =0 ; i < cipher_list.num; i++) { -if (cipher_kt_insecure (cipher_list[i])) +if (cipher_kt_insecure (cipher_list.list[i])) { -print_cipher (cipher_list[i]); +print_cipher (cipher_list.list[i]); } }printf ("\n" ); }void -show_available_digests (void ) +print_digest (EVP_MD * digest,void * unused) { -int nid; +printf ("%s %d bit digest size\n" ,EVP_MD_get0_name (digest), +EVP_MD_size (digest) *8 ); +} +void +show_available_digests (void ) +{#ifndef ENABLE_SMALL printf ("The following message digests are available for use with\n" PACKAGE_NAME ". A message digest is used in conjunction with\n" "the HMAC function, to authenticate received packets.\n" "You can specify a message digest as parameter to\n" -"the --auth option.\n\n" ); +"the --auth option.\n" ); +printf ("See also openssl list -digest-algorithms\n\n" );#endif -for (nid =0 ; nid <10000 ; ++nid) +#if OPENSSL_VERSION_NUMBER >=0x30000000L +EVP_MD_do_all_provided (NULL , print_digest,NULL ); +#else +for (int nid =0 ; nid <10000 ; ++nid) {const EVP_MD *digest =EVP_get_digestbynid (nid);if (digest) { -printf ("%s %d bit digest size\n" , -OBJ_nid2sn (nid),EVP_MD_size (digest) *8 ); +/* We cast the const away so we can keep the function prototype +* compatible with EVP_MD_do_all_provided */ +print_digest ((EVP_MD *)digest,NULL ); } } +#endif printf ("\n" ); }
Signature · 1 line
2.33.0
PATCH v2 15/16 Fix error when BF-CBC is not available
In reply to Arne SchwabeThrough the multiple iteration of allowing OpenVPN to run without BF-CBC we accidentially made a regression and still required BF-CBC.
This patch fixes the code path and restores its intended function.
--- src/openvpn/options.c | 3 +++ 1 file changed, 3 insertions(+)
src/openvpn/options.c +3 -0
@@ -3797,6 +3797,9 @@ calc_options_string_link_mtu(const struct options *o, const struct frame *frame)/* overhead of BF-CBC: 64 bit block size, 64 bit IV size */ frame_add_to_extra_frame (&fake_frame,64 /8 +64 /8 ); +/* set ciphername to none, so its size does get added in the fake_kt and +* the cipher is not tried to be resolved */ + ciphername ="none" ; }init_key_type (&fake_kt, ciphername, o->authname, true, false);
Signature · 1 line
2.33.0
PATCH v2 15/20 Do not allow CTS ciphers
In reply to Arne SchwabeWe do not support CTS algorithms (cipher text stealing) algorithms.
--- src/openvpn/crypto_openssl.c | 3 +++ 1 file changed, 3 insertions(+)
src/openvpn/crypto_openssl.c +3 -0
@@ -760,6 +760,9 @@ cipher_kt_mode_cbc(const cipher_kt_t *cipher) {return cipher &&cipher_kt_mode (cipher) ==OPENVPN_MODE_CBC /* Exclude AEAD cipher modes, they require a different API */ +#ifdef EVP_CIPH_FLAG_CTS + && !(EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_CTS) +#endif && !(EVP_CIPHER_flags (cipher) &EVP_CIPH_FLAG_AEAD_CIPHER ); }
Signature · 1 line
2.33.0
PATCH v2 16/16 Add insecure tls-cert-profile options
In reply to Arne SchwabeThe recent deprecation of SHA1 certificates in OpenSSL 3.0 makes it necessary to reallow them in certain deployments. Currently this works by using the hack of using tls-cipher "DEFAULT:@SECLEVEL=0". Add insecure as option to tls-cert-profile to allow setting a seclevel of 0.
--- doc/man-sections/tls-options.rst | 6 ++++++ src/openvpn/ssl_mbedtls.c | 3 ++- src/openvpn/ssl_openssl.c | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-)
doc/man-sections/tls-options.rst +6 -0
@@ -373,6 +373,9 @@ certificates and keys: https://github.com/OpenVPN/easy-rsa The following profiles are supported: + :code:`insecure` + Identical for mbed TLS to `legacy` + :code:`legacy` (default) SHA1 and newer, RSA 2048-bit+, any elliptic curve.
@@ -385,6 +388,9 @@ certificates and keys: https://github.com/OpenVPN/easy-rsa This option is only fully supported for mbed TLS builds. OpenSSL builds use the following approximation: + :code:`insecure` + sets "security level 0" + :code:`legacy` (default) sets "security level 1"
src/openvpn/ssl_mbedtls.c +2 -1
@@ -336,7 +336,8 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)void tls_ctx_set_cert_profile (struct tls_root_ctx *ctx,const char *profile) { -if (!profile ||0 ==strcmp (profile,"legacy" )) +if (!profile ||0 ==strcmp (profile,"legacy" ) + ||0 ==strcmp (profile,"insecure" )) { ctx->cert_profile = openvpn_x509_crt_profile_legacy; }
src/openvpn/ssl_openssl.c +5 -1
@@ -532,7 +532,11 @@ tls_ctx_set_cert_profile(struct tls_root_ctx *ctx, const char *profile)* callbacks that we could try to implement to achieve something similar. * For now, use OpenSSL's security levels to achieve similar (but not equal) * behaviour. */ -if (!profile ||0 ==strcmp (profile,"legacy" )) +if (!profile ||0 ==strcmp (profile,"insecure" )) + { +SSL_CTX_set_security_level (ctx->ctx,0 ); + } +else if (!profile ||0 ==strcmp (profile,"legacy" )) {SSL_CTX_set_security_level (ctx->ctx,1 ); }
Signature · 1 line
2.33.0
PATCH v2 16/20 Add message when decoding PKCS12 file fails.
In reply to Arne SchwabeCurrently we never display the OpenSSL error stack when decoding a PCKS12 file fails. With LibreSSL defaulting to RC2-40-CBC, the failure might not be a wrong password but can actually be an unsupported encoding, seeing the error stack is really helpful (example from OpenSSL 3.0):
error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:346:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()
to pinpoint the issue
--- src/openvpn/ssl_openssl.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/ssl_openssl.c +2 -0
@@ -831,6 +831,8 @@ tls_ctx_load_pkcs12(struct tls_root_ctx *ctx, const char *pkcs12_file, ca =NULL ;if (!PKCS12_parse (p12, password, &pkey, &cert, &ca)) { +crypto_msg (M_WARN ,"Decoding PKCS12 failed. Probably wrong password " +"or unsupported/legacy encryption" );#ifdef ENABLE_MANAGEMENT if (management && (ERR_GET_REASON (ERR_peek_error ()) ==PKCS12_R_MAC_VERIFY_FAILURE )) {
Signature · 1 line
2.33.0
PATCH v2 17/20 Add small unit test for testing HMAC
In reply to Arne SchwabeThis just adds a very simple unit test to check that the HMAC implementation produces a well known hash.
--- tests/unit_tests/openvpn/test_crypto.c | 61 +++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 7 deletions(-)
tests/unit_tests/openvpn/test_crypto.c +54 -7
@@ -141,6 +141,11 @@ static uint8_t good_prf[32] = {0xd9, 0x8c, 0x85, 0x18, 0xc8, 0x5e, 0x94, 0x69,0x27 ,0x91 ,0x6a ,0xcf ,0xc2 ,0xd5 ,0x92 ,0xfb ,0xb1 ,0x56 ,0x7e ,0x4b ,0x4b ,0x14 ,0x59 ,0xe6 , 0xa9, 0x04, 0xac, 0x2d, 0xda, 0xb7, 0x2d, 0x67}; + +static const char * ipsumlorem ="Lorem ipsum dolor sit amet, consectetur " +"adipisici elit, sed eiusmod tempor incidunt " +"ut labore et dolore magna aliqua." ; +static void crypto_test_tls_prf (void **state) {
@@ -150,12 +155,6 @@ crypto_test_tls_prf(void **state)const size_t seed_len =strlen (seedstr); - - -const char * ipsumlorem ="Lorem ipsum dolor sit amet, consectetur " -"adipisici elit, sed eiusmod tempor incidunt ut " -"labore et dolore magna aliqua." ; -const unsigned char *secret = (const unsigned char *) ipsumlorem;size_t secret_len =strlen ((const char *)secret);
@@ -166,13 +165,61 @@ crypto_test_tls_prf(void **state)assert_memory_equal (good_prf, out,sizeof (out)); } +static uint8_t testkey[20 ] = {0x0b ,0x00 }; +static uint8_t goodhash[20 ] = {0x58 ,0xea ,0x5a ,0xf0 ,0x42 ,0x94 ,0xe9 ,0x17 , +0xed ,0x84 ,0xb9 ,0xf0 ,0x83 ,0x30 ,0x23 ,0xae , +0x8b ,0xa7 ,0x7e ,0xb8 }; + +static void +crypto_test_hmac (void **state) +{ +hmac_ctx_t *hmac =hmac_ctx_new (); +const md_kt_t *sha1 =md_kt_get ("SHA1" ); + +assert_int_equal (md_kt_size (sha1),20 ); + +uint8_t key[20 ]; +memcpy (key, testkey,sizeof (key)); + +hmac_ctx_init (hmac, key,20 , sha1); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); + +uint8_t hash[20 ]; +hmac_ctx_final (hmac, hash); + +assert_memory_equal (hash, goodhash,sizeof (hash)); +memset (hash,0x00 ,sizeof (hash)); + +/* try again */ +hmac_ctx_reset (hmac); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_final (hmac, hash); + +assert_memory_equal (hash, goodhash,sizeof (hash)); + +/* Fill our key with random data to ensure it is not used by hmac anymore */ +memset (key,0x55 ,sizeof (key)); + +hmac_ctx_reset (hmac); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_update (hmac, (const uint8_t *)ipsumlorem, (int )strlen (ipsumlorem)); +hmac_ctx_final (hmac, hash); + +assert_memory_equal (hash, goodhash,sizeof (hash)); +hmac_ctx_cleanup (hmac); +hmac_ctx_free (hmac); +} +int main (void ) {const struct CMUnitTest tests[] = {cmocka_unit_test (crypto_pem_encode_decode_loopback),cmocka_unit_test (crypto_translate_cipher_names), -cmocka_unit_test (crypto_test_tls_prf) +cmocka_unit_test (crypto_test_tls_prf), +cmocka_unit_test (crypto_test_hmac) };#if defined(ENABLE_CRYPTO_OPENSSL )
Signature · 1 line
2.33.0
PATCH v2 18/20 Fix error when BF-CBC is not available
In reply to Arne SchwabeThrough the multiple iteration of allowing OpenVPN to run without BF-CBC we accidentially made a regression and still required BF-CBC.
This patch fixes the code path and restores its intended function.
--- src/openvpn/options.c | 3 +++ 1 file changed, 3 insertions(+)
src/openvpn/options.c +3 -0
@@ -3797,6 +3797,9 @@ calc_options_string_link_mtu(const struct options *o, const struct frame *frame)/* overhead of BF-CBC: 64 bit block size, 64 bit IV size */ frame_add_to_extra_frame (&fake_frame,64 /8 +64 /8 ); +/* set ciphername to none, so its size does get added in the fake_kt and +* the cipher is not tried to be resolved */ + ciphername ="none" ; }init_key_type (&fake_kt, ciphername, o->authname, true, false);
Signature · 1 line
2.33.0
PATCH v2 19/20 Add insecure tls-cert-profile options
In reply to Arne SchwabeThe recent deprecation of SHA1 certificates in OpenSSL 3.0 makes it necessary to reallow them in certain deployments. Currently this works by using the hack of using tls-cipher "DEFAULT:@SECLEVEL=0". Add insecure as option to tls-cert-profile to allow setting a seclevel of 0.
--- doc/man-sections/tls-options.rst | 6 ++++++ src/openvpn/ssl_mbedtls.c | 3 ++- src/openvpn/ssl_openssl.c | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-)
doc/man-sections/tls-options.rst +6 -0
@@ -373,6 +373,9 @@ certificates and keys: https://github.com/OpenVPN/easy-rsa The following profiles are supported: + :code:`insecure` + Identical for mbed TLS to `legacy` + :code:`legacy` (default) SHA1 and newer, RSA 2048-bit+, any elliptic curve.
@@ -385,6 +388,9 @@ certificates and keys: https://github.com/OpenVPN/easy-rsa This option is only fully supported for mbed TLS builds. OpenSSL builds use the following approximation: + :code:`insecure` + sets "security level 0" + :code:`legacy` (default) sets "security level 1"
src/openvpn/ssl_mbedtls.c +2 -1
@@ -336,7 +336,8 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)void tls_ctx_set_cert_profile (struct tls_root_ctx *ctx,const char *profile) { -if (!profile ||0 ==strcmp (profile,"legacy" )) +if (!profile ||0 ==strcmp (profile,"legacy" ) + ||0 ==strcmp (profile,"insecure" )) { ctx->cert_profile = openvpn_x509_crt_profile_legacy; }
src/openvpn/ssl_openssl.c +5 -1
@@ -532,7 +532,11 @@ tls_ctx_set_cert_profile(struct tls_root_ctx *ctx, const char *profile)* callbacks that we could try to implement to achieve something similar. * For now, use OpenSSL's security levels to achieve similar (but not equal) * behaviour. */ -if (!profile ||0 ==strcmp (profile,"legacy" )) +if (!profile ||0 ==strcmp (profile,"insecure" )) + { +SSL_CTX_set_security_level (ctx->ctx,0 ); + } +else if (!profile ||0 ==strcmp (profile,"legacy" )) {SSL_CTX_set_security_level (ctx->ctx,1 ); }
Signature · 1 line
2.33.0
PATCH v2 20/20 Add macos OpenSSL 3.0 and ASAN builds
In reply to Arne Schwabe--- .github/workflows/build.yaml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
.github/workflows/build.yaml +25 -3
@@ -168,15 +168,37 @@ jobs: macos: runs-on: macos-latest + strategy: + fail-fast: false + matrix: + ossl: [ 1.1, 3 ] + build: [ normal, asan ] + include: + - build: asan + cflags: "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" + ldflags: -fsanitize=address + # Our build system ignores LDFLAGS for plugins + configureflags: --disable-plugin-auth-pam --disable-plugin-down-root + - build: normal + cflags: "-O2 -g" + ldflags: "" + configureflags: "" + + name: "macOS - OpenSSL ${{matrix.ossl}} - ${{matrix.build}}" + env: + CFLAGS: ${{ matrix.cflags }} + LDFLAGS: ${{ matrix.ldflags }} + OPENSSL_CFLAGS: -I/usr/local/opt/openssl@${{matrix.ossl}}/include + OPENSSL_LIBS: "-L/usr/local/opt/openssl@${{matrix.ossl}}/lib -lcrypto -lssl" steps: + - name: Install dependencies + run: brew install [email protected]... [email protected]... lzo lz4 man2html cmocka libtool automake autoconf - name: Checkout OpenVPN uses: actions/[email protected]... - - name: Install dependencies - run: brew install openssl lzo lz4 man2html cmocka libtool automake autoconf - name: autoconf run: autoreconf -fvi - name: configure - run: OPENSSL_CFLAGS=-I/usr/local/opt/[email protected].../include OPENSSL_LIBS="-L/usr/local/opt/[email protected].../lib -lcrypto -lssl" ./configure + run: ./configure ${{matrix.configureflags}} - name: make all run: make -j4 - name: make check
Signature · 1 line
2.33.0
Am 19.10.21 um 20:23 schrieb Arne Schwabe:
Quoted 3 lines
This patchset removes almost all deprecation warnings from OpenVPN that related to OpenSSL 3.0. The patchset has already been tested with users and OpenSSL 3.0 as part of my OpenVPN for Android client.
I somehow managed to most patches twiced and now this patchset is completely weird, I will resend as v3 without duplicate patches.