From patchwork Mon Apr 5 02:28:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1714 X-Patchwork-Delegate: gert@greenie.muc.de Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id QDkpMK8Ca2AabwAAIUCqbw (envelope-from ) for ; Mon, 05 Apr 2021 08:29:35 -0400 Received: from proxy4.mail.ord1d.rsapps.net ([172.30.191.6]) by director11.mail.ord1d.rsapps.net with LMTP id aKsHMK8Ca2BwDwAAvGGmqA (envelope-from ) for ; Mon, 05 Apr 2021 08:29:35 -0400 Received: from smtp24.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.ord1d.rsapps.net with LMTPS id mEbYL68Ca2BcZgAAiYrejw (envelope-from ) for ; Mon, 05 Apr 2021 08:29:35 -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: smtp24.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=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 944e7a74-960a-11eb-ab2d-52540091a1c4-1-1 Received: from [216.105.38.7] ([216.105.38.7:42174] helo=lists.sourceforge.net) by smtp24.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 6C/58-10965-FA20B606; Mon, 05 Apr 2021 08:29:35 -0400 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.92.3) (envelope-from ) id 1lTOLc-0005EN-Rd; Mon, 05 Apr 2021 12:28:52 +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.92.3) (envelope-from ) id 1lTOLY-0005EC-9z for openvpn-devel@lists.sourceforge.net; Mon, 05 Apr 2021 12:28:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: 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=KKjXGrgiX/qX0lvSldAsn8QrxZjBSPdnllg66heX5fI=; b=AzSDSP46KOpLfqOtsoky1tvR4d VP7a0GkbqjAEHjp2qQEqzmWUGf2yynNoyl7yVT1orzzTjBazf9Plf2tKkkqj7pj/DdI4TFFeDWuQM zoVuuGEsaSOWumih+wAIXcF94OOsH5jiOCQZzVL+Sc1a+eYUuryge9dBw9T+6KjPebcE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=KKjXGrgiX/qX0lvSldAsn8QrxZjBSPdnllg66heX5fI=; b=QhzgggKA1EAa8tKdEJitOKmWMT qzC0diP+RG/sSOxzM2OzfCh8IuIE+OInIy8kRaFSvYz/YW5yxEmin74HmwvygPP0Qo/S5URWmDWA1 hFUF3CHDyrkumhc7SwLuz2STFg3VyCQl8rMNACjxwj5MR3UQBEdutpxy+5sXUsxOnq/o=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lTOLQ-004fcY-VW for openvpn-devel@lists.sourceforge.net; Mon, 05 Apr 2021 12:28:48 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Mon, 5 Apr 2021 14:28:27 +0200 Message-Id: <20210405122827.16836-1-a@unstable.cc> In-Reply-To: <9577ce6a-a845-71ad-b777-010fe88ed376@unstable.cc> References: <9577ce6a-a845-71ad-b777-010fe88ed376@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1lTOLQ-004fcY-VW Subject: [Openvpn-devel] [PATCH v2 3/3] ssl: remove unneeded if block 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: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Antonio Quartulli There is no need to check the result of a boolean function and then assign a constant value to a variable based on that check. Directly assign the return value of the function to the variable. Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- src/openvpn/ssl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 9d18c6e5..d8662d00 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1592,7 +1592,6 @@ openvpn_PRF(const uint8_t *secret, uint8_t *output, int output_len) { - bool ret = true; /* concatenate seed components */ struct buffer seed = alloc_buf(strlen(label) @@ -1614,10 +1613,8 @@ openvpn_PRF(const uint8_t *secret, } /* compute PRF */ - if (!ssl_tls1_PRF(BPTR(&seed), BLEN(&seed), secret, secret_len, output, output_len)) - { - ret = false; - } + bool ret = ssl_tls1_PRF(BPTR(&seed), BLEN(&seed), secret, secret_len, + output, output_len); buf_clear(&seed); free_buf(&seed);