crypto/armcap.c: detect hardware-assisted SHA512 support.
Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
1d0c08b496
commit
77f3612e2b
3 changed files with 24 additions and 0 deletions
|
@ -63,6 +63,7 @@ _armv8_sha256_probe:
|
|||
sha256su0 v0.4s, v0.4s
|
||||
ret
|
||||
.size _armv8_sha256_probe,.-_armv8_sha256_probe
|
||||
|
||||
.globl _armv8_pmull_probe
|
||||
.type _armv8_pmull_probe,%function
|
||||
_armv8_pmull_probe:
|
||||
|
@ -70,6 +71,13 @@ _armv8_pmull_probe:
|
|||
ret
|
||||
.size _armv8_pmull_probe,.-_armv8_pmull_probe
|
||||
|
||||
.globl _armv8_sha512_probe
|
||||
.type _armv8_sha512_probe,%function
|
||||
_armv8_sha512_probe:
|
||||
.long 0xcec08000 // sha512su0 v0.2d,v0.2d
|
||||
ret
|
||||
.size _armv8_sha512_probe,.-_armv8_sha512_probe
|
||||
|
||||
.globl OPENSSL_cleanse
|
||||
.type OPENSSL_cleanse,%function
|
||||
.align 5
|
||||
|
|
|
@ -79,5 +79,6 @@ extern unsigned int OPENSSL_armcap_P;
|
|||
# define ARMV8_SHA1 (1<<3)
|
||||
# define ARMV8_SHA256 (1<<4)
|
||||
# define ARMV8_PMULL (1<<5)
|
||||
# define ARMV8_SHA512 (1<<6)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,6 +46,9 @@ void _armv8_aes_probe(void);
|
|||
void _armv8_sha1_probe(void);
|
||||
void _armv8_sha256_probe(void);
|
||||
void _armv8_pmull_probe(void);
|
||||
# ifdef __aarch64__
|
||||
void _armv8_sha512_probe(void);
|
||||
# endif
|
||||
uint32_t _armv7_tick(void);
|
||||
|
||||
uint32_t OPENSSL_rdtsc(void)
|
||||
|
@ -94,6 +97,7 @@ static unsigned long (*getauxval) (unsigned long) = NULL;
|
|||
# define HWCAP_CE_PMULL (1 << 4)
|
||||
# define HWCAP_CE_SHA1 (1 << 5)
|
||||
# define HWCAP_CE_SHA256 (1 << 6)
|
||||
# define HWCAP_CE_SHA512 (1 << 21)
|
||||
# endif
|
||||
|
||||
void OPENSSL_cpuid_setup(void)
|
||||
|
@ -163,6 +167,11 @@ void OPENSSL_cpuid_setup(void)
|
|||
|
||||
if (hwcap & HWCAP_CE_SHA256)
|
||||
OPENSSL_armcap_P |= ARMV8_SHA256;
|
||||
|
||||
# ifdef __aarch64__
|
||||
if (hwcap & HWCAP_CE_SHA512)
|
||||
OPENSSL_armcap_P |= ARMV8_SHA512;
|
||||
# endif
|
||||
}
|
||||
} else if (sigsetjmp(ill_jmp, 1) == 0) {
|
||||
_armv7_neon_probe();
|
||||
|
@ -182,6 +191,12 @@ void OPENSSL_cpuid_setup(void)
|
|||
_armv8_sha256_probe();
|
||||
OPENSSL_armcap_P |= ARMV8_SHA256;
|
||||
}
|
||||
# ifdef __aarch64__
|
||||
if (sigsetjmp(ill_jmp, 1) == 0) {
|
||||
_armv8_sha512_probe();
|
||||
OPENSSL_armcap_P |= ARMV8_SHA512;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
if (sigsetjmp(ill_jmp, 1) == 0) {
|
||||
_armv7_tick();
|
||||
|
|
Loading…
Reference in a new issue