diff options
author | Xi Ruoyao <xry111@xry111.site> | 2023-07-21 02:07:04 +0000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-07-28 12:40:01 +1000 |
commit | d64d53a65498c5bd1ba268e733fb6e10ec4f7144 (patch) | |
tree | fcfec0214465f91c81ce66c5e67d7161acfd5541 /include | |
parent | 4c1fc2c3ecb41b024ddafcb34210955d8ddfc684 (diff) |
vpaes: LoongArch: Use getauxval(AT_HWCAP) for LSX detection
Running LSX instructions requires both the hardware support and the
kernel support. The `cpucfg` instruction only tests the hardware
support, causing a SIGILL if the hardware supports LSX but the kernel
does not.
Use `getauxval(AT_HWCAP)` as the ["Software Development and Build
Convention for LoongArch Architectures"][1] manual suggests.
The LOONGARCH_HWCAP_LSX and LOONGARCH_HWCAP_LASX bits are copied from
the manual too. In Glibc 2.38 they'll be provided by <sys/auxv.h> as
well, but they are unavailable in earlier Glibc versions so we cannot
rely on it.
The getauxval syscall and Glibc wrapper are available since day one
(Linux-5.19 and Glibc-2.36) for LoongArch.
Fixes #21508.
[1]:https://github.com/loongson/la-softdev-convention/blob/master/la-softdev-convention.adoc#kernel-constraints
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21509)
(cherry picked from commit c612289b77c37f7295d5af0d0e6b6c04e6ba727c)
Diffstat (limited to 'include')
-rw-r--r-- | include/crypto/aes_platform.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/crypto/aes_platform.h b/include/crypto/aes_platform.h index 75aa781399..87c3525543 100644 --- a/include/crypto/aes_platform.h +++ b/include/crypto/aes_platform.h @@ -165,7 +165,7 @@ void gcm_ghash_v8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len); # if defined(__loongarch__) || defined(__loongarch64) # include "loongarch_arch.h" # if defined(VPAES_ASM) -# define VPAES_CAPABLE (OPENSSL_loongarchcap_P & LOONGARCH_CFG2_LSX) +# define VPAES_CAPABLE (OPENSSL_loongarch_hwcap_P & LOONGARCH_HWCAP_LSX) # endif # endif |