aboutsummaryrefslogtreecommitdiff
path: root/src/ffi_avx512.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ffi_avx512.rs')
-rw-r--r--src/ffi_avx512.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ffi_avx512.rs b/src/ffi_avx512.rs
index 884f481..d34e53c 100644
--- a/src/ffi_avx512.rs
+++ b/src/ffi_avx512.rs
@@ -60,6 +60,26 @@ pub unsafe fn hash_many<const N: usize>(
)
}
+// Unsafe because this may only be called on platforms supporting AVX-512.
+pub unsafe fn xof_many(
+ cv: &CVWords,
+ block: &[u8; BLOCK_LEN],
+ block_len: u8,
+ counter: u64,
+ flags: u8,
+ out: &mut [u8],
+) {
+ ffi::blake3_xof_many_avx512(
+ cv.as_ptr(),
+ block.as_ptr(),
+ block_len,
+ counter,
+ flags,
+ out.as_mut_ptr(),
+ out.len() / BLOCK_LEN,
+ );
+}
+
pub mod ffi {
extern "C" {
pub fn blake3_compress_in_place_avx512(
@@ -89,6 +109,15 @@ pub mod ffi {
flags_end: u8,
out: *mut u8,
);
+ pub fn blake3_xof_many_avx512(
+ cv: *const u32,
+ block: *const u8,
+ block_len: u8,
+ counter: u64,
+ flags: u8,
+ out: *mut u8,
+ outblocks: usize,
+ );
}
}
@@ -111,4 +140,12 @@ mod test {
}
crate::test::test_hash_many_fn(hash_many, hash_many);
}
+
+ #[test]
+ fn test_xof_many() {
+ if !crate::platform::avx512_detected() {
+ return;
+ }
+ crate::test::test_xof_many_fn(xof_many);
+ }
}