From ddb7a92c15f2f8dbb4e70941b17b4e09909b4e70 Mon Sep 17 00:00:00 2001 From: Dionysis Grigoropoulos Date: Wed, 1 Mar 2023 16:22:51 +0200 Subject: [PATCH] hkdf: Remove duplicate check if the salt is None The second if isn't needed since we initialize the salt with zeroes earlier. If instead we meant to pass an empty bytes class to the HMAC implementation, the end result would be the same, since it's gonna get padded with zeroes in the HMAC code. --- RNS/Cryptography/HKDF.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/RNS/Cryptography/HKDF.py b/RNS/Cryptography/HKDF.py index 0491dda..5c964b2 100644 --- a/RNS/Cryptography/HKDF.py +++ b/RNS/Cryptography/HKDF.py @@ -39,9 +39,6 @@ def hkdf(length=None, derive_from=None, salt=None, context=None): if salt == None or len(salt) == 0: salt = bytes([0] * hash_len) - if salt == None: - salt = b"" - if context == None: context = b""