From 085134812d3014b6ec53980f93c6f2e818bab2e4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 16 Jan 2022 16:13:33 +0100 Subject: Fix libblake_blake2[sn]_digest_get_required_input_size for 0 input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libblake_blake2b_digest_get_required_input_size.c | 2 +- libblake_blake2s_digest_get_required_input_size.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libblake_blake2b_digest_get_required_input_size.c b/libblake_blake2b_digest_get_required_input_size.c index 12288df..b4358c1 100644 --- a/libblake_blake2b_digest_get_required_input_size.c +++ b/libblake_blake2b_digest_get_required_input_size.c @@ -7,7 +7,7 @@ libblake_blake2b_digest_get_required_input_size(size_t len) size_t blocks, rem; blocks = len >> 7; rem = len & 127; - if (rem) + if (rem || !blocks) blocks += 1; return blocks << 7; } diff --git a/libblake_blake2s_digest_get_required_input_size.c b/libblake_blake2s_digest_get_required_input_size.c index c356822..f5f45cd 100644 --- a/libblake_blake2s_digest_get_required_input_size.c +++ b/libblake_blake2s_digest_get_required_input_size.c @@ -7,7 +7,7 @@ libblake_blake2s_digest_get_required_input_size(size_t len) size_t blocks, rem; blocks = len >> 6; rem = len & 63; - if (rem) + if (rem || !blocks) blocks += 1; return blocks << 6; } -- cgit v1.2.3-70-g09d2