From: "plaisthos (Code Review)" Date: Wed, 11 Mar 2026 15:37:38 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <553248849bf041c0c4b6b79486978acda25286ee-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="0SGJejqmVco="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Remove unnecessary OpenSSL init and unit commands in unit tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: openvpn-devel --0SGJejqmVco= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/= c/openvpn/+/1568?usp=3Demail ) Change subject: Remove unnecessary OpenSSL init and unit commands in unit t= ests ...................................................................... Remove unnecessary OpenSSL init and unit commands in unit tests After the removal of OpenSSL 1.0.2 support these instructions are no longer needed and the main OpenVPN program also no longer calls them in init_ssl_lib or free_ssl_lib. Also remove them from the unit tests. This also solves a deprecation warning on EVP_cleanup when compiling with aws-lc Change-Id: I228f6fd9ff18256f09d4348df1fc48853f8e7306 --- M tests/unit_tests/openvpn/test_auth_token.c M tests/unit_tests/openvpn/test_crypto.c M tests/unit_tests/openvpn/test_ncp.c M tests/unit_tests/openvpn/test_pkt.c M tests/unit_tests/openvpn/test_tls_crypt.c 5 files changed, 5 insertions(+), 43 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/1568/1 diff --git a/tests/unit_tests/openvpn/test_auth_token.c b/tests/unit_tests/= openvpn/test_auth_token.c index 82c20c1..d28bd8a 100644 --- a/tests/unit_tests/openvpn/test_auth_token.c +++ b/tests/unit_tests/openvpn/test_auth_token.c @@ -428,11 +428,5 @@ cmocka_unit_test_setup_teardown(auth_token_test_session_mismatch, = setup, teardown) }; -#if defined(ENABLE_CRYPTO_OPENSSL) - OpenSSL_add_all_algorithms(); -#endif - - int ret =3D cmocka_run_group_tests_name("auth-token tests", tests, NUL= L, NULL); - - return ret; + return cmocka_run_group_tests_name("auth-token tests", tests, NULL, NU= LL); } diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/open= vpn/test_crypto.c index 1679d88..cb4eaa2 100644 --- a/tests/unit_tests/openvpn/test_crypto.c +++ b/tests/unit_tests/openvpn/test_crypto.c @@ -963,15 +963,5 @@ cmocka_unit_test(epoch_test_derive_data_key) }; -#if defined(ENABLE_CRYPTO_OPENSSL) - OpenSSL_add_all_algorithms(); -#endif - - int ret =3D cmocka_run_group_tests_name("crypto tests", tests, NULL, N= ULL); - -#if defined(ENABLE_CRYPTO_OPENSSL) - EVP_cleanup(); -#endif - - return ret; + return cmocka_run_group_tests_name("crypto tests", tests, NULL, NULL); } diff --git a/tests/unit_tests/openvpn/test_ncp.c b/tests/unit_tests/openvpn= /test_ncp.c index 52a41ee..29365db 100644 --- a/tests/unit_tests/openvpn/test_ncp.c +++ b/tests/unit_tests/openvpn/test_ncp.c @@ -407,8 +407,6 @@ main(void) { openvpn_unit_test_setup(); -#if defined(ENABLE_CRYPTO_OPENSSL) - OpenSSL_add_all_algorithms(); -#endif + return cmocka_run_group_tests(ncp_tests, NULL, NULL); } diff --git a/tests/unit_tests/openvpn/test_pkt.c b/tests/unit_tests/openvpn= /test_pkt.c index a94732d..cad2ce0 100644 --- a/tests/unit_tests/openvpn/test_pkt.c +++ b/tests/unit_tests/openvpn/test_pkt.c @@ -765,15 +765,5 @@ cmocka_unit_test(test_extract_control_message) }; -#if defined(ENABLE_CRYPTO_OPENSSL) - OpenSSL_add_all_algorithms(); -#endif - - int ret =3D cmocka_run_group_tests_name("pkt tests", tests, NULL, NULL= ); - -#if defined(ENABLE_CRYPTO_OPENSSL) - EVP_cleanup(); -#endif - - return ret; + return cmocka_run_group_tests_name("pkt tests", tests, NULL, NULL); } diff --git a/tests/unit_tests/openvpn/test_tls_crypt.c b/tests/unit_tests/o= penvpn/test_tls_crypt.c index ed82279..1776d71 100644 --- a/tests/unit_tests/openvpn/test_tls_crypt.c +++ b/tests/unit_tests/openvpn/test_tls_crypt.c @@ -673,15 +673,5 @@ cmocka_unit_test(test_tls_crypt_v2_write_client_key_file_metadata), }; -#if defined(ENABLE_CRYPTO_OPENSSL) - OpenSSL_add_all_algorithms(); -#endif - - int ret =3D cmocka_run_group_tests_name("tls-crypt tests", tests, NULL= , NULL); - -#if defined(ENABLE_CRYPTO_OPENSSL) - EVP_cleanup(); -#endif - - return ret; + return cmocka_run_group_tests_name("tls-crypt tests", tests, NULL, NUL= L); } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1568?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I228f6fd9ff18256f09d4348df1fc48853f8e7306 Gerrit-Change-Number: 1568 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-CC: openvpn-devel --0SGJejqmVco= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

plaisthos has upl= oaded this change for review.

