Skip to contentSkip to conversation

test_ncp.c failing

Openvpn-devel James Bottomley 3 participants 6 messages May 28, 2020 – Jun 12, 2020

lore
Share & tools
lore
#0 lore raw

I'm getting this failure of test_ncp.c

[ RUN      ] test_check_ncp_ciphers_list
[  ERROR   ] --- 0x7d67e8 != 0
[   LINE   ] --- test_ncp.c:65: error: Failure!
[  FAILED  ] test_check_ncp_ciphers_list

I'm building under openssl-1.1.0i

The problem seems to be openssl uses a mixed case name for the cipher and EVP_CIPHER_name() is case sensitive. Applying the patch below fixes this for openssl and gets make check to pass all tests, but I rather wonder why this isn't part of cipher_kt_name() to prevent this type of problem?

James

---

tests/unit_tests/openvpn/test_ncp.c +1 -1
index 19432410..f58fa2ea 100644
@@ -48,7 +48,7 @@ static void
 test_check_ncp_ciphers_list(void **state)
 {
     struct gc_arena gc = gc_new();
-    bool have_chacha = cipher_kt_get("CHACHA20-POLY1305");
+    bool have_chacha = cipher_kt_get(translate_cipher_name_from_openvpn("CHACHA20-POLY1305"));
 
 
 
#1 lore raw

Am 29.05.20 um 01:46 schrieb James Bottomley:

Quoted 7 lines

I'm getting this failure of test_ncp.c

[ RUN      ] test_check_ncp_ciphers_list
[  ERROR   ] --- 0x7d67e8 != 0
[   LINE   ] --- test_ncp.c:65: error: Failure!
[  FAILED  ] test_check_ncp_ciphers_list
Quoted 7 lines

I'm building under openssl-1.1.0i

The problem seems to be openssl uses a mixed case name for the cipher and EVP_CIPHER_name() is case sensitive. Applying the patch below fixes this for openssl and gets make check to pass all tests, but I rather wonder why this isn't part of cipher_kt_name() to prevent this type of problem?

Without double checking if I remember correctly OpenSSL 1.1.0 is a corner case in this regard. OpenSSL 1.1.1 accepts mixed and non mixed case.

I want to fix this oddity in a proper way and write at least a small unit test to ensure that always end up with the same cipher on the wire protocol (in IV_CIPHERS and in the options string).

Arne

author Reviewed-by Richard Levitte
#2 lore raw
Quoted 16 lines · Arne Schwabe

Am 29.05.20 um 01:46 schrieb James Bottomley:

Quoted 7 lines

I'm getting this failure of test_ncp.c

[ RUN      ] test_check_ncp_ciphers_list
[  ERROR   ] --- 0x7d67e8 != 0
[   LINE   ] --- test_ncp.c:65: error: Failure!
[  FAILED  ] test_check_ncp_ciphers_list
Quoted 7 lines

I'm building under openssl-1.1.0i

The problem seems to be openssl uses a mixed case name for the cipher and EVP_CIPHER_name() is case sensitive. Applying the patch below fixes this for openssl and gets make check to pass all tests, but I rather wonder why this isn't part of cipher_kt_name() to prevent this type of problem?

Quoted 3 lines

Without double checking if I remember correctly OpenSSL 1.1.0 is a corner case in this regard. OpenSSL 1.1.1 accepts mixed and non mixed case.

It was fixed by:

commit fc196a5eb97dc3a5465c37a6761428ddd81b023d

Author: Pauli <[email protected]...>
Date:   Tue Sep 4 07:35:45 2018 +1000

Make OBJ_NAME case insensitive.

(Merged from https://github.com/openssl/openssl/pull/7089)

So yes, all of 1.1.1 has this fix.

James

Quoted 6 lines

I want to fix this oddity in a proper way and write at least a small unit test to ensure that always end up with the same cipher on the wire protocol (in IV_CIPHERS and in the options string).

Arne

#3 lore raw
In reply to James Bottomley

Hi,

tests/unit_tests/openvpn/test_ncp.c static void · line 51

Quoted 10 lines · James Bottomley
tests/unit_tests/openvpn/test_ncp.c +1 -1
index 19432410..f58fa2ea 100644
@@ -48,7 +48,7 @@ static void
 test_check_ncp_ciphers_list(void **state)
 {
     struct gc_arena gc = gc_new();
-    bool have_chacha = cipher_kt_get("CHACHA20-POLY1305");
+    bool have_chacha = cipher_kt_get(translate_cipher_name_from_openvpn("CHACHA20-POLY1305"));

Am I right in assuming that this patch is no longer needed with the two cipher_kt_ translation patches I merged yesterday?

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#4 lore raw
Quoted 19 lines · Gert Doering

Hi,

Quoted 11 lines · James Bottomley
tests/unit_tests/openvpn/test_ncp.c +1 -1
index 19432410..f58fa2ea 100644
@@ -48,7 +48,7 @@ static void
 test_check_ncp_ciphers_list(void **state)
 {
     struct gc_arena gc = gc_new();
-    bool have_chacha = cipher_kt_get("CHACHA20-POLY1305");
+    bool have_chacha =
Quoted 2 lines

cipher_kt_get(translate_cipher_name_from_openvpn("CHACHA20- POLY1305"));

Am I right in assuming that this patch is no longer needed with the two cipher_kt_ translation patches I merged yesterday?

Yes, make check now passes on openSUSE_Leap_15.1

James

#5 lore raw

Hi,

Quoted 3 lines · James Bottomley
Quoted 2 lines

Am I right in assuming that this patch is no longer needed with the two cipher_kt_ translation patches I merged yesterday?

Yes, make check now passes on openSUSE_Leap_15.1

Cool. Marking as "superseded" in patchwork.

One down, 73 to go... :)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...