From patchwork Sat Feb 4 00:45:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 3046 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp1545502dyk; Fri, 3 Feb 2023 16:45:46 -0800 (PST) X-Google-Smtp-Source: AK7set9lRmHGAI42QDzOZ3MoCx2DOpciI5Z6XHMj+LpAz/708G2tCRWdYw8NkcouHAKiKMoZQcAi X-Received: by 2002:a17:902:f355:b0:196:8cd2:15b1 with SMTP id q21-20020a170902f35500b001968cd215b1mr9411430ple.37.1675471546284; Fri, 03 Feb 2023 16:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675471546; cv=none; d=google.com; s=arc-20160816; b=J2W8uiWKyENT6uBKQyvTtVVAI7M9AkAe+bARnI8Y4iYQUgQaRdAi4mwWSdn/FoOQoA Oz7azEmyEAYC0X2aGeyzGHsJSOjZaAgvinDZWXg2NRTKoHBcV8hRdRoCEuTPhFAl0jHi JGFtr4dI6mVsxmM3i0Djof0Xbq1dy/AMdbq5HqSdIdu36zMzZ4i0XTRYt0xVqIqP0TGM MtkcrJ/9FeiDhkpahtB5Zp05MnNQxI9bd+owd2TWYc0in5SZVmTVSXpskjZu5FmYZZAD WQ8qyFh566t33Gnwp0u+CGf2gVfAkWVkrjVzx03Fv5yWyan9TdXMXNvBu6i9WpRNNgt1 Kfyw== 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=Iz08y+sTVtPsuhEm/Oux3Fx/BmHl4Q61I3wFRvpIY0g=; b=fgF7fJO4BaTUbffReMve7kNkl6UTcTRlWs2a91DdzZA8YZWgsxtAk5NEqSjn7TvZdV x7EMej9xLO03BCmsYghIP5mtC2pO0Ujns3Toz1wi9KIAA7XOsQoyHNMEkDeYwSQIkEQw RKAWscdtOMoChUb4Ia+qvxb/unuD6ofdKqTVqc2vFGY8ANVmvPoCrHKgs9fPidYSqGP0 jb0wAqq1yw20QSsL2dlVwDEki6mY7+qbbsJ/7+R8sg8SKjIyth+q8mRUP7jPUHMMTQ6i OtpmDg5cgtydU3jCZIpu2VELNlwfZRS/nuBr7XbjXbvtaWlNjEOa/cvPZwrCuCIZiX4K BRcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=nKQP+cOV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=R8tsiJwa; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=mBiq6c0C; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id d10-20020a056a00198a00b0058de2a3162esi4959897pfl.273.2023.02.03.16.45.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2023 16:45:46 -0800 (PST) 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=nKQP+cOV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=R8tsiJwa; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=mBiq6c0C; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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.95) (envelope-from ) id 1pO6gH-0007z6-UJ; Sat, 04 Feb 2023 00:45:25 +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.95) (envelope-from ) id 1pO6gG-0007yz-UB for openvpn-devel@lists.sourceforge.net; Sat, 04 Feb 2023 00:45: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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6A6kd/QkkSX9CvHfLkpNqmxA08k6LLAWbGAPkD4UkQE=; b=nKQP+cOVbRh9TNlQubDVl2FIOt H8TQSACd0qGF1n6E73zlnxJpVVtDDuUtIXfSHtXO+bygTRGhvfwAHacZEE+VERm/dkFk2PMDhrBxB Uqsa9M768ZW534AaVEnwIrsJJ+mvLxFD5gi3nD68H+Z1w0JW668Zy6QMd81YaHXkkEUU=; 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: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=6A6kd/QkkSX9CvHfLkpNqmxA08k6LLAWbGAPkD4UkQE=; b=R 8tsiJwaqidl2OEtIUAeA4pwjG6SMgjNquasZHgmsfOmdXxSH4YSUvt9zIekZk4b6VTbMVS2jfU6cA XuKH3vodbdquXd5lv6MLyc2tlPIk9YCm82jZyP0F4cNfrVea+/vGyem6n4AsES9dtE0NOpEQh/krD 64gahHCEYlmZM1mw=; Received: from mail-il1-f173.google.com ([209.85.166.173]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pO6gF-00Afcu-Gl for openvpn-devel@lists.sourceforge.net; Sat, 04 Feb 2023 00:45:24 +0000 Received: by mail-il1-f173.google.com with SMTP id k12so2774240ilv.10 for ; Fri, 03 Feb 2023 16:45:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6A6kd/QkkSX9CvHfLkpNqmxA08k6LLAWbGAPkD4UkQE=; b=mBiq6c0CarlgzB6p5Ilh/xA/QTOiwLMPmeVNaiefyQrRDnZfBClxXx+f0qdodeiX12 xTWp7YmCWI6LM2JH0PvuIg579YKbAQxfolJFt8u1KyWHb5780xNqDGwsk7EJilXmnclW 6H3DAQpO3njDyt40zYh96M7QOqG+CId4NfvMoDB4czlvTKgNciw5oiqXKjB1ZQzuEGrx IvXbv8OwgWIFg7u0vFNpFwNWDAJCuBFJsrTvu8PzZC82yWQ/kPH1x4HDMOFpfkNGWxnx Lgz3DfmJ1AbtayoH1ABKgqwxmAh4sjIAAJB6jRajpvNejPXv+FlL4lsGAAH0qlUAy0SN Ze5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6A6kd/QkkSX9CvHfLkpNqmxA08k6LLAWbGAPkD4UkQE=; b=o2jQUF5q2z8NugjglkURK/lvjsmR5DcE0x56U5kfdYCgNUK6w8sQZquCbD+OKKBqd6 8hRg23v0rQQjLVRzjdzxuRBAVnAB/yfmQDGjaFUn6mrWIfb/krT8es2Zdd4aWOADa0VV An+3pPDCCPi5wHsqPwJaXNIidmucSZ56Izc3AiLIdEg328E/fjCzZNEO7KhypZIM9eXI Rip/cjbPTBQm1BgjAMf/KzG2C3ARnUIBrehSFuSpRp4HCkgPI/SVJmkXyaaOW6fPifn2 Opzf/zIVQYv2av0PaRATrBhPU+quCjAjwOFll8dS5q+qBCfAoQmSnVk/h8GtJ4am5EwV dK+w== X-Gm-Message-State: AO0yUKWHn/kDI67GLE+oXK9ug8FjenZdVyKsxLiOcr+Ghty5bz3ik8g7 ksbnfk3WCpwMGI8PxzyRAF70SRUZMP0= X-Received: by 2002:a05:6e02:1746:b0:30d:bf1a:b174 with SMTP id y6-20020a056e02174600b0030dbf1ab174mr10112350ill.1.1675471517654; Fri, 03 Feb 2023 16:45:17 -0800 (PST) Received: from uranus.sansel.ca (bras-vprn-tnhlon4053w-lp130-01-70-51-222-66.dsl.bell.ca. [70.51.222.66]) by smtp.gmail.com with ESMTPSA id l3-20020a056e021c0300b0031109a23893sm1222745ilh.23.2023.02.03.16.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 16:45:17 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Fri, 3 Feb 2023 19:45:10 -0500 Message-Id: <20230204004512.250271-1-selva.nair@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Score: -0.2 (/) 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: From: Selva Nair - Eliminates repeated warnings such as warning: source file '$(openvpn_srcdir)/env_set.c' is in a subdirectory, but option 'subdir-objects' is disabled - Enabled only for automake >= 1.16 as older ver [...] Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.173 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.173 listed in wl.mailspike.net] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1pO6gF-00Afcu-Gl Subject: [Openvpn-devel] [PATCH 1/3] Conditionally add subdir-objects option to automake 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?1756859251887118167?= X-GMAIL-MSGID: =?utf-8?q?1756859251887118167?= From: Selva Nair - Eliminates repeated warnings such as warning: source file '$(openvpn_srcdir)/env_set.c' is in a subdirectory, but option 'subdir-objects' is disabled - Enabled only for automake >= 1.16 as older versions have a buggy implementation of this option Main side effect of this option is that object files like openvpnserv-blockdns.o are now created in src/openvpn where block-dns.c resides instead of in src/openvpnserv. Same for object files for sources from $(openvpn_srcdir) compiled into test executables. See also past discussion on this topic: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00013.html Signed-off-by: Selva Nair Acked-By: Arne Schwabe --- configure.ac | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 91500087..95d795c3 100644 --- a/configure.ac +++ b/configure.ac @@ -54,9 +54,22 @@ m4_define([serial_tests], [ awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}' ]) ]) + +dnl Automake 1.14+ warns if sources are in sub-directories but subdir-objects +dnl options is not enabled. However, automake before 1.15a has a bug that causes +dnl variable expansion to fail in foo_SOURCES when this option is used. +dnl As most of our build systems are now likely to use automake 1.16+ add a +dnl work around to conditionally add subdir-objects option. +m4_define([subdir_objects], [ + m4_esyscmd([automake --version | + head -1 | + awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 16) { print "subdir-objects" }}' + ]) +]) + # This foreign option prevents autoreconf from overriding our COPYING and # INSTALL targets: -AM_INIT_AUTOMAKE(foreign serial_tests 1.9) dnl NB: Do not [quote] this parameter. +AM_INIT_AUTOMAKE(foreign serial_tests subdir_objects 1.9) dnl NB: Do not [quote] this parameter. AC_CANONICAL_HOST AC_USE_SYSTEM_EXTENSIONS From patchwork Sat Feb 4 00:45:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 3048 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp1545504dyk; Fri, 3 Feb 2023 16:45:46 -0800 (PST) X-Google-Smtp-Source: AK7set9HyXtgA1+tGsxeNnUuBbOgWUlFBH9zery944fDlo0OrrsPnMTp670f3jKCccInB1rxLl4g X-Received: by 2002:a05:6a20:1455:b0:be:d4d:81bb with SMTP id a21-20020a056a20145500b000be0d4d81bbmr7226416pzi.53.1675471546487; Fri, 03 Feb 2023 16:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675471546; cv=none; d=google.com; s=arc-20160816; b=crhYZu0oKAyTvx3CEOjsMI0qDwe2iY35kaIDwkeR4enFsnBRYsh1MSL4zeHoXl99Sh CPmn1hABB8yn5yCGe3RKoF1TKsBAsqJE9K8nEWKbiA2IFWFmh+yzzODvcr/l3p9mlo48 wcbDJVbUJ1hn1gvEbSLBZIROjahbkVGeJ1l7OCMWXXmwMT40uSZPBV3voUeIBctdVovq mikKT6L+HllEN4JXMAkazBsnQOodvaJ9dHmE9ddxpLk4oY1Vz9Wpq96TJWSVpBoGGesS +KOCbGL7hrW3O6YgKE7CqeYRgCGRI4JBgaBTLJpKn00L/eNUK6MzhhXMCcYk0E2kCqH8 5v8Q== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=gN8YYEBrDR/O3SAKOKi7/OdmZvYKD9M7NFs7aUyKIcw=; b=yonjgXTogdDKan3NE3Bn9qn8yUJZ9WaSpgp7qf8s/C5mAhN0kicdtRUbVepuCn2jyz pieHgwDJLhDkLOWg2Yqd13xnJq6KWZEp+EHab3zT4WKWEUX9PzLsWZjGi0UPQqJuJWw9 EmmB2bgwHUI4HxgfVfeV+58eT3Yw9GKUGD2P/xaacTDVZI/1OsEpodKEW42d43EXxUv2 F23qIlqZkKPVSPboGwaphIopuaFq+nxPQQC/Y4Zz0l3S1Y0cvZUL1F/utXdpYUHmuOXJ lz7CHm++m8Hmbxnb4g2b9slepgMCEokUfUaIxqMgprggfhoWaBkXcG0ECYkFawrp65xt eyZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=cMN50o5A; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dCe100AL; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=i78Ctkhn; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id m3-20020a637103000000b004ce0ead7aabsi4025183pgc.302.2023.02.03.16.45.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2023 16:45:46 -0800 (PST) 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=cMN50o5A; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=dCe100AL; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=i78Ctkhn; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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.95) (envelope-from ) id 1pO6gN-0002f0-8I; Sat, 04 Feb 2023 00:45:29 +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.95) (envelope-from ) id 1pO6gM-0002eq-5a for openvpn-devel@lists.sourceforge.net; Sat, 04 Feb 2023 00:45:28 +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=AJvCsOdnVXflbecGylNzPMWaoiNedQL+E/INegcKl+I=; b=cMN50o5AkhfeFvM2FtBfIjtRR9 xysQnliBY0wo1ERZtb07okj+km21bGx74vRqcaGku7DFoWzcDYMj/D7E7JeSiS2xLbzmKuu8QtDzh gRtu0IlXeWTtWR7NVBi0r1UT9SmkRTLYbieNlVHkPEV46p94xM8xxQI3O2a0xFd4zT70=; 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=AJvCsOdnVXflbecGylNzPMWaoiNedQL+E/INegcKl+I=; b=dCe100ALKVarxfFhzrxICmODO+ JLrCR2xpMStam2ks7ZVG8KBgPtq6d8PJzYpfVkNq9XBj7EZ3UA0b3UJlBhjQghG3vabXzlNMLORew AeXD5qNS9t4dWGGT1XRG8ru7r4mAElZ/YPDMMpBRHwZAXl+u/MPimOQ2wBh7PN/wzTvU=; Received: from mail-il1-f171.google.com ([209.85.166.171]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pO6gG-0008Qd-KP for openvpn-devel@lists.sourceforge.net; Sat, 04 Feb 2023 00:45:28 +0000 Received: by mail-il1-f171.google.com with SMTP id u7so2778229ilg.4 for ; Fri, 03 Feb 2023 16:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AJvCsOdnVXflbecGylNzPMWaoiNedQL+E/INegcKl+I=; b=i78CtkhnhXcMFk//5v2hfyX96gYV9Ps0Rlqiwr3/8xD6f/1niAP18X30yusvchAbFS tqO4xjdPuOjTi0wdlIMLF/9rmx722Qi8Q/6pdRIOM5U74DjMIqrKz1bi9nmHcVD9Hg2p pdDYKm2DBMHUfOySbD35doxsSukLkgjh214DHydZWKaIWn8XQSY1KqxfdF5Z9RLegiXG FICcTU0d0OpQI1auyskxwZ9vbiNzWghqvc7KoeveX1M08TVValxh55P7ZA8LgDludBfd hjSbKl4vrl+JYRRfjeiYvjlkBPRZyWWhPllV0jo3SJKaoVFtSN5G+smuiylXlenV/9/g Y2gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AJvCsOdnVXflbecGylNzPMWaoiNedQL+E/INegcKl+I=; b=IQsDz2ukcumuLk6oeq4d9CiWSvKmEMn9gyk1c+nVHwSfs0g9sfBgPfWnrN3dsOAsKN AXB0U34veukFgEyBlj596Um2am4z47uv6Fv+T8hmbWEH+d2TYYUvxfWlGBnT++fu1Jr0 6FWNEhEmTkQSh201GRDy4HS01XW8xtyy0Hc2iA2aQ9y5HzEAwxmojNE5BtMLLHWn1rrE jXc2/a/U6N++n1wCliZNQ8HgD5oYCbpfePjoNH81hvSrijs1Wdc06ZXmXrPP002CmIZZ nHz8EI6XZFq5sDHgmGwmpG1VbqvQK/b/SPjn3Gg7iNebmq1zhsHPQX2/Cn/OLkQqMFeO LXrA== X-Gm-Message-State: AO0yUKU0YAt6ukpfn1z+xeWHAoS4M7fDjzh65V5d0tDce4bnGZCR6MM3 I2XG+/WHTg0P5Ngt6XX/v1//HhLGcM4= X-Received: by 2002:a92:d285:0:b0:313:b17e:aa4f with SMTP id p5-20020a92d285000000b00313b17eaa4fmr195546ilp.0.1675471519558; Fri, 03 Feb 2023 16:45:19 -0800 (PST) Received: from uranus.sansel.ca (bras-vprn-tnhlon4053w-lp130-01-70-51-222-66.dsl.bell.ca. [70.51.222.66]) by smtp.gmail.com with ESMTPSA id l3-20020a056e021c0300b0031109a23893sm1222745ilh.23.2023.02.03.16.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 16:45:19 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Fri, 3 Feb 2023 19:45:11 -0500 Message-Id: <20230204004512.250271-2-selva.nair@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230204004512.250271-1-selva.nair@gmail.com> References: <20230204004512.250271-1-selva.nair@gmail.com> MIME-Version: 1.0 X-Spam-Score: -0.2 (/) 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: From: Selva Nair - Minor changes to the build system to include some dependencies for Windows build - test_tls_crypt not built as it will pull in win32.c and its dependencies Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.171 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.171 listed in wl.mailspike.net] -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_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1pO6gG-0008Qd-KP Subject: [Openvpn-devel] [PATCH 2/3] Build unit tests in mingw Windows build 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?1756859252319732427?= X-GMAIL-MSGID: =?utf-8?q?1756859252319732427?= From: Selva Nair - Minor changes to the build system to include some dependencies for Windows build - test_tls_crypt not built as it will pull in win32.c and its dependencies - If cross-compiling, "make check" will only build the tests but not run any. Copy to Windows and run manually. Executables are in /tests/unit_tests/openvpn/.libs/ and these depend on cmocka.dll in addition to openssl libs that some tests link to. Building with mingw on Windows should run the tests (untested). Signed-off-by: Selva Nair --- configure.ac | 2 ++ tests/Makefile.am | 2 ++ tests/unit_tests/example_test/Makefile.am | 2 ++ tests/unit_tests/openvpn/Makefile.am | 35 +++++++++++++++++------ 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 95d795c3..66ba6f38 100644 --- a/configure.ac +++ b/configure.ac @@ -364,6 +364,8 @@ case "$host" in ;; esac +AM_CONDITIONAL([CROSS_COMPILING], test "${cross_compiling}" = "yes") + PKG_PROG_PKG_CONFIG AC_PROG_CPP AC_PROG_INSTALL diff --git a/tests/Makefile.am b/tests/Makefile.am index 87dd7e17..a46f2573 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,10 +14,12 @@ MAINTAINERCLEANFILES = \ SUBDIRS = unit_tests +if !WIN32 test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh if HAVE_SITNL test_scripts += t_net.sh endif +endif TESTS_ENVIRONMENT = top_srcdir="$(top_srcdir)" TESTS = $(test_scripts) diff --git a/tests/unit_tests/example_test/Makefile.am b/tests/unit_tests/example_test/Makefile.am index 04a5ad35..24eb0ba1 100644 --- a/tests/unit_tests/example_test/Makefile.am +++ b/tests/unit_tests/example_test/Makefile.am @@ -2,7 +2,9 @@ AUTOMAKE_OPTIONS = foreign check_PROGRAMS = example_testdriver example2_testdriver +if !CROSS_COMPILING TESTS = $(check_PROGRAMS) +endif example_testdriver_CFLAGS = @TEST_CFLAGS@ example_testdriver_LDFLAGS = @TEST_LDFLAGS@ diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index 7720a85d..909ac4e2 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -7,20 +7,29 @@ test_binaries += argv_testdriver buffer_testdriver endif test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver +pkt_testdriver if HAVE_LD_WRAP_SUPPORT +if !WIN32 test_binaries += tls_crypt_testdriver endif +endif test_binaries += provider_testdriver -TESTS = $(test_binaries) -check_PROGRAMS = $(test_binaries) +if WIN32 +test_binaries += cryptoapi_testdriver +LDADD = -lws2_32 +endif if HAVE_SITNL -check_PROGRAMS += networking_testdriver +test_binaries += networking_testdriver endif +if !CROSS_COMPILING +TESTS = $(test_binaries) +endif +check_PROGRAMS = $(test_binaries) + openvpn_includedir = $(top_srcdir)/include openvpn_srcdir = $(top_srcdir)/src/openvpn compat_srcdir = $(top_srcdir)/src/compat @@ -31,12 +40,14 @@ argv_testdriver_SOURCES = test_argv.c mock_msg.c mock_msg.h \ mock_get_random.c \ $(openvpn_srcdir)/platform.c \ $(openvpn_srcdir)/buffer.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/argv.c buffer_testdriver_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir) buffer_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(openvpn_srcdir) -Wl,--wrap=parse_line buffer_testdriver_SOURCES = test_buffer.c mock_msg.c mock_msg.h \ mock_get_random.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/platform.c crypto_testdriver_CFLAGS = @TEST_CFLAGS@ \ @@ -51,6 +62,7 @@ crypto_testdriver_SOURCES = test_crypto.c mock_msg.c mock_msg.h \ $(openvpn_srcdir)/packet_id.c \ $(openvpn_srcdir)/platform.c \ $(openvpn_srcdir)/mtu.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/mss.c packet_id_testdriver_CFLAGS = @TEST_CFLAGS@ \ @@ -63,14 +75,14 @@ packet_id_testdriver_SOURCES = test_packet_id.c mock_msg.c mock_msg.h \ $(openvpn_srcdir)/packet_id.c \ $(openvpn_srcdir)/platform.c \ $(openvpn_srcdir)/reliable.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/session_id.c - pkt_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) pkt_testdriver_LDFLAGS = @TEST_LDFLAGS@ pkt_testdriver_SOURCES = test_pkt.c mock_msg.c mock_msg.h \ -$(openvpn_srcdir)/argv.c \ + $(openvpn_srcdir)/argv.c \ $(openvpn_srcdir)/base64.c \ $(openvpn_srcdir)/buffer.c \ $(openvpn_srcdir)/crypto.c \ @@ -84,9 +96,10 @@ $(openvpn_srcdir)/argv.c \ $(openvpn_srcdir)/run_command.c \ $(openvpn_srcdir)/session_id.c \ $(openvpn_srcdir)/ssl_pkt.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/tls_crypt.c - +if !WIN32 tls_crypt_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ \ @@ -106,6 +119,7 @@ tls_crypt_testdriver_SOURCES = test_tls_crypt.c mock_msg.c mock_msg.h \ $(openvpn_srcdir)/packet_id.c \ $(openvpn_srcdir)/platform.c \ $(openvpn_srcdir)/run_command.c +endif if HAVE_SITNL networking_testdriver_CFLAGS = @TEST_CFLAGS@ \ @@ -136,6 +150,7 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \ $(openvpn_srcdir)/buffer.c \ $(openvpn_srcdir)/base64.c \ mock_get_random.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/platform.c auth_token_testdriver_CFLAGS = @TEST_CFLAGS@ \ @@ -152,6 +167,7 @@ auth_token_testdriver_SOURCES = test_auth_token.c mock_msg.c \ $(openvpn_srcdir)/otime.c \ $(openvpn_srcdir)/packet_id.c \ $(openvpn_srcdir)/platform.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/base64.c @@ -169,6 +185,8 @@ ncp_testdriver_SOURCES = test_ncp.c mock_msg.c \ $(openvpn_srcdir)/otime.c \ $(openvpn_srcdir)/packet_id.c \ $(openvpn_srcdir)/platform.c \ + $(openvpn_srcdir)/win32-util.c \ + $(compat_srcdir)/compat-strsep.c \ $(openvpn_srcdir)/ssl_util.c misc_testdriver_CFLAGS = @TEST_CFLAGS@ \ @@ -177,8 +195,9 @@ misc_testdriver_CFLAGS = @TEST_CFLAGS@ \ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c mock_msg.c \ - mock_get_random.c \ + mock_get_random.c \ $(openvpn_srcdir)/buffer.c \ $(openvpn_srcdir)/options_util.c \ $(openvpn_srcdir)/ssl_util.c \ + $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/platform.c From patchwork Sat Feb 4 00:45:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 3047 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp1545501dyk; Fri, 3 Feb 2023 16:45:46 -0800 (PST) X-Google-Smtp-Source: AK7set8NTENUMRXQybfv90+aG0P1uLW7xbtGHy1dJZ8pDrBGZm5HgYuXzkF8gSVfykUHxMgppOmB X-Received: by 2002:a17:90a:195e:b0:22b:ecea:8b1b with SMTP id 30-20020a17090a195e00b0022becea8b1bmr12751726pjh.45.1675471546279; Fri, 03 Feb 2023 16:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675471546; cv=none; d=google.com; s=arc-20160816; b=N6ygB3u3YVrNbPtB5rgHNF/5wRcrMvdObt32Jj08890CkPDBtpRw1zm/7veNxvGp9w YNPvCkqgqm52esc48uFBBVnqYxaFTpkdXpf0JB7Gn7opZj4WqLtWIspF2rntzkmImLR4 FYJ6tkdby/O4lfeAvpJ7geEdk3tDZ5Haza8UYVyv1K940loofmvtX4UhBG3PQGeMnO2m RLLnCHucYDiDIWUSdvW4NtIbzyMeJPYTOxQuXbgEz02VnRf5CkQpVysw5DFnWfQ8Tsp0 oGeDShkk6xYOHjGeLUURRoP57BkaM/gfc4qg/x7n5cu4eNZM8wWJ1RGlXqEl9RJ0y9q/ VPLQ== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=ZYehaQeU1nqLtnL0C4JLqH1EbkQCVB3QWkVC8fY1BYA=; b=g0gIpyP7TE1lmt4FXJw/bFCYHmEchfVPi00akK2f8kwRdMyXzV4wvI7uktb+Ip8xPa zW8FT3mwDqort0cY2uXfSPU35sno/eA5iMvvFtQVO27XZ/HS+Q38LtApsRcU3NI1qfjE SnCiBnZ2xPA4uG+0rWR7iAlEQzswaBDXFniRQZK6FbNG3XR0lDfg9sAu4am3dQ7hBH4s Z8e1qc62l57s8UB8QU2wghwfYFV8Y6WiwVycXjEyIPeGa6T3TExKmdicIJepg+0X40u4 kRvSNOkd9Jp8YZM/scq2bX3yJCoeHRtGNbqh5HqKAiXJ1TbXMMpVDEx3+0hP9D4yg3Rd KE9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=WnpZqcUJ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=SOkCAkU2; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=VagrrZUB; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id o5-20020a17090ad24500b0022bfcb7ba8dsi9434513pjw.21.2023.02.03.16.45.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2023 16:45:46 -0800 (PST) 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=WnpZqcUJ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=SOkCAkU2; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=VagrrZUB; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pO6gM-0003GW-O3; Sat, 04 Feb 2023 00:45:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pO6gL-0003GL-8h for openvpn-devel@lists.sourceforge.net; Sat, 04 Feb 2023 00:45:28 +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=8Km2ie7voBTHDs+gutloVLYum34PeZ25zNDxjNDWUnc=; b=WnpZqcUJzEBggXCrT753bYE998 3XwGss+CDq8J0kOio2xBWnQMSw6gtf48C46ighcVyOjXhUpwNJ/4nDDfE41XerUEzgw0FTiGqmgqa lOXIMlD8VXC2YT8emQk5/8bOojM+PGbL3S6WPfl7MxfVxY/QaECOgdrkkCM5rrkHwOB8=; 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=8Km2ie7voBTHDs+gutloVLYum34PeZ25zNDxjNDWUnc=; b=SOkCAkU2BdhZp/qq9TX5X+n+AN cyQMJvNcMTN2q/NeY5D8UlUCyv4y/p+cL1MpF/LgsruQk4Ot+nc8cLaNfIqWuaWo4X2LVr2/oRxpV BtevROi0kEcW10lI48oZwnHXBUYRkb5mvBvfnHVxX0jlxIQlwwUVY6tsmE1t1sY0g5fQ=; Received: from mail-il1-f173.google.com ([209.85.166.173]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1pO6gI-0008Qe-02 for openvpn-devel@lists.sourceforge.net; Sat, 04 Feb 2023 00:45:28 +0000 Received: by mail-il1-f173.google.com with SMTP id i17so2766388ils.11 for ; Fri, 03 Feb 2023 16:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8Km2ie7voBTHDs+gutloVLYum34PeZ25zNDxjNDWUnc=; b=VagrrZUBKmazephfRvmoUdEfwtk0kZBZ199O0QdlLfrERxHrv3fko+CUg/EOEKdZ8D N6gu8+GSIFsJZhmpFDtUK+dmZcw+ntauSfznHRHsemHpcHxdvCCWJJw8cUeE7kNfh+6C ruSbshcqMRnCFugdAlXKBm1jvvxKZGMhIVT1fRHfMkvDLjP/dhWIosJ/nwQPr4s97QUO QDUpgeQb1twvF5On2StZ+3rnohgw+xmyFTyqjWrePjmA659XUS1PIMIhqIwn9nUQO27c YvftPAdqX0naAcpYq9QudxOnV/Ke1oEaVSUqAtLExm4RkofhYsjRk++OvCD4vR2zYEDh gwfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Km2ie7voBTHDs+gutloVLYum34PeZ25zNDxjNDWUnc=; b=qCK59d5ZHdcBgyswX9iTiZqDrGiYOpglNb8ZXb1TK2mLuybcqWRv1v+8a4dMW0KeHU 7Flee3RjHD/Gxp7BHyr6UOMxN+Y1epQiSYC3uMhv3ZE1FywktjC98EfRvzNmF1kmtG/Z xKG6AUPhMXVIy3NPqTdQvCTDP5mu9/pf/QftJJzlrbw9zb0+bCYlbFAGz8tzUoil0BRk 1P44Oak2XVK3xuTtp+nDv4GvORICw78shM0IxFdvVy9QQOranuq5lUYXpv+Vf6mS4AZ+ YnrwnurqcwLAzkkO08cIMsx1IeEI7MnnxrKL1sUar/xJV52ci2q64UJ4cId9H/XEnBQG XPEg== X-Gm-Message-State: AO0yUKWPauRDYbtNV37kV5rdVFcQi/hwvQM3WR4Uj161ZFaTbGrB5Cs1 uOtbf7q7AgDdtjsFc6qFCzUDw4Fhx58= X-Received: by 2002:a92:ce06:0:b0:310:8c56:d7de with SMTP id b6-20020a92ce06000000b003108c56d7demr6552884ilo.0.1675471520893; Fri, 03 Feb 2023 16:45:20 -0800 (PST) Received: from uranus.sansel.ca (bras-vprn-tnhlon4053w-lp130-01-70-51-222-66.dsl.bell.ca. [70.51.222.66]) by smtp.gmail.com with ESMTPSA id l3-20020a056e021c0300b0031109a23893sm1222745ilh.23.2023.02.03.16.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 16:45:20 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Fri, 3 Feb 2023 19:45:12 -0500 Message-Id: <20230204004512.250271-3-selva.nair@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230204004512.250271-1-selva.nair@gmail.com> References: <20230204004512.250271-1-selva.nair@gmail.com> MIME-Version: 1.0 X-Spam-Score: -0.2 (/) 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: From: Selva Nair - Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More cryptoapi tests coming.. Signed-off-by: Selva Nair --- Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.173 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.173 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1pO6gI-0008Qe-02 Subject: [Openvpn-devel] [PATCH 3/3] Add a unit test for functions in cryptoapi.c 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?1756859251961166630?= X-GMAIL-MSGID: =?utf-8?q?1756859251961166630?= From: Selva Nair - Though named cryptoapi_testdriver, right now this only tests parsing of thumbprint specified as a selector for --cryptioapicert option. More cryptoapi tests coming.. Signed-off-by: Selva Nair --- As requested during review of the 4/4 patch of cryptoapi series. Note that this doesn't currently build with MSVC -- either cross compile on Linux and run the binary on Windows or use mingw to compile on Windows. tests/unit_tests/openvpn/Makefile.am | 15 +++ tests/unit_tests/openvpn/test_cryptoapi.c | 126 ++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 tests/unit_tests/openvpn/test_cryptoapi.c diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index 909ac4e2..0a1ad439 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -153,6 +153,21 @@ provider_testdriver_SOURCES = test_provider.c mock_msg.c \ $(openvpn_srcdir)/win32-util.c \ $(openvpn_srcdir)/platform.c +if WIN32 +cryptoapi_testdriver_CFLAGS = @TEST_CFLAGS@ \ + -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \ + $(OPTIONAL_CRYPTO_CFLAGS) +cryptoapi_testdriver_LDFLAGS = @TEST_LDFLAGS@ \ + $(OPTIONAL_CRYPTO_LIBS) -lcrypt32 -lncrypt +cryptoapi_testdriver_SOURCES = test_cryptoapi.c mock_msg.c \ + $(openvpn_srcdir)/xkey_helper.c \ + $(openvpn_srcdir)/buffer.c \ + $(openvpn_srcdir)/base64.c \ + $(openvpn_srcdir)/platform.c \ + mock_get_random.c \ + $(openvpn_srcdir)/win32-util.c +endif + auth_token_testdriver_CFLAGS = @TEST_CFLAGS@ \ -I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \ $(OPTIONAL_CRYPTO_CFLAGS) diff --git a/tests/unit_tests/openvpn/test_cryptoapi.c b/tests/unit_tests/openvpn/test_cryptoapi.c new file mode 100644 index 00000000..2bea3f42 --- /dev/null +++ b/tests/unit_tests/openvpn/test_cryptoapi.c @@ -0,0 +1,126 @@ +/* + * OpenVPN -- An application to securely tunnel IP networks + * over a single UDP port, with support for SSL/TLS-based + * session authentication and key exchange, + * packet encryption, packet authentication, and + * packet compression. + * + * Copyright (C) 2023 Selva Nair + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 2 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#elif defined(_MSC_VER) +#include "config-msvc.h" +#endif + +#include "syshead.h" +#include "manage.h" +#include "integer.h" +#include "xkey_common.h" + +#if defined(HAVE_XKEY_PROVIDER) && defined (ENABLE_CRYPTOAPI) +#include +#include +#include +#include +#include +#include + +#include +#include /* pull-in the whole file to test static functions */ + +struct management *management; /* global */ + +/* mock a management function that xkey_provider needs */ +char * +management_query_pk_sig(struct management *man, const char *b64_data, + const char *algorithm) +{ + (void) man; + (void) b64_data; + (void) algorithm; + return NULL; +} + +/* tls_libctx is defined in ssl_openssl.c which we do not want to compile in */ +OSSL_LIB_CTX *tls_libctx; + +#ifndef _countof +#define _countof(x) sizeof((x))/sizeof(*(x)) +#endif + +/* test data */ +static const uint8_t test_hash[] = { + 0x77, 0x38, 0x65, 0x00, 0x1e, 0x96, 0x48, 0xc6, 0x57, 0x0b, 0xae, + 0xc0, 0xb7, 0x96, 0xf9, 0x66, 0x4d, 0x5f, 0xd0, 0xb7 +}; + +/* valid test strings to test with and without embedded and trailing spaces */ +static const char *valid_str[] = { + "773865001e9648c6570baec0b796f9664d5fd0b7", + " 77 386500 1e 96 48 c6570b aec0b7 96f9664d5f d0 b7", + " 773865001e9648c6570baec0b796f9664d5fd0b7 ", +}; + +/* some invalid strings to test with and without embedded and trailing spaces */ +static const char *invalid_str[] = { + "773 865001e9648c6570baec0b796f9664d5fd012", /* space within byte */ + "77:38:65001e9648c6570baec0b796f9664d5fd0b7", /* invalid separator */ + "7738x5001e9648c6570baec0b796f9664d5fd0b7", /* non hex character */ +}; + +static void +test_parse_hexstring(void **state) +{ + unsigned char hash[255]; + (void) state; + + for (int i = 0; i < _countof(valid_str); i++) + { + int len = parse_hexstring(valid_str[i], hash, _countof(hash)); + assert_int_equal(len, sizeof(test_hash)); + assert_memory_equal(hash, test_hash, sizeof(test_hash)); + memset(hash, 0, _countof(hash)); + } + + for (int i = 0; i < _countof(invalid_str); i++) + { + int len = parse_hexstring(invalid_str[i], hash, _countof(hash)); + assert_int_equal(len, 0); + } +} + +int +main(void) +{ + const struct CMUnitTest tests[] = { cmocka_unit_test(test_parse_hexstring) }; + + int ret = cmocka_run_group_tests_name("cryptoapi tests", tests, NULL, NULL); + + return ret; +} + +#else /* ifdef HAVE_XKEY_PROVIDER */ + +int +main(void) +{ + return 0; +} + +#endif /* ifdef HAVE_XKEY_PROVIDER */