From patchwork Fri Jan 12 05:48:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Deloget X-Patchwork-Id: 179 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director3.mail.ord1d.rsapps.net ([172.30.191.6]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id 26CGACXnWFoLSgAAgoeIoA for ; Fri, 12 Jan 2018 11:49:41 -0500 Received: from proxy12.mail.ord1d.rsapps.net ([172.30.191.6]) by director3.mail.ord1d.rsapps.net (Dovecot) with LMTP id UjQDACXnWFrrXAAAkXNnRw ; Fri, 12 Jan 2018 11:49:41 -0500 Received: from smtp7.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy12.mail.ord1d.rsapps.net (Dovecot) with LMTP id FGzfDSTnWFp3ZAAA7PHxkg ; Fri, 12 Jan 2018 11:49:41 -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.34.181.88] Authentication-Results: smtp7.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; 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=none (p=nil; dis=none) header.from=free.fr X-Classification-ID: 94ea1cb6-f7b8-11e7-afd3-525400d28ed9-1-1 Received: from [216.34.181.88] ([216.34.181.88:47849] helo=lists.sourceforge.net) by smtp7.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id AB/47-07278-427E85A5; Fri, 12 Jan 2018 11:49:40 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1ea2Vq-0003Lu-JJ; Fri, 12 Jan 2018 16:49:02 +0000 Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1ea2Vo-0003Lh-JF for openvpn-devel@lists.sourceforge.net; Fri, 12 Jan 2018 16:49:00 +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=oLUS4YLVB8Iknv543AgWSxMFnhN5Pssfnpb2rtMM+ng=; b=W4KxeyEcuHZeIs3NUmptCENlQe ov/TZtJr5bMWPX+Eybh8WVMWj0t71orqGBdpNO61kUU+aeyk2hDQPsW6raIxh74vwDbEYqt47bH6f xTCrbEdm2IBwUFFXzbshK3/WDFTwmc7rk6cXUJm1Y/WtC2DQljo+by11SwQotvF5aS/8=; 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=oLUS4YLVB8Iknv543AgWSxMFnhN5Pssfnpb2rtMM+ng=; b=Hmh7nzDTy531BhDCRjnIBTBLTT cgwj8YwLrE2AWIQ3ma3mmSadrClvavjrb/HCcXpPbC/tFvN0av1TJSIys/TzQ3usmzNPc2jhTm88i pvaHoDq/hp0+nmXLdguTZIohjVorBixwLq9u2jvS8Uz+2DCyHD5gtqPM0uXIWLKGnfvA=; Received: from mail-wm0-f66.google.com ([74.125.82.66]) by sfi-mx-1.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1ea2Vn-0001t0-Rx for openvpn-devel@lists.sourceforge.net; Fri, 12 Jan 2018 16:49:00 +0000 Received: by mail-wm0-f66.google.com with SMTP id i11so13010526wmf.4 for ; Fri, 12 Jan 2018 08:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oLUS4YLVB8Iknv543AgWSxMFnhN5Pssfnpb2rtMM+ng=; b=gt7aqBddzRB4GKPhEJz5iDqhmkfqdMBOUQxrCech6dH/z89VxWHMqt6mTTbtgKtgPz sxkLpIs4YbbHyI1eA/1rPOrhwgXmPhduaMANdu/NY1Lzst6bzfVtmMP7SbYo3SLHZYA6 TX+6SQw1lNB8ZTpHMib6ZmJr0FNYcRe8YfCS9DEeWQcpM0tHZf4MtZFNE0qRxZEcUE2w R2tyJ1s8u2hCsYsNAVXuaIdLl0ReJG+6PNmMr3GvzgXFiFFoz+wQz1OrZneozMXdpweF Fl8duFtMfum+aVMstr2gawl3absTv/zUSuZTp9k/v0sT2g2/uBkFuiePA/2Ky/c/t5Rp XWcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=oLUS4YLVB8Iknv543AgWSxMFnhN5Pssfnpb2rtMM+ng=; b=bJSwzcF8cydiMupzPQn4sA67xwpx7SSH1OgHf88+fPrPNP5b1nda9iOB4ELigoLU9t XUM3D20TKHKQBtZBxjMMa1ohXsmpGQIaJetBvgwVPXdwEVazIy5Rlvx9zFWBZ/LfK600 aaygmWIJmBN4t+8ai85DIgQw3KCZBclr/R5Zri5VXLIoHFHMOFgSL0Ja1BPIdCTMMcOZ wJZYwh4Ve/61TI1hYAMPBDUTh3ya79TkGp0Z9DeDctOtXCxlJUiXUiT5gEhY1IMH3sfN +lZ8yLaqhJsQtmUfg6BBSwucEh11PawwXmMNFyvETMQA9acJHEaxgTPm9f73ntItKuZ7 c4LQ== X-Gm-Message-State: AKwxytd8652jQdnL/QhlmmuSAbR4m09r7Dvp2+6iY3Ssd/T/POvvUvjC kFnSPmwBf2UgZN6FyX6TqHbaJlRq X-Google-Smtp-Source: ACJfBotu3sIBG9iwqD/M7hEtWtIBSCI6cYuHYSEn3EUJV/oFbF20ekHrmps2n5WK8jfGiGhaz6JnoQ== X-Received: by 10.28.134.143 with SMTP id i137mr5016625wmd.2.1515775733643; Fri, 12 Jan 2018 08:48:53 -0800 (PST) Received: from edt-thinkpad.eho.intranet ([2a01:cb1c:53c:ce00:144a:841b:886c:3c9c]) by smtp.gmail.com with ESMTPSA id u5sm1606821wmf.47.2018.01.12.08.48.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 08:48:53 -0800 (PST) From: Emmanuel Deloget To: openvpn-devel@lists.sourceforge.net Date: Fri, 12 Jan 2018 17:48:24 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (logout[at]free.fr) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.66 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (emmanueldeloget53[at]gmail.com) 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: 1ea2Vn-0001t0-Rx Subject: [Openvpn-devel] [PATCH 1/3] OpenSSL: check EVP_PKEY key types before returning the pkey 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox The internal EVP_PKEY::pkey member is an union thus we need to check for the real key type before we can return the corresponding RSA, DSA or EC public key. Reported-by: Selva Nair Signed-off-by: Emmanuel Deloget Acked-by: Steffan Karger diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index 70b19aea..8b29cdaf 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -240,7 +240,7 @@ X509_OBJECT_get_type(const X509_OBJECT *obj) static inline RSA * EVP_PKEY_get0_RSA(EVP_PKEY *pkey) { - return pkey ? pkey->pkey.rsa : NULL; + return (pkey && pkey->type == EVP_PKEY_RSA) ? pkey->pkey.rsa : NULL; } #endif @@ -254,7 +254,7 @@ EVP_PKEY_get0_RSA(EVP_PKEY *pkey) static inline EC_KEY * EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) { - return pkey ? pkey->pkey.ec : NULL; + return (pkey && pkey->type == EVP_PKEY_EC) ? pkey->pkey.ec : NULL; } #endif @@ -282,7 +282,7 @@ EVP_PKEY_id(const EVP_PKEY *pkey) static inline DSA * EVP_PKEY_get0_DSA(EVP_PKEY *pkey) { - return pkey ? pkey->pkey.dsa : NULL; + return (pkey && pkey->type == EVP_PKEY_DSA) ? pkey->pkey.dsa : NULL; } #endif From patchwork Fri Jan 12 05:48:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Deloget X-Patchwork-Id: 177 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director6.mail.ord1d.rsapps.net ([172.30.191.6]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id TQKeCCPnWFrLOwAAgoeIoA for ; Fri, 12 Jan 2018 11:49:39 -0500 Received: from proxy8.mail.ord1d.rsapps.net ([172.30.191.6]) by director6.mail.ord1d.rsapps.net (Dovecot) with LMTP id i60zDyPnWFpROwAAhgvE6Q ; Fri, 12 Jan 2018 11:49:39 -0500 Received: from smtp15.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy8.mail.ord1d.rsapps.net (Dovecot) with LMTP id MCkGDyPnWFpZFAAAGdz6CA ; Fri, 12 Jan 2018 11:49:39 -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.34.181.88] Authentication-Results: smtp15.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; 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=none (p=nil; dis=none) header.from=free.fr X-Classification-ID: 93a55974-f7b8-11e7-a424-5254007ab6c8-1-1 Received: from [216.34.181.88] ([216.34.181.88:8304] helo=lists.sourceforge.net) by smtp15.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 19/D8-09219-227E85A5; Fri, 12 Jan 2018 11:49:38 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1ea2Vs-0003MI-Lz; Fri, 12 Jan 2018 16:49:04 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1ea2Vr-0003M7-Gg for openvpn-devel@lists.sourceforge.net; Fri, 12 Jan 2018 16:49:03 +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=OG6Pmy6aXcv6n7iUnZAEpAO9AYJhi87C/4DS7vGfk+s=; b=IXbSgxqQWbsdZTlsVlOshzJXXx IINy0UrBR7A/tnIMNvsB+Tq/jKhu07xHlcEDdsieAPY78TI04W3HJoCPl56AvtX7XlvwymZ5QNTlB qIWsGPx4uHXHrryTjxrXGEXWCw+IW6cAh29nUgNzf+iSk0N9FBMLqaQHQCXA4dIwyeuI=; 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=OG6Pmy6aXcv6n7iUnZAEpAO9AYJhi87C/4DS7vGfk+s=; b=GCABqnVcd1GT9RyuNLQW396JB5 mWzALhLCL+asnv1owWTfZe5Ao7zZD68h7Y+QLwR5b33IeR/mk4VZLEhSh3qtaCyjSCd8s9hqXfwwQ ky9nZulK1V4qOZTMU7NFWs1X5cMvtvP1ZFJA94JhCu1gwqo0DEdY4OAIZxbAeyppQqdQ=; Received: from mail-wm0-f66.google.com ([74.125.82.66]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1ea2Vq-0000vJ-H6 for openvpn-devel@lists.sourceforge.net; Fri, 12 Jan 2018 16:49:03 +0000 Received: by mail-wm0-f66.google.com with SMTP id b76so13134706wmg.1 for ; Fri, 12 Jan 2018 08:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=OG6Pmy6aXcv6n7iUnZAEpAO9AYJhi87C/4DS7vGfk+s=; b=FMu+4Cbz+D5zsbg8LwKoYSUg9wVHkZJeaLY20DhsvW08a1JxS8qnoeQqbus1NcWXkP 2/F2gO4xxbwPD8QX1u2jkdY+JqLz1cQjFmRe/0DdFSFlJlDNNedjdhVqidr55bL1StDI NjvlTUB5QlvRcBCdzHlzVAOf1RRn0A7fLr03gPaXaSPlfn4ptSCmv5mxwApSBveealua I6xDeMVqCrPAtSiDSGOxP02NDWb3gL+OfKgh/ZRNOB4eVCIzDOWNLQAcEcXgYJsj1k9r 8eJCjXt69NqABq56FGZaJ2isKaUShS+Oobt8VNElu6pA4RAYNdMEe62Qs0zreGmxBG0u MdpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=OG6Pmy6aXcv6n7iUnZAEpAO9AYJhi87C/4DS7vGfk+s=; b=tOhOf52ZvLoPGYPTbbG+8oqursJDH7oR/8/ClH7kFqnKFG9zhnypOdbX/fPV3Kw5sF DIjrDW6Bs0VfflLlpMr9X26OK0h4bNqSIOXLdl+fTqOWYnIaunVsJV1olYP24bSYxIFB qKf4RaYB/tId43+swfdJQcfX2gZzr0ahon1aDH32P68PtxXqnUa07iZs1ODmV44gCBom YmSqCx6nzxKWb/Qz19/9rdGBuFLaoi4VqWbtdxVtCVMf69Q8POeHaa5G/QX7nNz1lXJ0 WJNccLmY/5UgmRrYwlYCh/PwWRJy+vSA6vKj1f0WYCTiO+H2Nm5qtgi/DGoejIysSbn9 mShA== X-Gm-Message-State: AKwxytdY/8Zp2XESa4ks4lZRsb6sucRNCJl+p1lMV82cHI6JrLQOfj8N lqE5lZKqjbUNxZjBYCNEMCd5OEx/ X-Google-Smtp-Source: ACJfBosaYC5wQKHLofdssspoBNjbxm3Wv+EanZZNNZMxF2w+oGxyN7K80CwLyPf1AQMd/FXB3He11w== X-Received: by 10.28.140.1 with SMTP id o1mr5031076wmd.27.1515775736312; Fri, 12 Jan 2018 08:48:56 -0800 (PST) Received: from edt-thinkpad.eho.intranet ([2a01:cb1c:53c:ce00:144a:841b:886c:3c9c]) by smtp.gmail.com with ESMTPSA id u5sm1606821wmf.47.2018.01.12.08.48.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 08:48:55 -0800 (PST) From: Emmanuel Deloget To: openvpn-devel@lists.sourceforge.net Date: Fri, 12 Jan 2018 17:48:25 +0100 Message-Id: <3ea860bd412bbc9638cb54ade1a85ee08caf1b42.1515775195.git.logout@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (logout[at]free.fr) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.66 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (emmanueldeloget53[at]gmail.com) 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: 1ea2Vq-0000vJ-H6 Subject: [Openvpn-devel] [PATCH 2/3] OpenSSL: remove some EVP_PKEY type checks 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Calling EVP_KEY_id() before EVP_PKEY_get0_*() is unnecessary as the same check is also performed in the later. We also make the code a bit better by not calling the various EVP_PKEY_get0_*() functions twice (this needs a bit or reordering to avoid introducing yet another #ifndef OPENSSL_NO_EC in the code). Signed-off-by: Emmanuel Deloget diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index 711bba11..9f74acaa 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -1699,22 +1699,13 @@ print_details(struct key_state_ssl *ks_ssl, const char *prefix) EVP_PKEY *pkey = X509_get_pubkey(cert); if (pkey != NULL) { - if ((EVP_PKEY_id(pkey) == EVP_PKEY_RSA) && (EVP_PKEY_get0_RSA(pkey) != NULL)) - { - RSA *rsa = EVP_PKEY_get0_RSA(pkey); - openvpn_snprintf(s2, sizeof(s2), ", %d bit RSA", - RSA_bits(rsa)); - } - else if ((EVP_PKEY_id(pkey) == EVP_PKEY_DSA) && (EVP_PKEY_get0_DSA(pkey) != NULL)) - { - DSA *dsa = EVP_PKEY_get0_DSA(pkey); - openvpn_snprintf(s2, sizeof(s2), ", %d bit DSA", - DSA_bits(dsa)); - } + RSA *rsa = NULL; + DSA *dsa = NULL; #ifndef OPENSSL_NO_EC - else if ((EVP_PKEY_id(pkey) == EVP_PKEY_EC) && (EVP_PKEY_get0_EC_KEY(pkey) != NULL)) + EC *ec = NULL; + + if ((ec = EVP_PKEY_get0_EC_KEY(pkey)) != NULL) { - EC_KEY *ec = EVP_PKEY_get0_EC_KEY(pkey); const EC_GROUP *group = EC_KEY_get0_group(ec); const char* curve; @@ -1726,9 +1717,19 @@ print_details(struct key_state_ssl *ks_ssl, const char *prefix) openvpn_snprintf(s2, sizeof(s2), ", %d bit EC, curve: %s", EC_GROUP_order_bits(group), curve); - - } + } else #endif + if ((rsa = EVP_PKEY_get0_RSA(pkey)) != NULL) + { + openvpn_snprintf(s2, sizeof(s2), ", %d bit RSA", + RSA_bits(rsa)); + } + else if ((dsa = EVP_PKEY_get0_DSA(pkey)) != NULL) + { + openvpn_snprintf(s2, sizeof(s2), ", %d bit DSA", + DSA_bits(dsa)); + } + EVP_PKEY_free(pkey); } X509_free(cert); From patchwork Fri Jan 12 05:48:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Deloget X-Patchwork-Id: 178 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director2.mail.ord1d.rsapps.net ([172.30.191.6]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id G/tDDSTnWFrOMAAAgoeIoA for ; Fri, 12 Jan 2018 11:49:40 -0500 Received: from proxy20.mail.ord1d.rsapps.net ([172.30.191.6]) by director2.mail.ord1d.rsapps.net (Dovecot) with LMTP id gYg5ByTnWFoOEgAAgYhSiA ; Fri, 12 Jan 2018 11:49:40 -0500 Received: from smtp17.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy20.mail.ord1d.rsapps.net (Dovecot) with LMTP id CVPlACTnWFrAVQAAsk8m8w ; Fri, 12 Jan 2018 11:49:40 -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.34.181.88] Authentication-Results: smtp17.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; 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=none (p=nil; dis=none) header.from=free.fr X-Classification-ID: 946d159a-f7b8-11e7-b9ca-5254008de1cb-1-1 Received: from [216.34.181.88] ([216.34.181.88:58963] helo=lists.sourceforge.net) by smtp17.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 72/A3-21774-327E85A5; Fri, 12 Jan 2018 11:49:39 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1ea2Vx-0003NC-OX; Fri, 12 Jan 2018 16:49:09 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1ea2Vv-0003Mm-Qz for openvpn-devel@lists.sourceforge.net; Fri, 12 Jan 2018 16:49:07 +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=/UuiWymnK94NVA17SHmDKU7ybhZLULt96mVlC37p8Yw=; b=cUv1GtgSvnmUfketcJw0X3x39H CEIeMfoFz5+rXrcGnYbeQqa+wk+vuX5m63lIBbsa87ga+KE/apbVMNPk8lxk3DPyn/yswRMFXgqhC tc6z974pra5EToA5Z1mOz9drkuTpFMhfoFb/kx2LwWJ+R+8b+zHEkAVPgXp/HTXOuv6o=; 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=/UuiWymnK94NVA17SHmDKU7ybhZLULt96mVlC37p8Yw=; b=M4lQvugsocYteJLnlz6xc8BQiy zBWSeeTe7t+aBLMUVCnpD6ARz9yp1HCCUYFYelgzxdcb7WJlyUWgNscor8oSkJFhWl2A2ucTXSfqe HtQcEyVk6n6DwqlDnzVw/C2XZUiBwor5H9b+ZZskWZhSCx7Thk32ErGCIfSNWE/gJMks=; Received: from mail-wm0-f67.google.com ([74.125.82.67]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1ea2Vu-0000vQ-53 for openvpn-devel@lists.sourceforge.net; Fri, 12 Jan 2018 16:49:07 +0000 Received: by mail-wm0-f67.google.com with SMTP id i11so13011224wmf.4 for ; Fri, 12 Jan 2018 08:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=/UuiWymnK94NVA17SHmDKU7ybhZLULt96mVlC37p8Yw=; b=MhJK+rcRJzDpbsjh1B2pOGpuMVaHtP49KF9svKAmdmSNXblBKoBWRQ67+iq15RoVFN smg6e3in2UnJikZCam9/rSwvHML6EK45JBu/Cap4ppHc3irhuw962weMTZnqhjPOJ2Ao MKOfRUNcLUsNgZxOhTdfhkFyxrZ1mLv3DVO3gBnHmhEHtpi3Ory98Csc7slf9EHqD5/E 4tuVNJLv4B8CXK7mgwes0CI4p/4rNlXNWl28GEUKRKUM9siTSa3ilHEh4LZHFZKeMrEB 9R+Du9NuoENxBIOq0AkPMArSeSBZAiEFSsWOR2rnHQWG9dd9DZFrmc5cMplmOFPSegLX O0PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=/UuiWymnK94NVA17SHmDKU7ybhZLULt96mVlC37p8Yw=; b=In0TIuwJAmCt1YGkWTgwRQDj/aAKFh/HtgXAemzB5C8iKs/gu4LPGDJxaVoAXhrRA7 o9WvAxx8sMclcCZQ6UGrBtFtB9xmGnAz3jJrkYExT1VfU49rVM2t91i5Vs0lK4A5swAN C3ywDeGvr+dj470v5RgtiuMf6h1UcARrEka80R02uwDA7VWY6iQy4NENd0jcpo9CRii2 mX7btjuzSOu3ecRO0PD6EYVHpb5DSiweV8hVFfaNm1FuxzAUXmwmsh+sW2Io30oZsUnk LWOpksyJzdsmBGrEjEOmaAQL4HKqbnTLnvyC7jnd1jgMb6OEy9X3xNvxjZIBNwYFfAKb tDEQ== X-Gm-Message-State: AKwxytcHWn0pxvagxjymUvaFi2kZLHKCu9HGGKuJ30HfwOVNXEVuZ/IN JLckrXDRDEu4PiKzdFxqawj9GFl1 X-Google-Smtp-Source: ACJfBouqcyfl+hJz9axU+5xNCQf+4RtcvE5BdDuOuyEKHTe43V6PhTRc92Z7jVsQucqqIuRDERrWmw== X-Received: by 10.28.14.133 with SMTP id 127mr4179188wmo.152.1515775739935; Fri, 12 Jan 2018 08:48:59 -0800 (PST) Received: from edt-thinkpad.eho.intranet ([2a01:cb1c:53c:ce00:144a:841b:886c:3c9c]) by smtp.gmail.com with ESMTPSA id u5sm1606821wmf.47.2018.01.12.08.48.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 08:48:59 -0800 (PST) From: Emmanuel Deloget To: openvpn-devel@lists.sourceforge.net Date: Fri, 12 Jan 2018 17:48:26 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (logout[at]free.fr) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.67 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (emmanueldeloget53[at]gmail.com) 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: 1ea2Vu-0000vQ-53 Subject: [Openvpn-devel] [PATCH 3/3] OpenSSL: remove EVP_PKEY_id() 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox The function is no longer used so we don't need to keep it in the OpenSSL 1.1 compatibility layer. Signed-off-by: Emmanuel Deloget Acked-by: Steffan Karger diff --git a/configure.ac b/configure.ac index b4fd1b3f..716b45dc 100644 --- a/configure.ac +++ b/configure.ac @@ -925,7 +925,6 @@ if test "${with_crypto_library}" = "openssl"; then X509_STORE_get0_objects \ X509_OBJECT_free \ X509_OBJECT_get_type \ - EVP_PKEY_id \ EVP_PKEY_get0_RSA \ EVP_PKEY_get0_DSA \ EVP_PKEY_get0_EC_KEY \ diff --git a/src/openvpn/openssl_compat.h b/src/openvpn/openssl_compat.h index 8b29cdaf..2c4a08c1 100644 --- a/src/openvpn/openssl_compat.h +++ b/src/openvpn/openssl_compat.h @@ -258,20 +258,6 @@ EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) } #endif -#if !defined(HAVE_EVP_PKEY_ID) -/** - * Get the PKEY type - * - * @param pkey Public key object - * @return The key type - */ -static inline int -EVP_PKEY_id(const EVP_PKEY *pkey) -{ - return pkey ? pkey->type : EVP_PKEY_NONE; -} -#endif - #if !defined(HAVE_EVP_PKEY_GET0_DSA) /** * Get the DSA object of a public key