diff options
author | miod <> | 2016-11-04 17:30:30 +0000 |
---|---|---|
committer | miod <> | 2016-11-04 17:30:30 +0000 |
commit | 723502d9588ba0e1cc08af1b12654917da74d440 (patch) | |
tree | 77b413175d422148cfb0ef7b2062340230aa5413 /src/lib/libcrypto/evp/e_aes.c | |
parent | 391f8ce21bb7929810460a73e2fde2c80540848d (diff) | |
download | openbsd-723502d9588ba0e1cc08af1b12654917da74d440.tar.gz openbsd-723502d9588ba0e1cc08af1b12654917da74d440.tar.bz2 openbsd-723502d9588ba0e1cc08af1b12654917da74d440.zip |
Replace all uses of magic numbers when operating on OPENSSL_ia32_P[] by
meaningful constants in a private header file, so that reviewers can actually
get a chance to figure out what the code is attempting to do without knowing
all cpuid bits.
While there, turn it from an array of two 32-bit ints into a properly aligned
64-bit int.
Use of OPENSSL_ia32_P is now restricted to the assembler parts. C code will
now always use OPENSSL_cpu_caps() and check for the proper bits in the
whole 64-bit word it returns.
i386 tests and ok jsing@
Diffstat (limited to 'src/lib/libcrypto/evp/e_aes.c')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 25199dca36..b20543a90c 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: e_aes.c,v 1.30 2016/11/04 13:56:05 miod Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.31 2016/11/04 17:30:30 miod Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -150,10 +150,10 @@ void AES_xts_decrypt(const char *inp, char *out, size_t len, | |||
150 | defined(_M_AMD64) || defined(_M_X64) || \ | 150 | defined(_M_AMD64) || defined(_M_X64) || \ |
151 | defined(__INTEL__) ) | 151 | defined(__INTEL__) ) |
152 | 152 | ||
153 | extern unsigned int OPENSSL_ia32cap_P[]; | 153 | #include "x86_arch.h" |
154 | 154 | ||
155 | #ifdef VPAES_ASM | 155 | #ifdef VPAES_ASM |
156 | #define VPAES_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(41-32))) | 156 | #define VPAES_CAPABLE (OPENSSL_cpu_caps() & CPUCAP_MASK_SSSE3) |
157 | #endif | 157 | #endif |
158 | #ifdef BSAES_ASM | 158 | #ifdef BSAES_ASM |
159 | #define BSAES_CAPABLE VPAES_CAPABLE | 159 | #define BSAES_CAPABLE VPAES_CAPABLE |
@@ -161,7 +161,7 @@ extern unsigned int OPENSSL_ia32cap_P[]; | |||
161 | /* | 161 | /* |
162 | * AES-NI section | 162 | * AES-NI section |
163 | */ | 163 | */ |
164 | #define AESNI_CAPABLE (OPENSSL_ia32cap_P[1]&(1<<(57-32))) | 164 | #define AESNI_CAPABLE (OPENSSL_cpu_caps() & CPUCAP_MASK_AESNI) |
165 | 165 | ||
166 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | 166 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, |
167 | AES_KEY *key); | 167 | AES_KEY *key); |