diff options
author | Antonio Quartulli | 2022-01-21 15:43:13 +0100 |
---|---|---|
committer | Gert Doering | 2022-01-21 17:11:25 +0100 |
commit | 33d9c7ace354693168c093550bd5a9f4dfed4078 (patch) | |
tree | ef2a04c24eed69f5ff235afddd58c904f85dacdb /tests | |
parent | 8ee0997abd0642c4c4a6135573beba647d982f7c (diff) | |
download | openvpn-33d9c7ace354693168c093550bd5a9f4dfed4078.zip openvpn-33d9c7ace354693168c093550bd5a9f4dfed4078.tar.gz |
unit-test: fix test_crypto when USE_COMP is not defined
This unit-test did not consider the case when USE_COMP is not defined,
thus generating a compiler error.
Adapt the test to the case when no compression is available.
Cc: Arne Schwabe <arne@rfc2549.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220121144313.24961-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23628.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_tests/openvpn/test_crypto.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/openvpn/test_crypto.c index 19ce174..4fa9680 100644 --- a/tests/unit_tests/openvpn/test_crypto.c +++ b/tests/unit_tests/openvpn/test_crypto.c @@ -278,38 +278,41 @@ test_occ_mtu_calculation(void **state) linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1440); - /* --secret, cipher BF-CBC, auth SHA1 */ + /* secret, cipher BF-CBC, auth SHA1 */ o.ciphername = "BF-CBC"; o.authname = "SHA1"; linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1444); - /* --secret, cipher BF-CBC, auth SHA1, tcp-client */ + /* secret, cipher BF-CBC, auth SHA1, tcp-client */ o.ce.proto = PROTO_TCP_CLIENT; linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1446); o.ce.proto = PROTO_UDP; - /* --secret, comp-lzo yes, cipher BF-CBC, auth SHA1 */ +#if defined(USE_COMP) o.comp.alg = COMP_ALG_LZO; + + /* secret, comp-lzo yes, cipher BF-CBC, auth SHA1 */ linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1445); - /* --secret, comp-lzo yes, cipher BF-CBC, auth SHA1, fragment 1200 */ + /* secret, comp-lzo yes, cipher BF-CBC, auth SHA1, fragment 1200 */ o.ce.fragment = 1200; linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1449); o.comp.alg = COMP_ALG_UNDEF; o.ce.fragment = 0; +#endif /* TLS mode */ o.shared_secret_file = NULL; o.tls_client = true; o.pull = true; - /* tls client, cipher AES-128-CBC, auth SHA1, tls-auth*/ + /* tls client, cipher AES-128-CBC, auth SHA1, tls-auth */ o.authname = "SHA1"; o.ciphername = "AES-128-CBC"; o.tls_auth_file = "dummy"; @@ -346,8 +349,10 @@ test_occ_mtu_calculation(void **state) assert_int_equal(linkmtu, 1449); - /* tls client, auth SHA1, cipher AES-256-GCM, fragment, comp-lzo yes */ +#if defined(USE_COMP) o.comp.alg = COMP_ALG_LZO; + + /* tls client, auth SHA1, cipher AES-256-GCM, fragment, comp-lzo yes */ o.ce.fragment = 1200; linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1454); @@ -356,6 +361,7 @@ test_occ_mtu_calculation(void **state) o.ce.socks_proxy_server = "socks.example.com"; linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1464); +#endif gc_free(&gc); } |