[Openvpn-devel,v1] Fix ssl unit tests on OpenSSL 1.0.2

Message ID 20240122130909.10706-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,v1] Fix ssl unit tests on OpenSSL 1.0.2 | expand

Commit Message

Gert Doering Jan. 22, 2024, 1:09 p.m. UTC
From: Arne Schwabe <arne@rfc2549.org>

OpenSSL 1.1.1 will initialise itself using clever linker magic. For
OpenSSL 1.0.2 we need to manually initialise the library. For other
unit tests just doing the OpenSSL_add_all_algorithms is enough but
this unit test needs a more complete initialisation.

Change-Id: I378081f391ad755d0a6fd5613de5c2a8bacc389a
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
---

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/+/503
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@lichtenheld.com>

Comments

Gert Doering Jan. 22, 2024, 1:15 p.m. UTC | #1
Good catch, "obviously correct" :-)

Your patch has been applied to the master branch.

Not applied to 2.6 since these new tests are not in release/2.6 - so, but
not present.

commit dc4fde8052639ffbc29ccc87130a0ce25f6dcd6c
Author: Arne Schwabe
Date:   Mon Jan 22 14:09:09 2024 +0100

     Fix ssl unit tests on OpenSSL 1.0.2

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


--
kind regards,

Gert Doering

Patch

diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn/test_ssl.c
index fd2049f..d0c3df7 100644
--- a/tests/unit_tests/openvpn/test_ssl.c
+++ b/tests/unit_tests/openvpn/test_ssl.c
@@ -127,13 +127,13 @@ 
     };
 
 #if defined(ENABLE_CRYPTO_OPENSSL)
-    OpenSSL_add_all_algorithms();
+    tls_init_lib();
 #endif
 
     int ret = cmocka_run_group_tests_name("crypto tests", tests, NULL, NULL);
 
 #if defined(ENABLE_CRYPTO_OPENSSL)
-    EVP_cleanup();
+    tls_free_lib();
 #endif
 
     return ret;