diff options
| author | Jack O'Connor <[email protected]> | 2024-08-18 10:50:58 -0700 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2024-08-18 10:51:19 -0700 |
| commit | 0fc4049e9385c7752859cbf901b48719cf0c9712 (patch) | |
| tree | 78a3332c9502f44587cadca366455a60c739443d | |
| parent | 93c989afee8fae5e3c05a54db563c84fd7b1a079 (diff) | |
debug_assert that xof_many is always called with whole blocks
| -rw-r--r-- | src/ffi_avx512.rs | 1 | ||||
| -rw-r--r-- | src/platform.rs | 1 | ||||
| -rw-r--r-- | src/portable.rs | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/ffi_avx512.rs b/src/ffi_avx512.rs index 6794774..afa0221 100644 --- a/src/ffi_avx512.rs +++ b/src/ffi_avx512.rs @@ -70,6 +70,7 @@ pub unsafe fn xof_many( flags: u8, out: &mut [u8], ) { + debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only"); ffi::blake3_xof_many_avx512( cv.as_ptr(), block.as_ptr(), diff --git a/src/platform.rs b/src/platform.rs index 3f47718..590a77c 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -286,6 +286,7 @@ impl Platform { flags: u8, out: &mut [u8], ) { + debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only"); if out.is_empty() { // The current assembly implementation always outputs at least 1 block. return; diff --git a/src/portable.rs b/src/portable.rs index 822cd0d..4181f27 100644 --- a/src/portable.rs +++ b/src/portable.rs @@ -185,6 +185,7 @@ pub fn xof_many( flags: u8, out: &mut [u8], ) { + debug_assert_eq!(0, out.len() % BLOCK_LEN, "whole blocks only"); for out_block in out.chunks_exact_mut(64) { out_block.copy_from_slice(&compress_xof(cv, block, block_len, counter, flags)); counter += 1; |
