From patchwork Fri Jun 30 12:39:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3264 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:3c07:b0:d9:b492:11d6 with SMTP id ki7csp2505524dyb; Fri, 30 Jun 2023 05:39:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4mEo9BNIMRJJMaeHvV720ih+3t6mr3i6z0SSxhyHoauGhmMu6buriOyXNmP4QnbPnxc0qG X-Received: by 2002:a05:6870:b604:b0:1b0:37a:97cf with SMTP id cm4-20020a056870b60400b001b0037a97cfmr3120599oab.43.1688128790525; Fri, 30 Jun 2023 05:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688128790; cv=none; d=google.com; s=arc-20160816; b=kzFMGeyMdDmm3mUKUsmTUBdm2yB1Ptag3t5EXTHQVskd4YLfq9yOEcoF3xx9kyVQRb tMP+i9isW6QYN1G78RdK+1t4NiF0M3V74WEgH8+hbEfqjI8E4BAfcqlGKPr0h/BxgCCS zX88SOraCUOZ33vgBpk99IO3RHsF0vIddlCGW1jA2UcblTOTkJxavrxHOC/GsYFdyKZc k+28446F9TAW6ib8XPaojNdwog5nuD0yOCQCdgbA0DO9ArRIiRtxAaK3yva/RlaOsIB/ 2xCHxmN6AiR4/vatvooOrgcfuU+mmfUGwWPpHw4S1YOoz+6FqWJtSl78Q45n/Hm+JIJy Zvxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature; bh=P7a9GXm8b2zfjtXFCSaDrDLhYfmJCzvWsMZC0Xn+xtE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=inUbM5aMRUAI14KJURucrub7RIdaEmIkTxz5Iqrm0RRYs+IUSEbywUh8MzCweclpJ1 AYXGQY8OBzQXDrarzXkpAzrZnQI92bvAZVXY+wjtVErwCDgo2npd3ReI8FDWZ8WjV9Cp K3sBKzNsyM42J9l/gW5QiHIiMX1CM+DKwVoleStjz5+nyXS0NLqlsezjMIcIAlG/pilp 28OjYDLrqGG5pUPcOQ1WMP6wAecpKH9co5Ap9NhMsEtoYeEskSGMkCDaHQQfTg1y1sBn bjdcbc2fcGMDPx0FXjtv1y8d58kkIKAj5ZjLYkJz8YtEEJW8jBAdyXWJPS3MLxG2FDr2 ic9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BDbYwG7Z; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mP346YxE; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=pZ4FTVwp; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id em22-20020a17090b015600b0026359a2e980si2987604pjb.21.2023.06.30.05.39.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2023 05:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BDbYwG7Z; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mP346YxE; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=pZ4FTVwp; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qFDPJ-0000VX-Fw; Fri, 30 Jun 2023 12:39:25 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qFDPH-0000VP-Rd for openvpn-devel@lists.sourceforge.net; Fri, 30 Jun 2023 12:39:24 +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:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Y+dMF9y/T7n2soEkkIgVPlQRnlJoaq/IjbOemm9qOPY=; b=BDbYwG7ZpjboTGWS6XotceghBH sMBCotJ74dz86ow/YrB5eh+nWXAzocWd3oMQYC/6BJAOfZRAiz7GNK7K61sU/JpxVVgCxSTY3xQe8 aejGdmyR3D2Onmj42ZqmWD0wKxsCrGr1BEE+b7uVm1bOlH9ESmv0wLjQITm/obZyKn0s=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Y+dMF9y/T7n2soEkkIgVPlQRnlJoaq/IjbOemm9qOPY=; b=m P346YxEjQVLM9RbeErAtMynbGoroHxJko2spx9K6VOXIB9RIyjijdd4zerPV8gGQqWe+xZrJFgYrH /Rkjyllo0zD6LXbkTV0sFqHv4FLfZPOKEGjX8PNo32/1BjDdSkAKs85pI9vBub3ePcrEyqEuQbWWu VZwx/G0+5D4FAP6g=; Received: from mout-p-202.mailbox.org ([80.241.56.172]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qFDPE-002A4O-E6 for openvpn-devel@lists.sourceforge.net; Fri, 30 Jun 2023 12:39:24 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4QsvyQ4Rd9z9spY for ; Fri, 30 Jun 2023 14:39:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1688128750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Y+dMF9y/T7n2soEkkIgVPlQRnlJoaq/IjbOemm9qOPY=; b=pZ4FTVwpgN6nx18QEVqmGlC7j4YoEe6r3mhOH91+N3fNIgCpZbRGp4ijYgY+kS5YdnaiAp iX7TdYUrZOQgcI3+9NJUebSVPbb02T9JvC0pFF7HphSQ3X416U/revZ7Cx1qxMPBbq4MhP oVBiqYGlmdsN8XuGVaw5phsiKYfEYnidHlS78h2zhyRlNQf2aJUMyO7RjFAIjlvkWg2Gdv ycCtfISgS+6kelhNIOgNCpDeYkup3Ci+/0/hDhf6mC8Ujsyd2RmCIfj2BWrxjdRv2PP/Fq 1Kxpr3uPmheY+NdacC8vUSCvaVPHXGIqudfXRF41xZlZ1Y0h6H+jUWdtTFnGKQ== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Fri, 30 Jun 2023 14:39:08 +0200 Message-Id: <20230630123908.82588-1-frank@lichtenheld.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4QsvyQ4Rd9z9spY X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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: Use the casting variants of mock(). Using the mock_ptr_type fixes an existing bug where test_tls_crypt.c couldn't build in MinGW 32bit: test_tls_crypt.c:127:27: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 127 | const char *pem_str = (const char *) mock(); Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1qFDPE-002A4O-E6 Subject: [Openvpn-devel] [PATCH] test_tls_crypt: Improve mock() usage to be more portable 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1770131334462112271?= X-GMAIL-MSGID: =?utf-8?q?1770131334462112271?= Use the casting variants of mock(). Using the mock_ptr_type fixes an existing bug where test_tls_crypt.c couldn't build in MinGW 32bit: test_tls_crypt.c:127:27: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 127 | const char *pem_str = (const char *) mock(); Change-Id: I6c03313b8677fa07c07e718b1f85f7efd3c4dea8 Signed-off-by: Frank Lichtenheld Acked-By: Arne Schwabe --- tests/unit_tests/openvpn/test_tls_crypt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests/openvpn/test_tls_crypt.c b/tests/unit_tests/openvpn/test_tls_crypt.c index 8bed042f..ed7c7948 100644 --- a/tests/unit_tests/openvpn/test_tls_crypt.c +++ b/tests/unit_tests/openvpn/test_tls_crypt.c @@ -116,7 +116,7 @@ __wrap_buffer_write_file(const char *filename, const struct buffer *buf) check_expected(filename); check_expected(pem); - return mock(); + return mock_type(bool); } struct buffer @@ -124,7 +124,7 @@ __wrap_buffer_read_from_file(const char *filename, struct gc_arena *gc) { check_expected(filename); - const char *pem_str = (const char *) mock(); + const char *pem_str = mock_ptr_type(const char *); struct buffer ret = alloc_buf_gc(strlen(pem_str) + 1, gc); buf_write(&ret, pem_str, strlen(pem_str) + 1);