From patchwork Thu Jan 28 23:47:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1584 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 with LMTP id QDRWOv7nE2DXNAAAIUCqbw (envelope-from ) for ; Fri, 29 Jan 2021 05:48:30 -0500 Received: from proxy13.mail.ord1d.rsapps.net ([172.30.191.6]) by director12.mail.ord1d.rsapps.net with LMTP id MLRPOv7nE2BPQgAAIasKDg (envelope-from ) for ; Fri, 29 Jan 2021 05:48:30 -0500 Received: from smtp19.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy13.mail.ord1d.rsapps.net with LMTPS id IDj1Of7nE2DYZAAAgjf6aA (envelope-from ) for ; Fri, 29 Jan 2021 05:48:30 -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: smtp19.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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 85615906-621f-11eb-bff9-525400d67fa8-1-1 Received: from [216.105.38.7] ([216.105.38.7:33916] helo=lists.sourceforge.net) by smtp19.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id D7/1B-04193-CF7E3106; Fri, 29 Jan 2021 05:48:29 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RJY-0005hG-M8; Fri, 29 Jan 2021 10:47:44 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RJW-0005h7-G4 for openvpn-devel@lists.sourceforge.net; Fri, 29 Jan 2021 10:47:42 +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: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PZYdmWfnrlAIJhjYDrEZTOpKE+kR31svAbT9syLOv8Y=; b=UxR1ly0HkHu3UngAJVJsktcLHP xN4iWANtRN+D/ERY1dNDpjkzpNsK1Dh4SyrPCAJfIrkTTzQ7SXJHQMkvDXoGpzrAKiNfZjbNM+EiO OKNvBYrhO+bB9liYHY9YwBlXM3SrSWRKprgUufgrRpvmnERqV7w8xJHJfk722jhr+M0I=; 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: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PZYdmWfnrlAIJhjYDrEZTOpKE+kR31svAbT9syLOv8Y=; b=Xj0f4p3bd9gT3Ya/4Xu+RUsAsW cuN9b+Q/KoeAQO+Y+r/ZBUsXTxtB+MveTL2/bUaGF2f6HNy6Wu8hbdXcDvNkZjAIaI/M/Sm69KkoH Z+dgbxTOY7Hpc4rtGnvDL/7srGYL1cQFtda3mi7MhAwT0YiMtiBf+zghI6yabm+4Yr9E=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1l5RJA-000vW1-1b for openvpn-devel@lists.sourceforge.net; Fri, 29 Jan 2021 10:47:42 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1l5RIz-00060N-2s for openvpn-devel@lists.sourceforge.net; Fri, 29 Jan 2021 11:47:09 +0100 Received: (nullmailer pid 7528 invoked by uid 10006); Fri, 29 Jan 2021 10:47:08 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Fri, 29 Jan 2021 11:47:08 +0100 Message-Id: <20210129104708.7484-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: 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 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 0.0 TIME_LIMIT_EXCEEDED Exceeded time limit / deadline X-Headers-End: 1l5RJA-000vW1-1b Subject: [Openvpn-devel] [PATCH v2 4/5] Check return values in md_ctx_init and hmac_ctx_init 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 Without this OpenVPN will later segfault on a FIPS enabled system due to the algorithm available but not allowed. Patch V2: Use (!func) instead (func != 1) Signed-off-by: Arne Schwabe --- src/openvpn/crypto_openssl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index c60d4a54..e124a7b6 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -954,7 +954,10 @@ md_ctx_init(EVP_MD_CTX *ctx, const EVP_MD *kt) ASSERT(NULL != ctx && NULL != kt); EVP_MD_CTX_init(ctx); - EVP_DigestInit(ctx, kt); + if (!EVP_DigestInit(ctx, kt)) + { + crypto_msg(M_FATAL, "EVP_DigestInit failed"); + } } void @@ -1011,7 +1014,10 @@ hmac_ctx_init(HMAC_CTX *ctx, const uint8_t *key, int key_len, ASSERT(NULL != kt && NULL != ctx); HMAC_CTX_reset(ctx); - HMAC_Init_ex(ctx, key, key_len, kt, NULL); + if (!HMAC_Init_ex(ctx, key, key_len, kt, NULL)) + { + crypto_msg(M_FATAL, "HMAC_Init_ex failed"); + } /* make sure we used a big enough key */ ASSERT(HMAC_size(ctx) <= key_len); @@ -1032,7 +1038,10 @@ hmac_ctx_size(const HMAC_CTX *ctx) void hmac_ctx_reset(HMAC_CTX *ctx) { - HMAC_Init_ex(ctx, NULL, 0, NULL, NULL); + if(!HMAC_Init_ex(ctx, NULL, 0, NULL, NULL)) + { + crypto_msg(M_FATAL, "HMAC_Init_ex failed"); + } } void