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
This commit is contained in:
Sarah Walker
2026-01-13 14:25:50 +00:00
committed by Andrew Turner
parent 41ccf82b29
commit 2708369395
2 changed files with 4 additions and 13 deletions
+2 -6
View File
@@ -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);
}
+2 -7
View File
@@ -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);
}