mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
Update with ARMV8_HAVE_SHA3_AND_WORTH_USING
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21398)
This commit is contained in:
parent
08e6eb216c
commit
ba9472c1c1
@ -85,7 +85,7 @@ extern unsigned int OPENSSL_armv8_rsa_neonized;
|
||||
# define ARMV8_UNROLL8_EOR3 (1<<12)
|
||||
# define ARMV8_SVE (1<<13)
|
||||
# define ARMV8_SVE2 (1<<14)
|
||||
# define ARMV8_WORTH_USING_SHA3 (1<<15)
|
||||
# define ARMV8_HAVE_SHA3_AND_WORTH_USING (1<<15)
|
||||
|
||||
/*
|
||||
* MIDR_EL1 system register
|
||||
|
@ -300,7 +300,7 @@ void OPENSSL_cpuid_setup(void)
|
||||
((strncmp(uarch, "Apple M1", 8) == 0) ||
|
||||
(strncmp(uarch, "Apple M2", 8) == 0))) {
|
||||
OPENSSL_armcap_P |= ARMV8_UNROLL8_EOR3;
|
||||
OPENSSL_armcap_P |= ARMV8_WORTH_USING_SHA3;
|
||||
OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -433,7 +433,7 @@ void OPENSSL_cpuid_setup(void)
|
||||
MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_AVALANCHE_MAX) ||
|
||||
MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_BLIZZARD_MAX)) &&
|
||||
(OPENSSL_armcap_P & ARMV8_SHA3))
|
||||
OPENSSL_armcap_P |= ARMV8_WORTH_USING_SHA3;
|
||||
OPENSSL_armcap_P |= ARMV8_HAVE_SHA3_AND_WORTH_USING;
|
||||
# endif
|
||||
}
|
||||
#endif /* _WIN32, __ARM_MAX_ARCH__ >= 7 */
|
||||
|
@ -271,18 +271,14 @@ static PROV_SHA3_METHOD sha3_ARMSHA3_md =
|
||||
armsha3_sha3_absorb,
|
||||
generic_sha3_final
|
||||
};
|
||||
/* Users can switch back to the generic code by clearing either of the bits */
|
||||
# define ARM_SHA3_CAPABLE \
|
||||
((OPENSSL_armcap_P & ARMV8_SHA3) && \
|
||||
(OPENSSL_armcap_P & ARMV8_WORTH_USING_SHA3))
|
||||
# define SHA3_SET_MD(uname, typ) \
|
||||
if (ARM_SHA3_CAPABLE) { \
|
||||
if (OPENSSL_armcap_P & ARMV8_HAVE_SHA3_AND_WORTH_USING) { \
|
||||
ctx->meth = sha3_ARMSHA3_md; \
|
||||
} else { \
|
||||
ctx->meth = sha3_generic_md; \
|
||||
}
|
||||
# define KMAC_SET_MD(bitlen) \
|
||||
if (ARM_SHA3_CAPABLE) { \
|
||||
if (OPENSSL_armcap_P & ARMV8_HAVE_SHA3_AND_WORTH_USING) { \
|
||||
ctx->meth = sha3_ARMSHA3_md; \
|
||||
} else { \
|
||||
ctx->meth = sha3_generic_md; \
|
||||
|
Loading…
Reference in New Issue
Block a user