From 45494f21aaa5cacc6b40f82926b9cfd3cd6521b0 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sat, 11 Jan 2025 17:26:51 +0100 Subject: [PATCH] Allow IFAC bitmask generation for large packet sizes --- RNS/Cryptography/HKDF.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNS/Cryptography/HKDF.py b/RNS/Cryptography/HKDF.py index 5c964b2..d3876bb 100644 --- a/RNS/Cryptography/HKDF.py +++ b/RNS/Cryptography/HKDF.py @@ -48,7 +48,7 @@ def hkdf(length=None, derive_from=None, salt=None, context=None): derived = b"" for i in range(ceil(length / hash_len)): - block = hmac_sha256(pseudorandom_key, block + context + bytes([i + 1])) + block = hmac_sha256(pseudorandom_key, block + context + bytes([(i + 1)%(0xFF+1)])) derived += block return derived[:length]