diff options
author | Tom Cosgrove <tom.cosgrove@arm.com> | 2023-03-27 15:42:20 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-03-29 17:21:14 +0200 |
commit | 09cb8718fd65dc7126247808cb96b05147bb923f (patch) | |
tree | 50d5ab37d6309dc1a4775fd88d77047cd2d06a52 | |
parent | 7b508cd1e18f04d509af4df6c2ab4709c4389d19 (diff) |
SM4 check should be for __aarch64__, not __ARM_MAX_ARCH__ >= 8
(And then __arm__ and __arm tests are redundant)
Fixes #20604
Change-Id: I4308e75b7fbf3be7b46490c3ea4125e2d91b00b8
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20620)
-rw-r--r-- | include/crypto/sm4_platform.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/include/crypto/sm4_platform.h b/include/crypto/sm4_platform.h index 8b9cd10f97..a37dc5f6d3 100644 --- a/include/crypto/sm4_platform.h +++ b/include/crypto/sm4_platform.h @@ -12,9 +12,8 @@ # pragma once # if defined(OPENSSL_CPUID_OBJ) -# if (defined(__arm__) || defined(__arm) || defined(__aarch64__)) +# if defined(__aarch64__) # include "arm_arch.h" -# if __ARM_MAX_ARCH__>=8 extern unsigned int OPENSSL_arm_midr; static inline int vpsm4_capable(void) { @@ -27,19 +26,18 @@ static inline int vpsm4_ex_capable(void) return (OPENSSL_armcap_P & ARMV8_CPUID) && (MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, HISI_CPU_IMP, HISI_CPU_PART_KP920)); } -# if defined(VPSM4_ASM) -# define VPSM4_CAPABLE vpsm4_capable() -# define VPSM4_EX_CAPABLE vpsm4_ex_capable() -# endif -# define HWSM4_CAPABLE (OPENSSL_armcap_P & ARMV8_SM4) -# define HWSM4_set_encrypt_key sm4_v8_set_encrypt_key -# define HWSM4_set_decrypt_key sm4_v8_set_decrypt_key -# define HWSM4_encrypt sm4_v8_encrypt -# define HWSM4_decrypt sm4_v8_decrypt -# define HWSM4_cbc_encrypt sm4_v8_cbc_encrypt -# define HWSM4_ecb_encrypt sm4_v8_ecb_encrypt -# define HWSM4_ctr32_encrypt_blocks sm4_v8_ctr32_encrypt_blocks +# if defined(VPSM4_ASM) +# define VPSM4_CAPABLE vpsm4_capable() +# define VPSM4_EX_CAPABLE vpsm4_ex_capable() # endif +# define HWSM4_CAPABLE (OPENSSL_armcap_P & ARMV8_SM4) +# define HWSM4_set_encrypt_key sm4_v8_set_encrypt_key +# define HWSM4_set_decrypt_key sm4_v8_set_decrypt_key +# define HWSM4_encrypt sm4_v8_encrypt +# define HWSM4_decrypt sm4_v8_decrypt +# define HWSM4_cbc_encrypt sm4_v8_cbc_encrypt +# define HWSM4_ecb_encrypt sm4_v8_ecb_encrypt +# define HWSM4_ctr32_encrypt_blocks sm4_v8_ctr32_encrypt_blocks # endif # endif /* OPENSSL_CPUID_OBJ */ |