mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-21 22:02:37 +00:00
Fix FreeBSD ARM64 hardware acceleration detection
Use elf_aux_info(AT_HWCAP) to detect AES and SHA-256 support. Keep software fallbacks when the query fails or capabilities are absent.
This commit is contained in:
+9
-1
@@ -479,7 +479,7 @@ void DisableCPUExtendedFeatures ()
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_ARMV8
|
||||
#if defined(__linux__) && defined(__aarch64__)
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__aarch64__)
|
||||
#include <sys/auxv.h>
|
||||
#ifndef HWCAP_AES
|
||||
# define HWCAP_AES (1 << 3)
|
||||
@@ -498,6 +498,10 @@ VC_INLINE int CPU_QueryAES()
|
||||
#if defined(__linux__) && defined(__aarch64__)
|
||||
if ((getauxval(AT_HWCAP) & HWCAP_AES) != 0)
|
||||
return 1;
|
||||
#elif defined(__FreeBSD__) && defined(__aarch64__)
|
||||
unsigned long hwcap = 0;
|
||||
if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0 && (hwcap & HWCAP_AES) != 0)
|
||||
return 1;
|
||||
#elif defined(__APPLE__) && defined(__aarch64__)
|
||||
// Apple Sillcon (M1) and later
|
||||
return 1;
|
||||
@@ -522,6 +526,10 @@ VC_INLINE int CPU_QuerySHA2()
|
||||
#if defined(__linux__) && defined(__aarch64__)
|
||||
if ((getauxval(AT_HWCAP) & HWCAP_SHA2) != 0)
|
||||
return 1;
|
||||
#elif defined(__FreeBSD__) && defined(__aarch64__)
|
||||
unsigned long hwcap = 0;
|
||||
if (elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap)) == 0 && (hwcap & HWCAP_SHA2) != 0)
|
||||
return 1;
|
||||
#elif defined(__APPLE__) && defined(__aarch64__)
|
||||
// Apple Sillcon (M1) and later
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user