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

Message ID 20220512121429.2096164-8-arne@rfc2549.org
State Changes Requested
Headers show
Series
  • Improve OpenSSL 3.0 support in OpenVPN 2.5
Related show

Commit Message

Arne Schwabe May 12, 2022, 12:14 p.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.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
Message-Id: <20211019183127.614175-14-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23003.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
---
 tests/unit_tests/openvpn/test_ncp.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Gert Doering May 13, 2022, 7:14 a.m. | #1
Hi,

On Thu, May 12, 2022 at 02:14:29PM +0200, Arne Schwabe wrote:
> 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 should be a cherry-pick from c07f95f3cacd, but "something went
wrong"

>  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 && have_blowfish)
> +    {
> +        assert_string_equal(mutate_ncp_cipher_list(aes_chacha, &gc), aes_chacha);
> +    }

In c07f95f3cacd, the first if() is only "if (have_chacha)", and that
seems to make more sense since that test does not depend on BF...

> +
>      if (have_chacha && have_blowfish)
>      {

... only this one does...

can I have a 7/7 v2, please? :-)

gert

Patch

diff --git a/tests/unit_tests/openvpn/test_ncp.c b/tests/unit_tests/openvpn/test_ncp.c
index e38a5738e..d4164ef7a 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 && have_blowfish)
+    {
+        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);