Skip to content

Commit 0fc4049

Browse files
committed
debug_assert that xof_many is always called with whole blocks
1 parent 93c989a commit 0fc4049

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/ffi_avx512.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub unsafe fn xof_many(
7070
flags: u8,
7171
out: &mut [u8],
7272
) {
73+
debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only");
7374
ffi::blake3_xof_many_avx512(
7475
cv.as_ptr(),
7576
block.as_ptr(),

src/platform.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ impl Platform {
286286
flags: u8,
287287
out: &mut [u8],
288288
) {
289+
debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only");
289290
if out.is_empty() {
290291
// The current assembly implementation always outputs at least 1 block.
291292
return;

src/portable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ pub fn xof_many(
185185
flags: u8,
186186
out: &mut [u8],
187187
) {
188+
debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only");
188189
for out_block in out.chunks_exact_mut(64) {
189190
out_block.copy_from_slice(&compress_xof(cv, block, block_len, counter, flags));
190191
counter += 1;

0 commit comments

Comments
 (0)