From 57826bd484e7ae73b50767290e426e90f96df46d Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Thu, 16 Apr 2026 17:07:27 +0200 Subject: [PATCH] blake2bmac_init/blake2smac_init - allows NULL key when keylen is 0 (in line with the BLAKE2 spec) --- src/mac/blake2/blake2bmac.c | 2 +- src/mac/blake2/blake2smac.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mac/blake2/blake2bmac.c b/src/mac/blake2/blake2bmac.c index ac26e106..c8387b7f 100644 --- a/src/mac/blake2/blake2bmac.c +++ b/src/mac/blake2/blake2bmac.c @@ -16,7 +16,7 @@ int blake2bmac_init(blake2bmac_state *st, unsigned long outlen, const unsigned char *key, unsigned long keylen) { LTC_ARGCHK(st != NULL); - LTC_ARGCHK(key != NULL); + LTC_ARGCHK(key != NULL || keylen == 0); return blake2b_init(st, outlen, key, keylen); } diff --git a/src/mac/blake2/blake2smac.c b/src/mac/blake2/blake2smac.c index f42c7aec..5ba39c86 100644 --- a/src/mac/blake2/blake2smac.c +++ b/src/mac/blake2/blake2smac.c @@ -16,7 +16,7 @@ int blake2smac_init(blake2smac_state *st, unsigned long outlen, const unsigned char *key, unsigned long keylen) { LTC_ARGCHK(st != NULL); - LTC_ARGCHK(key != NULL); + LTC_ARGCHK(key != NULL || keylen == 0); return blake2s_init(st, outlen, key, keylen); }