From patchwork Fri Jan 21 03:09:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2240 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.27.255.56]) by backend41.mail.ord1d.rsapps.net with LMTP id wOVUCui+6mEhOQAAqwncew (envelope-from ) for ; Fri, 21 Jan 2022 09:10:48 -0500 Received: from proxy12.mail.iad3a.rsapps.net ([172.27.255.56]) by director11.mail.ord1d.rsapps.net with LMTP id qGfxK+i+6mFPbgAAvGGmqA (envelope-from ) for ; Fri, 21 Jan 2022 09:10:48 -0500 Received: from smtp53.gate.iad3a ([172.27.255.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy12.mail.iad3a.rsapps.net with LMTPS id SCdMJui+6mEPfwAAh9K5Vw (envelope-from ) for ; Fri, 21 Jan 2022 09:10:48 -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: smtp53.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: ee3ae3bc-7ac3-11ec-a84f-5254009c3572-1-1 Received: from [216.105.38.7] ([216.105.38.7:57868] helo=lists.sourceforge.net) by smtp53.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 6F/83-29898-8EEBAE16; Fri, 21 Jan 2022 09:10:48 -0500 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nAuc8-0005uo-Aq; Fri, 21 Jan 2022 14:10:02 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nAuc6-0005uG-Lo for openvpn-devel@lists.sourceforge.net; Fri, 21 Jan 2022 14:10:01 +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=LZcLbU4z4kDawhogaV8BOvNhD9yMpQP04ptaF5Rscw8=; b=U0mAyjnAdHx3gOcVIzrylURNrM E6kemxI8604bqokJWrDKTfCEvfoaOlCysI7jHwSb+2/FbYj6uRgBQ3ImJf2c7i0t2MCqZqAoq+twE XZpA0la8aUEZk+9Thbwrjq0wCZrhR1vPNX4K95wTHajY9znrMyGdU7CsT/5LwBA3j6Go=; 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=LZcLbU4z4kDawhogaV8BOvNhD9yMpQP04ptaF5Rscw8=; b=JGeSmdoR+DnOAWcrjtVL9fz3Tf uIhOvuVBOyXfd5S5URtlqBeWyFSjdtb/Tc/n98p/Gbs4NnsxanCDZLgxRGDVlVhv69GxF64jgdwtn oy3tCuQVZZVYST2ad2ujwnKL4ZeZqGmUENZuODh3JcCPs7JSyd4Ar1b5UjX03EEzk2QE=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1nAuc1-006L1z-V3 for openvpn-devel@lists.sourceforge.net; Fri, 21 Jan 2022 14:10:01 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 21 Jan 2022 15:09:41 +0100 Message-Id: <20220121140941.13930-1-a@unstable.cc> In-Reply-To: <20220120101125.31234-1-a@unstable.cc> References: <20220120101125.31234-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_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1nAuc1-006L1z-V3 Subject: [Openvpn-devel] [PATCH v2] 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 --- v2: * restore original MTU numbers - this can be addressed by another patch tests/unit_tests/openvpn/test_crypto.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/openvpn/test_crypto.c index 19ce174e..8aa2fd0f 100644 --- a/tests/unit_tests/openvpn/test_crypto.c +++ b/tests/unit_tests/openvpn/test_crypto.c @@ -278,30 +278,34 @@ 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) + /* secret, comp-lzo yes, cipher BF-CBC, auth SHA1 */ o.comp.alg = COMP_ALG_LZO; linkmtu = calc_options_string_link_mtu(&o, &f); assert_int_equal(linkmtu, 1445); +#endif - /* --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); +#if defined(USE_COMP) o.comp.alg = COMP_ALG_UNDEF; +#endif o.ce.fragment = 0; /* TLS mode */ @@ -309,7 +313,7 @@ test_occ_mtu_calculation(void **state) 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,6 +350,7 @@ test_occ_mtu_calculation(void **state) assert_int_equal(linkmtu, 1449); +#if defined(USE_COMP) /* tls client, auth SHA1, cipher AES-256-GCM, fragment, comp-lzo yes */ o.comp.alg = COMP_ALG_LZO; o.ce.fragment = 1200; @@ -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); }