mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-25 09:02:48 +00:00
Fix hwcap detection on 32-bit Arm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
94a634db96
commit
5d4ef83e01
@ -126,6 +126,7 @@
|
|||||||
# if defined(__linux__)
|
# if defined(__linux__)
|
||||||
/* Our preferred method of detection is getauxval() */
|
/* Our preferred method of detection is getauxval() */
|
||||||
# include <sys/auxv.h>
|
# include <sys/auxv.h>
|
||||||
|
# include <asm/hwcap.h>
|
||||||
# endif
|
# endif
|
||||||
/* Use SIGILL on Unix, and fall back to it on Linux */
|
/* Use SIGILL on Unix, and fall back to it on Linux */
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
@ -146,11 +147,16 @@
|
|||||||
* Capability detection code comes early, so we can disable
|
* Capability detection code comes early, so we can disable
|
||||||
* MBEDTLS_SHA256_USE_ARMV8_CRYPTO_IF_PRESENT if no detection mechanism found
|
* MBEDTLS_SHA256_USE_ARMV8_CRYPTO_IF_PRESENT if no detection mechanism found
|
||||||
*/
|
*/
|
||||||
#if defined(HWCAP_SHA2)
|
#if defined(MBEDTLS_ARCH_IS_ARM64) && defined(HWCAP_SHA2)
|
||||||
static int mbedtls_a64_crypto_sha256_determine_support(void)
|
static int mbedtls_a64_crypto_sha256_determine_support(void)
|
||||||
{
|
{
|
||||||
return (getauxval(AT_HWCAP) & HWCAP_SHA2) ? 1 : 0;
|
return (getauxval(AT_HWCAP) & HWCAP_SHA2) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
#elif defined(MBEDTLS_ARCH_IS_ARM32) && defined(HWCAP2_SHA2)
|
||||||
|
static int mbedtls_a64_crypto_sha256_determine_support(void)
|
||||||
|
{
|
||||||
|
return (getauxval(AT_HWCAP2) & HWCAP2_SHA2) ? 1 : 0;
|
||||||
|
}
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
static int mbedtls_a64_crypto_sha256_determine_support(void)
|
static int mbedtls_a64_crypto_sha256_determine_support(void)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user