[Openvpn-devel,v2,7/7] Remove dependency on BF-CBC existance from test_ncp

Message ID 20220513083635.2199131-1-arne@rfc2549.org
State Accepted
Headers show
Series
  • Untitled series #1566
Related show

Commit Message

Arne Schwabe May 13, 2022, 8:36 a.m.
The 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.

This is a cherry-pick from c07f95f3

Patch V2: manually fix if condition. Somehow the git cherry-pick ended up
          with a broken if condition.
---
 tests/unit_tests/openvpn/test_ncp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Gert Doering May 13, 2022, 8:46 a.m. | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Funny how "git cherry-pick" can sometimes do correct-looking-but-different
stuff... now the code matches what is in the master commit.

Plus, it passes "make check" with 3.0.x builds :-)

Your patch has been applied to the release/2.5 branch.

commit 263436fdb06cc2364f9667bc1adead70aeb93ecc
Author: Arne Schwabe
Date:   Fri May 13 10:36:35 2022 +0200

     Remove dependency on BF-CBC existance from test_ncp

     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220513083635.2199131-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24346.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/unit_tests/openvpn/test_ncp.c b/tests/unit_tests/openvpn/test_ncp.c
index e38a5738e..4337f6df7 100644
--- a/tests/unit_tests/openvpn/test_ncp.c
+++ b/tests/unit_tests/openvpn/test_ncp.c
@@ -42,6 +42,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";
 
 static void
@@ -57,6 +58,11 @@  test_check_ncp_ciphers_list(void **state)
 
     assert_string_equal(mutate_ncp_cipher_list(aes_ciphers, &gc), aes_ciphers);
 
+    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);
@@ -73,8 +79,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);