From 27083693955d563f836fd1b6b1bc4e1a249d3b6b Mon Sep 17 00:00:00 2001 From: Sarah Walker Date: Tue, 13 Jan 2026 14:25:50 +0000 Subject: [PATCH] crypto: Update sha256 and sha512 ifuncs to use passed HWCAP flags Reviewed by: andrew Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D54600 --- sys/crypto/sha2/sha256c.c | 8 ++------ sys/crypto/sha2/sha512c.c | 9 ++------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/sys/crypto/sha2/sha256c.c b/sys/crypto/sha2/sha256c.c index b7f7295c5c8..c7f9bbf119a 100644 --- a/sys/crypto/sha2/sha256c.c +++ b/sys/crypto/sha2/sha256c.c @@ -206,12 +206,8 @@ SHA256_Transform_arm64(uint32_t * state, const unsigned char block[64]) DEFINE_UIFUNC(static, void, SHA256_Transform, (uint32_t * state, const unsigned char block[64])) { - u_long hwcap; - - if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0) { - if ((hwcap & HWCAP_SHA2) != 0) - return (SHA256_Transform_arm64); - } + if ((at_hwcap & HWCAP_SHA2) != 0) + return (SHA256_Transform_arm64); return (SHA256_Transform_c); } diff --git a/sys/crypto/sha2/sha512c.c b/sys/crypto/sha2/sha512c.c index 076cb30a1df..335dae08abb 100644 --- a/sys/crypto/sha2/sha512c.c +++ b/sys/crypto/sha2/sha512c.c @@ -236,13 +236,8 @@ SHA512_Transform_arm64(uint64_t * state, DEFINE_UIFUNC(static, void, SHA512_Transform, (uint64_t * state, const unsigned char block[SHA512_BLOCK_LENGTH])) { - u_long hwcap; - - if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0) { - if ((hwcap & HWCAP_SHA512) != 0) { - return (SHA512_Transform_arm64); - } - } + if ((at_hwcap & HWCAP_SHA512) != 0) + return (SHA512_Transform_arm64); return (SHA512_Transform_c); }