From 99dba49609e52d4cf5d26f15677037392fe5c8e0 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 28 Jun 2025 12:21:46 +0000 Subject: Add CLMUL and MMX to machine dependent CPU capabilities for i386. ok tb@ --- src/lib/libcrypto/arch/i386/crypto_arch.h | 4 +++- src/lib/libcrypto/arch/i386/crypto_cpu_caps.c | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/arch/i386/crypto_arch.h b/src/lib/libcrypto/arch/i386/crypto_arch.h index e03e6cd765..9a377e56a9 100644 --- a/src/lib/libcrypto/arch/i386/crypto_arch.h +++ b/src/lib/libcrypto/arch/i386/crypto_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_arch.h,v 1.6 2025/06/27 17:10:45 jsing Exp $ */ +/* $OpenBSD: crypto_arch.h,v 1.7 2025/06/28 12:21:46 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -28,6 +28,8 @@ extern uint64_t crypto_cpu_caps_i386; #endif #define CRYPTO_CPU_CAPS_I386_AES (1ULL << 0) +#define CRYPTO_CPU_CAPS_I386_CLMUL (1ULL << 1) +#define CRYPTO_CPU_CAPS_I386_MMX (1ULL << 2) #ifndef OPENSSL_NO_ASM diff --git a/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c b/src/lib/libcrypto/arch/i386/crypto_cpu_caps.c index 01981ace55..12717a6db3 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 @@ -/* $OpenBSD: crypto_cpu_caps.c,v 1.4 2025/06/15 14:18:31 jsing Exp $ */ +/* $OpenBSD: crypto_cpu_caps.c,v 1.5 2025/06/28 12:21:46 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -89,8 +89,10 @@ crypto_cpu_caps_init(void) caps |= CPUCAP_MASK_FXSR; if ((edx & IA32CAP_MASK0_HT) != 0) caps |= CPUCAP_MASK_HT; - if ((edx & IA32CAP_MASK0_MMX) != 0) + if ((edx & IA32CAP_MASK0_MMX) != 0) { caps |= CPUCAP_MASK_MMX; + crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_MMX; + } if ((edx & IA32CAP_MASK0_SSE) != 0) caps |= CPUCAP_MASK_SSE; if ((edx & IA32CAP_MASK0_SSE2) != 0) @@ -100,8 +102,10 @@ crypto_cpu_caps_init(void) caps |= CPUCAP_MASK_AESNI; crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_AES; } - if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) + if ((ecx & IA32CAP_MASK1_PCLMUL) != 0) { caps |= CPUCAP_MASK_PCLMUL; + crypto_cpu_caps_i386 |= CRYPTO_CPU_CAPS_I386_CLMUL; + } if ((ecx & IA32CAP_MASK1_SSSE3) != 0) caps |= CPUCAP_MASK_SSSE3; -- cgit v1.2.3-55-g6feb