View Change

Remove unnecessary OpenSSL init and unit commands in unit tests

= After the removal of OpenSSL 1.0.2 support these instructions are
no lon= ger needed and the main OpenVPN program also no longer calls
them in ini= t_ssl_lib or free_ssl_lib.

Also remove them from the unit tests. Thi= s also solves a
deprecation warning on EVP_cleanup when compiling with a= ws-lc

Change-Id: I228f6fd9ff18256f09d4348df1fc48853f8e7306
---M tests/unit_tests/openvpn/test_auth_token.c
M tests/unit_tests/openvpn= /test_crypto.c
M tests/unit_tests/openvpn/test_ncp.c
M tests/unit_tes= ts/openvpn/test_pkt.c
M tests/unit_tests/openvpn/test_tls_crypt.c
5 f= iles changed, 5 insertions(+), 43 deletions(-)

g=
it pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/1568/1
=
diff --git a/tests/unit_tests/openvpn/test_auth_token.c b/tests/unit_tes=
ts/openvpn/test_auth_token.c
index 82c20c1..d28bd8a 100644<= /span>
--- a/tests/unit_tests/openvpn/test_auth_token.c
= +++ b/tests/unit_tests/openvpn/test_auth_token.c
@@ -= 428,11 +428,5 @@
cmocka_unit_test_setup_teardown(a= uth_token_test_session_mismatch, setup, teardown)
};

-#if d= efined(ENABLE_CRYPTO_OPENSSL)
- OpenSSL_add_all_algorithms();
-#endif
-
- int ret =3D = cmocka_run_group_tests_name("auth-token tests", tests, NULL, NULL= );
-
- return ret;
+ return cmocka_run_group_tests_name("= ;auth-token tests", tests, NULL, NULL);
}
<= span>diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests= /openvpn/test_crypto.c

index 1679d88..cb4eaa2 100644=
--- a/tests/unit_tests/openvpn/test_crypto.c
+++ = b/tests/unit_tests/openvpn/test_crypto.c
@@ -963,15 +963,5 = @@
cmocka_unit_test(epoch_test_derive_data_key)
};

-#if defined(ENABLE_CRYPTO_OPENSSL)
- OpenSSL_add_all_algorithms();-#endif
-
- int ret =3D cmocka_run_group_tests_name("crypto tests"= ;, tests, NULL, NULL);
= -
-#if defined(ENABLE_C= RYPTO_OPENSSL)
- EVP= _cleanup();
-#endif

-
- return ret;
+ return cmocka_run_group_tests_name("crypt= o tests", tests, NULL, NULL);
}
diff = --git a/tests/unit_tests/openvpn/test_ncp.c b/tests/unit_tests/openvpn/test= _ncp.c
index 52a41ee..29365db 100644
--- a/= tests/unit_tests/openvpn/test_ncp.c
+++ b/tests/unit_tests/= openvpn/test_ncp.c
@@ -407,8 +407,6 @@
mai= n(void)
{
openvpn_unit_test_setup();<= /span>
-#if defined(ENABLE_CRY= PTO_OPENSSL)
- OpenS= SL_add_all_algorithms();
+ return cmocka_run_group_tests(ncp_tests, NULL, NULL); }
diff --git a/tests/unit_tests/openvpn/test_pkt.c = b/tests/unit_tests/openvpn/test_pkt.c
index a94732d..cad2ce= 0 100644
--- a/tests/unit_tests/openvpn/test_pkt.c+++ b/tests/unit_tests/openvpn/test_pkt.c
@@ -765,1= 5 +765,5 @@
cmocka_unit_test(test_extract_control_= message)
};

-#if defined(ENABLE_CRYPTO_OPENSSL)
<= span style=3D"color: hsl(0, 100%, 40%);">- OpenSSL_add_all_algorithms();=

-#endif
-
- int ret =3D cmocka_run_group_tests_name("pkt tes= ts", tests, NULL, NULL);
-
-#if defined(E= NABLE_CRYPTO_OPENSSL)
-= EVP_cleanup();
-#en= dif
-
- return ret;
+ return cmocka_run_group_tests_name(&q= uot;pkt tests", tests, NULL, NULL);
}
diff --git a/tests/unit_tests/openvpn/test_tls_crypt.c b/tests/unit_tests/= openvpn/test_tls_crypt.c
index ed82279..1776d71 100644

--- a/tests/unit_tests/openvpn/test_tls_crypt.c
+++ b/tests/unit_tests/openvpn/test_tls_crypt.c
@@ -673,15= +673,5 @@
cmocka_unit_test(test_tls_crypt_v2_writ= e_client_key_file_metadata),
};

-#if defined(ENABLE_CRYPTO_= OPENSSL)
- OpenSSL_a= dd_all_algorithms();
-#= endif
-
- int ret =3D cmocka_run_group_test= s_name("tls-crypt tests", tests, NULL, NULL);

-
-#if defined(ENABLE_CRYPTO_OPENSSL)
- EVP_cleanup();
-#endif
-
- return re= t;
+ return cmocka= _run_group_tests_name("tls-crypt tests", tests, NULL, NULL);
}

To view, visit change 1568= . To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I228f6fd9ff18256f09d4348df1f= c48853f8e7306
Gerrit-Change-Number: 1568
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --0SGJejqmVco=--