diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/arch/i386/crypto_arch.h | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/arch/i386/crypto_cpu_caps.c | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h index 3df3963d0b..a693bd20d8 100644 --- a/src/lib/libcrypto/arch/i386/crypto_arch.h +++ b/src/lib/libcrypto/arch/i386/crypto_arch.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_arch.h,v 1.4 2025/02/14 12:01:58 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_arch.h,v 1.5 2025/06/15 14:18:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -15,12 +15,20 @@ | |||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <stdint.h> | ||
| 19 | |||
| 18 | #ifndef HEADER_CRYPTO_ARCH_H | 20 | #ifndef HEADER_CRYPTO_ARCH_H |
| 19 | #define HEADER_CRYPTO_ARCH_H | 21 | #define HEADER_CRYPTO_ARCH_H |
| 20 | 22 | ||
| 21 | #define HAVE_CRYPTO_CPU_CAPS_INIT | 23 | #define HAVE_CRYPTO_CPU_CAPS_INIT |
| 22 | #define HAVE_CRYPTO_CPU_CAPS_IA32 | 24 | #define HAVE_CRYPTO_CPU_CAPS_IA32 |
| 23 | 25 | ||
| 26 | #ifndef __ASSEMBLER__ | ||
| 27 | extern uint64_t crypto_cpu_caps_i386; | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #define CRYPTO_CPU_CAPS_I386_AES (1ULL << 0) | ||
| 31 | |||
| 24 | #ifndef OPENSSL_NO_ASM | 32 | #ifndef OPENSSL_NO_ASM |
| 25 | 33 | ||
| 26 | #define HAVE_AES_CBC_ENCRYPT_INTERNAL | 34 | #define HAVE_AES_CBC_ENCRYPT_INTERNAL |
diff --git a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c index 6bb77411af..01981ace55 100644 --- a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c +++ b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: crypto_cpu_caps.c,v 1.3 2024/11/12 13:14:57 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_cpu_caps.c,v 1.4 2025/06/15 14:18:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -19,11 +19,15 @@ | |||
| 19 | 19 | ||
| 20 | #include <openssl/crypto.h> | 20 | #include <openssl/crypto.h> |
| 21 | 21 | ||
| 22 | #include "crypto_arch.h" | ||
| 22 | #include "x86_arch.h" | 23 | #include "x86_arch.h" |
| 23 | 24 | ||
| 24 | /* Legacy architecture specific capabilities, used by perlasm. */ | 25 | /* Legacy architecture specific capabilities, used by perlasm. */ |
| 25 | uint64_t OPENSSL_ia32cap_P; | 26 | uint64_t OPENSSL_ia32cap_P; |
| 26 | 27 | ||
| 28 | /* Machine dependent CPU capabilities. */ | ||
| 29 | uint64_t crypto_cpu_caps_i386; | ||
| 30 | |||
| 27 | /* Machine independent CPU capabilities. */ | 31 | /* Machine independent CPU capabilities. */ |
| 28 | extern uint64_t crypto_cpu_caps; | 32 | extern uint64_t crypto_cpu_caps; |
| 29 | 33 | ||
| @@ -92,8 +96,10 @@ crypto_cpu_caps_init(void) | |||
| 92 | if ((edx & IA32CAP_MASK0_SSE2) != 0) | 96 | if ((edx & IA32CAP_MASK0_SSE2) != 0) |
| 93 | caps |= CPUCAP_MASK_SSE2; | 97 | caps |= CPUCAP_MASK_SSE2; |
| 94 | 98 | ||
| 95 | if ((ecx & IA32CAP_MASK1_AESNI) != 0) | 99 | if ((ecx & IA32CAP_MASK1_AESNI) != 0) { |
| 96 | caps |= CPUCAP_MASK_AESNI; | 100 | caps |= CPUCAP_MASK_AESNI; |
| 101 | crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_AES; | ||
| 102 | } | ||
| 97 | if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) | 103 | if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) |
| 98 | caps |= CPUCAP_MASK_PCLMUL; | 104 | caps |= CPUCAP_MASK_PCLMUL; |
| 99 | if ((ecx & IA32CAP_MASK1_SSSE3) != 0) | 105 | if ((ecx & IA32CAP_MASK1_SSSE3) != 0) |
