summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTom Cosgrove <tom.cosgrove@arm.com>2023-03-28 11:53:37 +0100
committerTomas Mraz <tomas@openssl.org>2023-03-29 17:22:18 +0200
commit57f247cd249755b52f2dbfd3b549a1ef436d5ad8 (patch)
treeabd857da9741cbce312dccacc44d19d409fa0ddb /include
parent1c0732e48340f683e638c309e4c5f231af58d23e (diff)
SM4 check should be for __aarch64__, not __ARM_MAX_ARCH__ >= 8
(And then __arm__ and __arm tests are redundant) Fixes #20604 for 3.1 branch 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/20624)
Diffstat (limited to 'include')
-rw-r--r--include/crypto/sm4_platform.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/include/crypto/sm4_platform.h b/include/crypto/sm4_platform.h
index 11f9b9d88b..54bbc37df3 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)
{
@@ -22,18 +21,17 @@ static inline int vpsm4_capable(void)
(MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_V1) ||
MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_N1));
}
-# if defined(VPSM4_ASM)
-# define VPSM4_CAPABLE vpsm4_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()
# 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 */