From patchwork Fri Jan 21 03:43:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2241 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director13.mail.ord1d.rsapps.net ([172.27.255.51]) by backend41.mail.ord1d.rsapps.net with LMTP id IkOJILPG6mHWcAAAqwncew (envelope-from ) for ; Fri, 21 Jan 2022 09:44:03 -0500 Received: from proxy7.mail.iad3a.rsapps.net ([172.27.255.51]) by director13.mail.ord1d.rsapps.net with LMTP id cIjuLLPG6mE9JgAA91zNiA (envelope-from ) for ; Fri, 21 Jan 2022 09:44:03 -0500 Received: from smtp52.gate.iad3a ([172.27.255.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy7.mail.iad3a.rsapps.net with LMTPS id 2J+9JLPG6mHYcQAAnPvY+A (envelope-from ) for ; Fri, 21 Jan 2022 09:44:03 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp52.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 9324a666-7ac8-11ec-9d10-525400a7d0a1-1-1 Received: from [216.105.38.7] ([216.105.38.7:59064] helo=lists.sourceforge.net) by smtp52.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 10/22-26848-2B6CAE16; Fri, 21 Jan 2022 09:44:03 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nAv8C-0001RX-Mi; Fri, 21 Jan 2022 14:43:11 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nAv8B-0001RQ-4v for openvpn-devel@lists.sourceforge.net; Fri, 21 Jan 2022 14:43:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=am8RYJYhBb9IbBr+0zxpWaRlqZL8Yf+yki7ZFfYCiEA=; b=lM08Cd6rs4su8e3phmE9PJpp+r FpIqLm/7x28ZeNltmcfy9T+6kyQtXlfIIHss2sdqTkqHbzMl6bkXkfAcnSNmByVyYVLqVU49yBoM9 AKh6M4LI36/t2U1lP+5ri0y4uFjZ5LuofMbIClm1HC0FZj1jEXJN/8hjkQEhwxMo9vQ4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=am8RYJYhBb9IbBr+0zxpWaRlqZL8Yf+yki7ZFfYCiEA=; b=WEYVsASrp5s342ppQmtMgVJTZq NohtoM23frGctRQQ/HbVl58FF788YP9c4KP7fRsDR7fSNotV5Uf3gpTGkCSLEp88qEW03WcVZnA3J SsDvb5HErh9SxGWtiHT1717FyhZ138k2Xhzxs9ahTE+yiv3Fg7Ew0KS06tFKYbrDuBf0=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1nAv88-0008So-MV for openvpn-devel@lists.sourceforge.net; Fri, 21 Jan 2022 14:43:09 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 21 Jan 2022 15:43:13 +0100 Message-Id: <20220121144313.24961-1-a@unstable.cc> In-Reply-To: <20220121140941.13930-1-a@unstable.cc> References: <20220121140941.13930-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 Signed-off-by: Antonio Quartulli --- Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1nAv88-0008So-MV Subject: [Openvpn-devel] [PATCH v3] unit-test: fix test_crypto when USE_COMP is not defined X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox 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 Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- v2: * restore original MTU numbers - this can be addressed by another patch v3: * skip *ALL* tests assuming encryption enabled tests/unit_tests/openvpn/test_crypto.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/openvpn/test_crypto.c index 19ce174e..4fa96806 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); }