From patchwork Wed Feb 28 02:52:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joost Rijneveld X-Patchwork-Id: 253 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id A6XlM4q0llqXTAAAIUCqbw for ; Wed, 28 Feb 2018 08:54:18 -0500 Received: from proxy1.mail.ord1d.rsapps.net ([172.30.191.6]) by director12.mail.ord1d.rsapps.net (Dovecot) with LMTP id CTQrA4q0llqeNAAAIasKDg ; Wed, 28 Feb 2018 08:54:18 -0500 Received: from smtp22.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.ord1d.rsapps.net with LMTP id oEGQM4q0llptdwAAasrz9Q ; Wed, 28 Feb 2018 08:54:18 -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: smtp22.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=joostrijneveld.nl; dmarc=none (p=nil; dis=none) header.from=joostrijneveld.nl X-Classification-ID: de302e10-1c8e-11e8-8053-5254001a15c2-1-1 Received: from [216.105.38.7] ([216.105.38.7:47921] helo=lists.sourceforge.net) by smtp22.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 C1/E4-03666-984B69A5; Wed, 28 Feb 2018 08:54:18 -0500 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.89) (envelope-from ) id 1er2AH-001fHK-TB; Wed, 28 Feb 2018 13:53:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1er2AG-001fH0-Na for openvpn-devel@lists.sourceforge.net; Wed, 28 Feb 2018 13:53:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=oeAZgYFGfoQgMmjhZ6gUdE000kkxhycw83cGrwaT8pk=; b=cBvFofb2BJhPsd8CNdEBKqdcZ3 +naEdOIyi3KjXTxgOK0vvInMXAiu57C9wGgkkGgGUsYZM4aLCL8RK7PdZkjMv2R/ocmxKHs/uf9VT /AYP9KnjsFMOBFjxY4PLP1cX0IkMnJCJKwVljb04pZ8WpZp0iLqYA7ljb/HUyfI2BbtY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=oeAZgYFGfoQgMmjhZ6gUdE000kkxhycw83cGrwaT8pk=; b=g7UvsUcR5Joz8Zc34Dc84XfagJ j18Rj8AKi3BAHNGvyi4LvH/Gqb5AyrshNzp7hjup3/Emd8anZesHfHXFEF4AtSwwMnMNK4OcrZY7g N8rPuFNYu3QcywnXfGhthQd4UDffmZGO101Hl2tVUJX1gSSQCnjN2a8oM7fffVE+fmvA=; Received: from sfi-lb-mx.v20.lw.sourceforge.com ([172.30.20.201] helo=kili.joostrijneveld.nl) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) id 1er2AA-008513-Pn for openvpn-devel@lists.sourceforge.net; Wed, 28 Feb 2018 13:53:00 +0000 Received: from localhost.localdomain (ip-145-116-153-56.wlan-int.ru.nl [145.116.153.56]) by kili.joostrijneveld.nl (Postfix) with ESMTPSA id 7701041E46; Wed, 28 Feb 2018 14:52:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=joostrijneveld.nl; s=kili201505; t=1519825968; bh=W2Dq8qmX1lQARB/nDwCpbIE7fxfivZwd3hI1V7o9qA8=; h=From:To:Cc:Subject:Date:From; b=H4GggkWobrPQb9jvch/5nZfjCpGkz6TfO/NCIOkjWwZfeSXJZ/fvfAKa0i8xgsBcb 71z24q/9vPviaRQho5Pg6SbMw3xzqfSPieVoWbhkPql3w2JH+woDkCUaemwYsc4kZ1 R2WliALNh3rTNTweEqk993pHjU5eXQvkXrsoVHFM= From: Joost Rijneveld To: openvpn-devel@lists.sourceforge.net Date: Wed, 28 Feb 2018 14:52:40 +0100 Message-Id: <20180228135240.22945-1-joost@joostrijneveld.nl> X-Mailer: git-send-email 2.16.2 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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: 1er2AA-008513-Pn Subject: [Openvpn-devel] [PATCH] Make return code external tls key match docs 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 In tls_ctx_use_external_private_key, the return codes were inverted compared to what is documented in ssl_backend.h (and what can reasonably be expected). Internally the return code is never checked, so this did not directly result in any change of behavior. Acked-by: Steffan Karger --- src/openvpn/ssl_mbedtls.c | 6 +++--- src/openvpn/ssl_openssl.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 3906cd55..8e31980a 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -630,7 +630,7 @@ tls_ctx_use_external_private_key(struct tls_root_ctx *ctx, if (ctx->crt_chain == NULL) { - return 0; + return 1; } ALLOC_OBJ_CLEAR(ctx->external_key, struct external_context); @@ -640,10 +640,10 @@ tls_ctx_use_external_private_key(struct tls_root_ctx *ctx, if (!mbed_ok(mbedtls_pk_setup_rsa_alt(ctx->priv_key, ctx->external_key, NULL, external_pkcs1_sign, external_key_len))) { - return 0; + return 1; } - return 1; + return 0; } #endif /* ifdef MANAGMENT_EXTERNAL_KEY */ diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index d91458b0..8ef68ebd 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -1327,11 +1327,11 @@ tls_ctx_use_external_private_key(struct tls_root_ctx *ctx, goto err; } #endif /* OPENSSL_VERSION_NUMBER > 1.1.0 dev */ - return 1; + return 0; err: crypto_msg(M_FATAL, "Cannot enable SSL external private key capability"); - return 0; + return 1; } #endif /* ifdef MANAGMENT_EXTERNAL_KEY */