From patchwork Thu Jan 20 18:22:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 2247 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend41.mail.ord1d.rsapps.net with LMTP id ILYwA2X87mFWLAAAqwncew (envelope-from ) for ; Mon, 24 Jan 2022 14:22:13 -0500 Received: from proxy3.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id cLDFD2X87mHkNgAApN4f7A (envelope-from ) for ; Mon, 24 Jan 2022 14:22:13 -0500 Received: from smtp35.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.ord1d.rsapps.net with LMTPS id 2BRtD2X87mFQWQAA7WKfLA (envelope-from ) for ; Mon, 24 Jan 2022 14:22:13 -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: smtp35.gate.ord1d.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; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: ee8ef662-7d4a-11ec-a9be-525400a7b7b4-1-1 Received: from [216.105.38.7] ([216.105.38.7:41722] helo=lists.sourceforge.net) by smtp35.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id FC/2A-19503-46CFEE16; Mon, 24 Jan 2022 14:22:13 -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 1nC4uB-0006bh-Uq; Mon, 24 Jan 2022 19:21:30 +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 1nC4uB-0006bU-2J for openvpn-devel@lists.sourceforge.net; Mon, 24 Jan 2022 19:21:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=ALXWsR8s9qOT+pQfLhbHz5lTaUGKbQ1+PUbhCOxMkfI=; b=WtbyIcbMAJACJi9jGUx41e1P3p mLZnH+/SIMuQpMjteK5VFCDd8LD7KD/BXhm0+55UAXKQuRZC2jWI1tmYEeCWymqcYAyJRqr6zeNZi s3OWPVXu2BmGXl6LOIvf6Sh0C0hkEJGxFwhl6We1M3qlZbX2ZUHtarOhbLZuROlCg148=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To :MIME-Version:Content-Type:Content-Transfer-Encoding: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=ALXWsR8s9qOT+pQfLhbHz5lTaUGKbQ1+PUbhCOxMkfI=; b=ZwxtvK/Qh2pNW/fQZb2GDbjjf8 1j07UyRd5h03V6u66A6tTTIugIhAgOutuKyJ3YfW4CpGQ+MV+w839gNPjLj/WMKoBsV46CMRxO8q9 Je5XV/NpKqxkLF8UaQs3+S/c3w1Ro3omY1c9IAHHEk2LkEcbY9E2enA+TXAKTrwg/8Bs=; Received: from mail-lj1-f169.google.com ([209.85.208.169]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) id 1nC4u5-00Ay82-7N for openvpn-devel@lists.sourceforge.net; Mon, 24 Jan 2022 19:21:29 +0000 Received: by mail-lj1-f169.google.com with SMTP id t7so5359296ljc.10 for ; Mon, 24 Jan 2022 11:21:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ALXWsR8s9qOT+pQfLhbHz5lTaUGKbQ1+PUbhCOxMkfI=; b=h7RMFxmu0hap5HYx3TDpq8a3sVCeaBdlr1tcIXLh/MU5B3V2PilE8D8HA06fW21jmA CtAhT/rIDBztKXNvnCwZiDqx6P1P/IQS9ry5Pz3j5nIhxQNwPa/5NM8Q2meKlPlYxxs1 9XPvPf2TF7FxDGZEK5/Spq+I6SXWPqcxgtuPnCvodi5W3bKQvGz9+APZPKBVn36y/y4s e3nQJ5aNcxcFbvbzagLvOu9IwkiNFtxQqy3kaaoIsrh0S6hllxUEgx1Pcd1x6JPaSIsJ bNYASod/Zerd2sPrfvEWj8w3hmx+u6UHBaCr87yH7VhgCE2Civ+RBqkFYO0SJlhzcGQK SdrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ALXWsR8s9qOT+pQfLhbHz5lTaUGKbQ1+PUbhCOxMkfI=; b=jpYZbkkSj+h2z5zcEolPj5MIe56iafuECCccW1uYzLLHCfjydHJRkjG67YN8peDp2W ny1ug46fJ/u+ijMCOpYGyWNKVGMuTDP/2yNzRAQjdMGgPfXtluxWrT2AXoxGg33JDZ/k 5bIqT/ZIM2+M9eQHzSDa1qEdzFaBSS1N+IEMnh0LIPwDawuu15v+fjRtCqduxTPczymR FVgU3oB8q1OTOxEr9sffXJTf/HjXWat8Ea6VOIaEgVez0HpksKYQjvT/YwNKywBOw4Yk HBXRL2S2Rk2IKisPc98PKb1aBRHmWka2Jm0amtdkRClPIVjJ4M5LFP27Fl+o7OgAFa8L 6VJw== X-Gm-Message-State: AOAM530HIps2jQ6hwNlo+8D4NccH1Pe97qz3xGMLCYeY8YF/INc9W9AP sPYM17gW5ULgH04Q6MxyBDmXyn2e0Jk= X-Google-Smtp-Source: ABdhPJxrvOmAr7kFkWnFMWZv/wyfxFQsLli/89LUT6+YptcUAFbthkJ+OFrtZkElmVP+HdMqUFNVXw== X-Received: by 2002:a2e:9909:: with SMTP id v9mr1566205lji.227.1643052078487; Mon, 24 Jan 2022 11:21:18 -0800 (PST) Received: from LAPTOP-4L3N7KFS.localdomain (81-175-157-115.bb.dnainternet.fi. [81.175.157.115]) by smtp.gmail.com with ESMTPSA id k4sm973202lja.46.2022.01.24.11.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 11:21:18 -0800 (PST) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Fri, 21 Jan 2022 07:22:58 +0200 Message-Id: <20220121052259.508-2-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220121052259.508-1-lstipakov@gmail.com> References: <20220121052259.508-1-lstipakov@gmail.com> 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: Lev Stipakov - use sizeof(void *) since msvc doesn't support sizeof of function ptr - use XKEY_PROV_PROPS macro instead of props since msvc requires constant expression in aggregate initializers 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 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [lstipakov[at]gmail.com] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.169 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.208.169 listed in list.dnswl.org] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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 X-Headers-End: 1nC4u5-00Ay82-7N Subject: [Openvpn-devel] [PATCH 1/2] xkey: fix msvc 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: , Cc: Lev Stipakov MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov - use sizeof(void *) since msvc doesn't support sizeof of function ptr - use XKEY_PROV_PROPS macro instead of props since msvc requires constant expression in aggregate initializers Signed-off-by: Lev Stipakov Acked-by: Selva Nair Signed-off-by: Lev Stipakov <lev@openvpn.net>
--- src/openvpn/xkey_helper.c | 4 ++-- src/openvpn/xkey_provider.c | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/openvpn/xkey_helper.c b/src/openvpn/xkey_helper.c index c667f7be..50231335 100644 --- a/src/openvpn/xkey_helper.c +++ b/src/openvpn/xkey_helper.c @@ -125,8 +125,8 @@ xkey_load_generic_key(OSSL_LIB_CTX *libctx, void *handle, EVP_PKEY *pubkey, {"xkey-origin", OSSL_PARAM_UTF8_STRING, (char *) origin, 0, 0}, {"pubkey", OSSL_PARAM_OCTET_STRING, &pubkey, sizeof(pubkey), 0}, {"handle", OSSL_PARAM_OCTET_PTR, &handle, sizeof(handle), 0}, - {"sign_op", OSSL_PARAM_OCTET_PTR, (void **) &sign_op, sizeof(sign_op), 0}, - {"free_op", OSSL_PARAM_OCTET_PTR, (void **) &free_op, sizeof(free_op), 0}, + {"sign_op", OSSL_PARAM_OCTET_PTR, (void **) &sign_op, sizeof(void *), 0}, + {"free_op", OSSL_PARAM_OCTET_PTR, (void **) &free_op, sizeof(void *), 0}, {NULL, 0, NULL, 0, 0}}; /* Do not use EVP_PKEY_new_from_pkey as that will take keymgmt from pubkey */ diff --git a/src/openvpn/xkey_provider.c b/src/openvpn/xkey_provider.c index c2d560c5..115b9931 100644 --- a/src/openvpn/xkey_provider.c +++ b/src/openvpn/xkey_provider.c @@ -44,9 +44,6 @@ #include #include -/* propq set all on all ops we implement */ -static const char *const props = XKEY_PROV_PROPS; - /* A descriptive name */ static const char *provname = "OpenVPN External Key Provider"; @@ -592,9 +589,9 @@ static const OSSL_DISPATCH ec_keymgmt_functions[] = { }; const OSSL_ALGORITHM keymgmts[] = { - {"RSA:rsaEncryption", props, rsa_keymgmt_functions, "OpenVPN xkey RSA Key Manager"}, - {"RSA-PSS:RSASSA-PSS", props, rsa_keymgmt_functions, "OpenVPN xkey RSA-PSS Key Manager"}, - {"EC:id-ecPublicKey", props, ec_keymgmt_functions, "OpenVPN xkey EC Key Manager"}, + {"RSA:rsaEncryption", XKEY_PROV_PROPS, rsa_keymgmt_functions, "OpenVPN xkey RSA Key Manager"}, + {"RSA-PSS:RSASSA-PSS", XKEY_PROV_PROPS, rsa_keymgmt_functions, "OpenVPN xkey RSA-PSS Key Manager"}, + {"EC:id-ecPublicKey", XKEY_PROV_PROPS, ec_keymgmt_functions, "OpenVPN xkey EC Key Manager"}, {NULL, NULL, NULL, NULL} }; @@ -1074,8 +1071,8 @@ static const OSSL_DISPATCH signature_functions[] = { }; const OSSL_ALGORITHM signatures[] = { - {"RSA:rsaEncryption", props, signature_functions, "OpenVPN xkey RSA Signature"}, - {"ECDSA", props, signature_functions, "OpenVPN xkey ECDSA Signature"}, + {"RSA:rsaEncryption", XKEY_PROV_PROPS, signature_functions, "OpenVPN xkey RSA Signature"}, + {"ECDSA", XKEY_PROV_PROPS, signature_functions, "OpenVPN xkey ECDSA Signature"}, {NULL, NULL, NULL, NULL} };