icp: add SHA512 implementation using Intel SHA512 extensions

Generated from crypto/sha/asm/sha512-x86_64.pl in
openssl/openssl@241d4826f8.

Sponsored-by: TrueNAS
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Attila Fülöp <attila@fueloep.org>
Signed-off-by: Rob Norris <rob.norris@truenas.com>
Closes #18233
This commit is contained in:
Rob Norris
2026-02-17 14:54:09 +11:00
committed by Brian Behlendorf
parent 3547a358fd
commit 09c27a14a3
2 changed files with 338 additions and 1 deletions
+18
View File
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2022 Tino Reichardt <milky-zfs@mcmilk.de>
* Copyright (c) 2026, TrueNAS.
*/
#include <sys/simd.h>
@@ -92,6 +93,20 @@ const sha512_ops_t sha512_avx2_impl = {
};
#endif
#if defined(HAVE_SHA512EXT)
static boolean_t sha2_have_sha512ext(void)
{
return (kfpu_allowed() && zfs_sha512ext_available());
}
TF(zfs_sha512_transform_sha512ext, tf_sha512_sha512ext);
const sha512_ops_t sha512_sha512ext_impl = {
.is_supported = sha2_have_sha512ext,
.transform = tf_sha512_sha512ext,
.name = "sha512ext"
};
#endif
#elif defined(__aarch64__) || defined(__arm__)
extern void zfs_sha512_block_armv7(uint64_t s[8], const void *, size_t);
const sha512_ops_t sha512_armv7_impl = {
@@ -164,6 +179,9 @@ static const sha512_ops_t *const sha512_impls[] = {
#if defined(__x86_64) && defined(HAVE_AVX2)
&sha512_avx2_impl,
#endif
#if defined(__x86_64) && defined(HAVE_SHA512EXT)
&sha512_sha512ext_impl,
#endif
#if defined(__aarch64__) || defined(__arm__)
&sha512_armv7_impl,
#if defined(__aarch64__)