From patchwork Mon Oct 8 10:41:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 520 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id uDXNMHDPu1uhAQAAIUCqbw for ; Mon, 08 Oct 2018 17:43:12 -0400 Received: from proxy9.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id IOWmMHDPu1vNSQAAfY0hYg ; Mon, 08 Oct 2018 17:43:12 -0400 Received: from smtp4.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy9.mail.ord1d.rsapps.net with LMTP id ACL4MHDPu1tdKAAA7h+8OQ ; Mon, 08 Oct 2018 17:43:12 -0400 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: smtp4.gate.ord1c.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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 26f040b4-cb43-11e8-a177-0024e87f2f2c-1-1 Received: from [216.105.38.7] ([216.105.38.7:60169] helo=lists.sourceforge.net) by smtp4.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id A9/5C-12262-F6FCBBB5; Mon, 08 Oct 2018 17:43:11 -0400 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.90_1) (envelope-from ) id 1g9dHc-0003pk-UY; Mon, 08 Oct 2018 21:41:44 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1g9dHb-0003pd-Dr for openvpn-devel@lists.sourceforge.net; Mon, 08 Oct 2018 21:41:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding: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=nOfq0zE023JD5woH9kcHqCMnuFcOKQuE3zgmPFkA8MQ=; b=kEDchcPGcAsJsy/wcrIJ5zt6pI RoFo3vVX2AR76vrkcGKsLK3KCsTUGwUhmkHCp4GJ3V/vRcOQuDcsyjQX8GpWxtpCJREzvXulhAZj5 2Au33NZSWYgT5u7iUO/YNYcL1P0N+rZg8w4mykAtjhh6QbxbLDiYa+HzaSgk2SGD5BVQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding: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=nOfq0zE023JD5woH9kcHqCMnuFcOKQuE3zgmPFkA8MQ=; b=QGjNRrO4GpS82RPesvh4FzdC58 96ZBuvw62YphyeVEch/HE/QtMwaNPgM5ikrmaQc6G1TIegwX8SuZe/RMHQkNuuL9tSiDCfccnaa5v WYOvCveEXZ+qyUAu43O+b2sMjcs2SjWnfR1czht38hQnb9m2OSsdR1oBxIvihitqFi2E=; Received: from [192.26.174.232] (helo=mail.blinkt.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1g9dHX-00F7Qd-Ua for openvpn-devel@lists.sourceforge.net; Mon, 08 Oct 2018 21:41:43 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1g9dHH-000AkD-Bl for openvpn-devel@lists.sourceforge.net; Mon, 08 Oct 2018 23:41:23 +0200 Received: (nullmailer pid 10864 invoked by uid 10006); Mon, 08 Oct 2018 21:41:23 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Mon, 8 Oct 2018 23:41:23 +0200 Message-Id: <20181008214123.10819-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 1.0 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1g9dHX-00F7Qd-Ua Subject: [Openvpn-devel] [PATCH] Refuse mbed TLS external key with non RSA certificates 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 current API that we use (mbedtls_pk_setup_rsa_alt) only allows using RSA keys with the external API. Using an EC, mbed TLS and external key in OpenVPN will fail very late with a rather obscure error message. Instead fail early and provide a clear message that only RSA keys are supported. Signed-off-by: Arne Schwabe Acked-by: Steffan Karger --- src/openvpn/ssl_mbedtls.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 3e97a329..95061d6d 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -604,6 +604,13 @@ tls_ctx_use_external_signing_func(struct tls_root_ctx *ctx, return 1; } + if (mbedtls_pk_get_type(&ctx->crt_chain->pk) != MBEDTLS_PK_RSA) + { + msg (M_WARN, "ERROR: external key with mbed TLS requires a " + "certificate with an RSA key."); + return 1; + } + ctx->external_key.signature_length = mbedtls_pk_get_len(&ctx->crt_chain->pk); ctx->external_key.sign = sign_func; ctx->external_key.sign_ctx = sign_ctx;