From patchwork Wed Dec 7 01:10:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Becker X-Patchwork-Id: 2890 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:622a:418d:b0:3a5:7962:c21f with SMTP id cd13csp2609947qtb; Tue, 6 Dec 2022 17:11:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf72A4vubykQxe/2IXT2YWoHtlZqFIJxDz3mq5LwALP5G/JaQlxPxj1k4fxYlM53ABym7eWs X-Received: by 2002:a17:903:214c:b0:189:b5a3:8144 with SMTP id s12-20020a170903214c00b00189b5a38144mr26301237ple.100.1670375484144; Tue, 06 Dec 2022 17:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670375484; cv=none; d=google.com; s=arc-20160816; b=EZvinZMWGY1n1il/1IFbzYM3l5RULQi3F2D3VPXNq3cYtEtjS3eyvBYwERcwWZz9I1 ZHAXAtUYQSog1ys9JtBCsF+GuX5OEdbet3yOy/i4VxCr2QptJoExfadJhOGdu7t9Wi7b +VJKAjrch+5d6h0B+eAh502yeeYckLnhbTaRzMXZpLfE3azW7MFQekpR3A+vTY1pu5Mv l2x4LV5HrwjcYgx6x25KRe7OhU/EUuH0lacizjqZqbXvcw7hYqSyMXhK39A8W4cDwcl0 BfjmagKitL+q5AISyh88jAJ8AitXw4+UsqshD74EUQp9NV0Qw2KXo97Q7bwr2mjqKptf avwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:reply-to:from:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:in-reply-to:references:to:content-language :mime-version:date:message-id:dkim-signature:dkim-signature; bh=OlqzfiGfFH/JPjIcDmWQHRCsrrRUOYayCZq4E4PU6X4=; b=g6NAa/8B0/PrDOs9t3M1JrRolIZYr+x6K/55E8ZX/eJWeRfv8fPn7/ziPLAs9cys7v hJ+PhhAD6E4p2SHh9oaMENTSk4PKizisrjswT8bpctEgbg48ma1I34dOSdKA4eaZuVQ1 Y7ugu1kOOBotlsw2pMdsz4E+q0+7yVLRnTSuw2F8IxwgHoDOa1Eey+KIhrQ/V0fkzWla izDuWd6CZ9YaIl/IWiYXLZZ9ORFwhnEwp9yCiQhcg9R16K++rCGNSaNLjvk0cyx/yFdj qftW46n5HI/OEhST1KFRM4m93rS6noca38xqdPNXwTuDk0UZLltei0Ok0v35RFkVjPDu H95w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="NDdE/LDJ"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=C3jInl18; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id b10-20020a6541ca000000b00478831ab0b0si7582832pgq.121.2022.12.06.17.11.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2022 17:11:24 -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="NDdE/LDJ"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=C3jInl18; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net 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 1p2ixb-0001IL-Kp; Wed, 07 Dec 2022 01:10:55 +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 1p2ixa-0001IF-2R for openvpn-devel@lists.sourceforge.net; Wed, 07 Dec 2022 01:10:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: References:To:From:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: 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=+Liovg2otSXwLnq0Xk80iRZnVU7BCRINa6gcwYGrqyI=; b=NDdE/LDJ0lVsZ8ljDkSrKNpqSx P2N1rRhvmlo1Jap/mIZ8+ntdc+ig9XRa5Yh5ujcoZpAZs53Fq8M2cZDmkYHqSaswzLewXvIascgnV an2yNbpZ+nbsJxTwCJfsSixY2Gol6c33Zfwx01MVm2f/mDsbgJ6b7rPnqIGD+Ep6dEw8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:To:From: Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: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=+Liovg2otSXwLnq0Xk80iRZnVU7BCRINa6gcwYGrqyI=; b=C3jInl185D7dAYcQzf9N6ALCwD Ffu2maDt3hL/V3jBxivnMSVqJVCm1NV5/4m7BGf77eiyw9rON4x8ELMgQxOcr8tJ9/RUC21s1Uk7t z4+RxayXY1SNthoTV1hpQSa8hZJl1/CHloKimeVgrPjJjbCA6MvJbw2wi+3h89OEpSug=; Received: from mail.astos.de ([217.110.68.46]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1p2ixV-0001dr-D7 for openvpn-devel@lists.sourceforge.net; Wed, 07 Dec 2022 01:10:53 +0000 Message-ID: Date: Wed, 7 Dec 2022 02:10:42 +0100 MIME-Version: 1.0 Content-Language: de-DE, en-US To: openvpn-devel@lists.sourceforge.net References: <1386e3cc-fc65-aa68-fa88-3639f6aec5a2@astos.de> In-Reply-To: <1386e3cc-fc65-aa68-fa88-3639f6aec5a2@astos.de> X-Spam-Score: 0.0 (/) 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: in case of absolute library path, search origin for dependencies --- src/openvpn/pkcs11.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) needs https://github.com/OpenSC/pkcs11-helper/pull/59 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: 1p2ixV-0001dr-D7 Subject: [Openvpn-devel] [PATCH 3/3] special handling for PKCS11 providers on win32 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: , X-Patchwork-Original-From: Marc Becker via Openvpn-devel From: Marc Becker Reply-To: Marc Becker Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1751515643436800510?= X-GMAIL-MSGID: =?utf-8?q?1751515643436800510?= in case of absolute library path, search origin for dependencies --- src/openvpn/pkcs11.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) needs https://github.com/OpenSC/pkcs11-helper/pull/59 PKCS11H_PROVIDER_PROPERTY_ALLOW_PROTECTED_AUTH, &allow_protected_auth, sizeof(allow_protected_auth))) != CKR_OK) { @@ -422,7 +428,13 @@ pkcs11_addProvider( { msg(M_WARN, "PKCS#11: Cannot set provider properties '%s' %ld-'%s'", provider, rv, pkcs11h_getMessage(rv)); } - +#if defined(PKCS11H_PROVIDER_PROPERTY_LOADER_FLAGS) + if (loader_flags + && (rv = pkcs11h_setProviderProperty(provider, PKCS11H_PROVIDER_PROPERTY_LOADER_FLAGS, &loader_flags, sizeof(loader_flags))) != CKR_OK) + { + msg(M_WARN, "PKCS#11: Cannot set alternative loader flags '%s' %ld-'%s'", provider, rv, pkcs11h_getMessage(rv)); + } +#endif if ((rv = pkcs11h_initializeProvider(provider)) != CKR_OK) { pkcs11h_removeProvider(provider); diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c index 6ef26eb0..65693aed 100644 --- a/src/openvpn/pkcs11.c +++ b/src/openvpn/pkcs11.c @@ -406,7 +406,13 @@ pkcs11_addProvider( { PKCS11H_BOOL allow_protected_auth = protected_auth; PKCS11H_BOOL cert_is_private = cert_private; - + unsigned loader_flags = 0; +#if defined(_WIN32) + if (platform_absolute_pathname(provider)) + { + loader_flags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR; + } +#endif if (allow_protected_auth && (rv = pkcs11h_setProviderProperty(provider,