diff options
Diffstat (limited to 'crypto/armcap.c')
-rw-r--r-- | crypto/armcap.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crypto/armcap.c b/crypto/armcap.c index c50322f504..91ba45c950 100644 --- a/crypto/armcap.c +++ b/crypto/armcap.c @@ -57,6 +57,8 @@ void _armv8_sm3_probe(void); void _armv8_sm4_probe(void); void _armv8_sha512_probe(void); unsigned int _armv8_cpuid_probe(void); +void _armv8_sve_probe(void); +void _armv8_sve2_probe(void); void _armv8_rng_probe(void); size_t OPENSSL_rndr_asm(unsigned char *buf, size_t len); @@ -175,8 +177,10 @@ static unsigned long getauxval(unsigned long key) # define HWCAP_CE_SM3 (1 << 18) # define HWCAP_CE_SM4 (1 << 19) # define HWCAP_CE_SHA512 (1 << 21) +# define HWCAP_SVE (1 << 22) /* AT_HWCAP2 */ # define HWCAP2 26 +# define HWCAP2_SVE2 (1 << 1) # define HWCAP2_RNG (1 << 16) # endif @@ -270,6 +274,12 @@ void OPENSSL_cpuid_setup(void) # endif } # ifdef __aarch64__ + if (getauxval(HWCAP) & HWCAP_SVE) + OPENSSL_armcap_P |= ARMV8_SVE; + + if (getauxval(HWCAP2) & HWCAP2_SVE2) + OPENSSL_armcap_P |= ARMV8_SVE2; + if (getauxval(HWCAP2) & HWCAP2_RNG) OPENSSL_armcap_P |= ARMV8_RNG; # endif @@ -331,6 +341,16 @@ void OPENSSL_cpuid_setup(void) } # ifdef __aarch64__ if (sigsetjmp(ill_jmp, 1) == 0) { + _armv8_sve_probe(); + OPENSSL_armcap_P |= ARMV8_SVE; + } + + if (sigsetjmp(ill_jmp, 1) == 0) { + _armv8_sve2_probe(); + OPENSSL_armcap_P |= ARMV8_SVE2; + } + + if (sigsetjmp(ill_jmp, 1) == 0) { _armv8_rng_probe(); OPENSSL_armcap_P |= ARMV8_RNG; } |