hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 25d1943a458eb2b7ad8300c1c2b4f71f3e8d9ee3
parent 2d906b2620654a731bddcf407073d236f916d351
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun,  8 May 2022 11:08:29 +0200

crypto::blowfish: loosen constraints on key size

init_with_salt needs looser constraints, and since we re-use init for
key expansion later on, some use-cases in the wild (e.g. OpenBSD's
bcrypt_pbkdf) need to be able to do manual key expansion without using a
key which is independently suitable.

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mcrypto/blowfish/blowfish.ha | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/crypto/blowfish/blowfish.ha b/crypto/blowfish/blowfish.ha @@ -40,7 +40,6 @@ export fn new() state = { // Performs key expansion for a Blowfish cipher. export fn init(c: *state, key: []u8) void = { - assert(len(key) > 0 && len(key) <= 56, "Invalid blowfish key size"); let j = 0z; for (let i = 0z; i < len(c.p); i += 1) { c.p[i] ^= getword(key, &j); @@ -71,7 +70,7 @@ export fn init_salt(c: *state, key: []u8, salt: []u8) void = { return; }; - assert(len(key) > 0 && len(key) <= 56, "Invalid blowfish key size"); + assert(len(key) >= 1, "Invalid blowfish key size"); let j = 0z; for (let i = 0z; i < 18; i += 1) { c.p[i] ^= getword(key, &j);