aboutsummaryrefslogtreecommitdiff
path: root/c/blake3_dispatch.c
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2024-08-18 10:50:43 -0700
committerJack O'Connor <[email protected]>2024-08-18 10:50:43 -0700
commit93c989afee8fae5e3c05a54db563c84fd7b1a079 (patch)
treeb2d866ba84729b21be21d14611e75617faa27730 /c/blake3_dispatch.c
parent47f9283a937092ba212ad7f3df6183dd7bf1c447 (diff)
test that xof_many doesn't write more blocks than requested
Diffstat (limited to 'c/blake3_dispatch.c')
-rw-r--r--c/blake3_dispatch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/c/blake3_dispatch.c b/c/blake3_dispatch.c
index a90c757..cf5bad7 100644
--- a/c/blake3_dispatch.c
+++ b/c/blake3_dispatch.c
@@ -228,6 +228,10 @@ void blake3_xof_many(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN],
uint8_t block_len, uint64_t counter, uint8_t flags,
uint8_t out[64], size_t outblocks) {
+ if (outblocks == 0) {
+ // The current assembly implementation always outputs at least 1 block.
+ return;
+ }
#if defined(IS_X86)
const enum cpu_feature features = get_cpu_features();
#if defined(__unix__) && !defined(BLAKE3_NO_AVX512)