]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix handling an optional invalid cipher at the end of data-ciphers
authorArne Schwabe <arne@rfc2549.org>
Mon, 6 Dec 2021 15:08:52 +0000 (16:08 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 6 Dec 2021 15:42:49 +0000 (16:42 +0100)
If an optional cipher was found at the end of --data-cipher that was
not available, it would reset the error and allow non optional ciphers
to be ignored.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20211206150852.3142891-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/search?l=mid&q=20211206150852.3142891-1-arne@rfc2549.org
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl_ncp.c
tests/unit_tests/openvpn/test_ncp.c

index 7ad825038b7d5a445c6e334a7f50787cccb8b001..4b95406e99c67519d4be4445f4a0c7d71ccae0d1 100644 (file)
@@ -134,7 +134,7 @@ mutate_ncp_cipher_list(const char *list, struct gc_arena *gc)
         {
             const char* optstr = optional ? "optional ": "";
             msg(M_WARN, "Unsupported %scipher in --data-ciphers: %s", optstr, token);
-            error_found = !optional;
+            error_found = error_found || !optional;
         }
         else
         {
index faf09a36c5aec64b4702b31e25bd880d56279149..6702133ad050204c85dff762c4639d845925c8c9 100644 (file)
@@ -95,6 +95,9 @@ test_check_ncp_ciphers_list(void **state)
     /* All unsupported should still yield an empty list */
     assert_ptr_equal(mutate_ncp_cipher_list("?kugelfisch:?grasshopper", &gc), NULL);
 
+    /* If the last is optional, previous invalid ciphers should be ignored */
+    assert_ptr_equal(mutate_ncp_cipher_list("Vollbit:Littlebit:AES-256-CBC:BF-CBC:?nixbit", &gc), NULL);
+
     /* For testing that with OpenSSL 1.1.0+ that also accepts ciphers in
      * a different spelling the normalised cipher output is the same */
     bool have_chacha_mixed_case = cipher_kt_get("ChaCha20-Poly1305");