diff options
author | tb <> | 2024-09-06 09:57:32 +0000 |
---|---|---|
committer | tb <> | 2024-09-06 09:57:32 +0000 |
commit | 2f477ae2728d0ed1462508692e09b8f3c8398d90 (patch) | |
tree | c22e39e94e81983bcd1b3626eb8f8209d4c33a03 /src/lib/libcrypto/evp/e_aes.c | |
parent | 1cf5f5e953944e829c982d02e497cddf8a7ed9c4 (diff) | |
download | openbsd-2f477ae2728d0ed1462508692e09b8f3c8398d90.tar.gz openbsd-2f477ae2728d0ed1462508692e09b8f3c8398d90.tar.bz2 openbsd-2f477ae2728d0ed1462508692e09b8f3c8398d90.zip |
Reenable AES-NI in libcrypto
The OPENSSL_cpu_caps() change after the last bump missed a crucial bit:
there is more MD mess in the MI code than anticipated, with the result
that AES is now used without AES-NI on amd64 and i386, hurting machines
that previously greatly benefitted from it.
Temporarily add an internal crypto_cpu_caps_ia32() API that returns the
OPENSSL_ia32cap_P or 0 like OPENSSL_cpu_caps() previously did. This can
be improved after the release.
Regression reported and fix tested by Mark Patruck.
No impact on public ABI or API.
with/ok jsing
PS: Next time my pkg_add feels very slow, I should perhaps not mechanically
blame IEEE 802.11...
Diffstat (limited to 'src/lib/libcrypto/evp/e_aes.c')
-rw-r--r-- | src/lib/libcrypto/evp/e_aes.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index 6135c7d84a..7753c18c15 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.58 2024/04/09 13:52:41 beck Exp $ */ | 1 | /* $OpenBSD: e_aes.c,v 1.59 2024/09/06 09:57:32 tb 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 | * |
@@ -55,6 +55,8 @@ | |||
55 | 55 | ||
56 | #include <openssl/opensslconf.h> | 56 | #include <openssl/opensslconf.h> |
57 | 57 | ||
58 | #include "crypto_internal.h" | ||
59 | |||
58 | #ifndef OPENSSL_NO_AES | 60 | #ifndef OPENSSL_NO_AES |
59 | #include <openssl/aes.h> | 61 | #include <openssl/aes.h> |
60 | #include <openssl/err.h> | 62 | #include <openssl/err.h> |
@@ -154,7 +156,7 @@ void AES_xts_decrypt(const char *inp, char *out, size_t len, | |||
154 | #include "x86_arch.h" | 156 | #include "x86_arch.h" |
155 | 157 | ||
156 | #ifdef VPAES_ASM | 158 | #ifdef VPAES_ASM |
157 | #define VPAES_CAPABLE (OPENSSL_cpu_caps() & CPUCAP_MASK_SSSE3) | 159 | #define VPAES_CAPABLE (crypto_cpu_caps_ia32() & CPUCAP_MASK_SSSE3) |
158 | #endif | 160 | #endif |
159 | #ifdef BSAES_ASM | 161 | #ifdef BSAES_ASM |
160 | #define BSAES_CAPABLE VPAES_CAPABLE | 162 | #define BSAES_CAPABLE VPAES_CAPABLE |
@@ -162,7 +164,7 @@ void AES_xts_decrypt(const char *inp, char *out, size_t len, | |||
162 | /* | 164 | /* |
163 | * AES-NI section | 165 | * AES-NI section |
164 | */ | 166 | */ |
165 | #define AESNI_CAPABLE (OPENSSL_cpu_caps() & CPUCAP_MASK_AESNI) | 167 | #define AESNI_CAPABLE (crypto_cpu_caps_ia32() & CPUCAP_MASK_AESNI) |
166 | 168 | ||
167 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | 169 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, |
168 | AES_KEY *key); | 170 | AES_KEY *key); |