From patchwork Wed Apr 3 12:16:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Otcheretianski, Andrei" X-Patchwork-Id: 1075571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PSSPgdFl"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Yzbs2qYrz9sRs for ; Wed, 3 Apr 2019 19:23:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kW7jtQg0/uKlOXLi7EGKGCy3ZVoW8oAwDNVj0MOUG+E=; b=PSSPgdFlppM6Yj hR/Zn49pLsYn0poYdfxfDNPUTtd0HMVMKcvp5T8f8P+NGIWFUOHdmjBNTrerNpwrRz90f1KinQWWs LIbm3erCTmQ/Qkugc3HiM8BdNWoDO7gAX4/VodX3u8KfpMfU0dFWhNvnse1BxKg0w3BWplHF9OlYx fBg2JTZ6Z1AAurRqph9YDLXb/z3hOTAj2v4vpjbTtJEqnP8G4FonXz4DV9jmezF3Sdd2FWg4yRZEq uI2Bcabh/Cy7Bh6GK/eY3gGj/8v11MxsSeICqbFzZcekTA1c1AhEkw6F3jcAReBFRvvNeigjVvS1V NrZDCzNPl1JiaFFk24pA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBbAl-0001hC-8d; Wed, 03 Apr 2019 08:23:03 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBbAi-0001eR-TP for hostap@lists.infradead.org; Wed, 03 Apr 2019 08:23:02 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2019 01:23:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,304,1549958400"; d="scan'208";a="220098108" Received: from andrei-xps-12-9q33.jer.intel.com ([10.12.190.129]) by orsmga001.jf.intel.com with ESMTP; 03 Apr 2019 01:22:59 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH] crypto: Fix unreachable code in tls_prf_sha1_md5() Date: Wed, 3 Apr 2019 15:16:14 +0300 Message-Id: <20190403121615.4094-3-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190403121615.4094-1-andrei.otcheretianski@intel.com> References: <20190403121615.4094-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190403_012300_958526_0CAD076C X-CRM114-Status: GOOD ( 10.81 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.136 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ilan Peer Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ilan Peer While commit 1c156e783d35 ("Fixed tls_prf() to handle keys with odd length") added support for keys with odd length, the function never reached this code as the function would return earlier in case the key length was odd. Fix this by removing the first check for the key length. Signed-off-by: Ilan Peer --- src/crypto/sha1-tlsprf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/crypto/sha1-tlsprf.c b/src/crypto/sha1-tlsprf.c index f9bc0ebf6e..a11649a933 100644 --- a/src/crypto/sha1-tlsprf.c +++ b/src/crypto/sha1-tlsprf.c @@ -40,9 +40,6 @@ int tls_prf_sha1_md5(const u8 *secret, size_t secret_len, const char *label, const unsigned char *SHA1_addr[3]; size_t SHA1_len[3]; - if (secret_len & 1) - return -1; - MD5_addr[0] = A_MD5; MD5_len[0] = MD5_MAC_LEN; MD5_addr[1] = (unsigned char *) label;