Eliminate |OPENSSL_ia32cap_P| in C code in the FIPS module.

This can break delocate with certain compiler settings.

Change-Id: I76cf0f780d0e967390feed754e39b0ab25068f42
Reviewed-on: https://boringssl-review.googlesource.com/c/33485
Commit-Queue: Adam Langley <alangley@gmail.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
Adam Langley 2018-12-05 16:44:03 -08:00 committed by CQ bot account: commit-bot@chromium.org
parent 750fea158a
commit bf5021a6b8
3 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ extern "C" {
#define HWAES_ECB #define HWAES_ECB
static int hwaes_capable(void) { static int hwaes_capable(void) {
return (OPENSSL_ia32cap_P[1] & (1 << (57 - 32))) != 0; return (OPENSSL_ia32cap_get()[1] & (1 << (57 - 32))) != 0;
} }
#elif defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) #elif defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
#define HWAES #define HWAES

View File

@ -102,7 +102,7 @@ typedef struct {
(defined(OPENSSL_X86_64) || defined(OPENSSL_X86)) (defined(OPENSSL_X86_64) || defined(OPENSSL_X86))
#define VPAES #define VPAES
static char vpaes_capable(void) { static char vpaes_capable(void) {
return (OPENSSL_ia32cap_P[1] & (1 << (41 - 32))) != 0; return (OPENSSL_ia32cap_get()[1] & (1 << (41 - 32))) != 0;
} }
#if defined(OPENSSL_X86_64) #if defined(OPENSSL_X86_64)

View File

@ -581,7 +581,7 @@ static void ecp_nistz256_inv_mod_ord(const EC_GROUP *group, EC_SCALAR *out,
static int ecp_nistz256_mont_inv_mod_ord_vartime(const EC_GROUP *group, static int ecp_nistz256_mont_inv_mod_ord_vartime(const EC_GROUP *group,
EC_SCALAR *out, EC_SCALAR *out,
const EC_SCALAR *in) { const EC_SCALAR *in) {
if ((OPENSSL_ia32cap_P[1] & (1 << 28)) == 0) { if ((OPENSSL_ia32cap_get()[1] & (1 << 28)) == 0) {
// No AVX support; fallback to generic code. // No AVX support; fallback to generic code.
return ec_GFp_simple_mont_inv_mod_ord_vartime(group, out, in); return ec_GFp_simple_mont_inv_mod_ord_vartime(group, out, in);
} }