diff mbox series

crypto: Fix unreachable code in tls_prf_sha1_md5()

Message ID 20190403121615.4094-3-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series crypto: Fix unreachable code in tls_prf_sha1_md5() | expand

Commit Message

Otcheretianski, Andrei April 3, 2019, 12:16 p.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

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 <ilan.peer@intel.com>
---
 src/crypto/sha1-tlsprf.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Jouni Malinen April 6, 2019, 3:50 p.m. UTC | #1
On Wed, Apr 03, 2019 at 03:16:14PM +0300, Andrei Otcheretianski wrote:
> 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.

Thanks, applied.
diff mbox series

Patch

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;