forked from wolfSSL/wolfssl
Tidy up CPU Id check not not reference SHA384
This commit is contained in:
@ -231,17 +231,15 @@ static word32 cpuid_flag(word32 leaf, word32 sub, word32 num, word32 bit) {
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
#define CHECK_SHA512 0x1
|
||||
#define CHECK_SHA384 0x2
|
||||
|
||||
static int set_cpuid_flags(int sha) {
|
||||
if((cpuid_check & sha) ==0) {
|
||||
static int set_cpuid_flags() {
|
||||
if(cpuid_check ==0) {
|
||||
if(cpuid_flag(1, 0, ECX, 28)){ cpuid_flags |= CPUID_AVX1 ;}
|
||||
if(cpuid_flag(7, 0, EBX, 5)){ cpuid_flags |= CPUID_AVX2 ; }
|
||||
if(cpuid_flag(7, 0, EBX, 8)) { cpuid_flags |= CPUID_BMI2 ; }
|
||||
if(cpuid_flag(1, 0, ECX, 30)){ cpuid_flags |= CPUID_RDRAND ; }
|
||||
if(cpuid_flag(7, 0, EBX, 18)){ cpuid_flags |= CPUID_RDSEED ; }
|
||||
cpuid_check |= sha ;
|
||||
cpuid_check = 1 ;
|
||||
return 0 ;
|
||||
}
|
||||
return 1 ;
|
||||
@ -270,7 +268,7 @@ static int (*Transform_p)(Sha512* sha512) = _Transform ;
|
||||
#define Transform(sha512) (*Transform_p)(sha512)
|
||||
|
||||
static void set_Transform(void) {
|
||||
if(set_cpuid_flags(CHECK_SHA512)) return ;
|
||||
if(set_cpuid_flags()) return ;
|
||||
|
||||
#if defined(HAVE_INTEL_AVX2)
|
||||
if(IS_INTEL_AVX2 && IS_INTEL_BMI2){
|
||||
|
Reference in New Issue
Block a user