diff options
author | jsing <> | 2024-10-19 13:06:11 +0000 |
---|---|---|
committer | jsing <> | 2024-10-19 13:06:11 +0000 |
commit | ddd498e9dc3b8e01469736ea80d9583f6d3b978a (patch) | |
tree | 80abe0c72655c8ae71236c909363b30c8bb010ba /src/lib/libcrypto/cryptlib.c | |
parent | d2377970fef7d1c8e41cbb1d93b5e43185f032fc (diff) | |
download | openbsd-ddd498e9dc3b8e01469736ea80d9583f6d3b978a.tar.gz openbsd-ddd498e9dc3b8e01469736ea80d9583f6d3b978a.tar.bz2 openbsd-ddd498e9dc3b8e01469736ea80d9583f6d3b978a.zip |
Remove IA32 specific code from cryptlib.c.
Move the IA32 specific code to arch/{amd64,i386}/crypto_cpu_caps.c, rather
than polluting cryptlib.c with machine dependent code. A stub version of
crypto_cpu_caps_ia32() still remains for now.
Diffstat (limited to 'src/lib/libcrypto/cryptlib.c')
-rw-r--r-- | src/lib/libcrypto/cryptlib.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 60f14eba12..8cb05e8cbf 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cryptlib.c,v 1.56 2024/10/17 14:27:57 jsing Exp $ */ | 1 | /* $OpenBSD: cryptlib.c,v 1.57 2024/10/19 13:06:11 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -330,40 +330,6 @@ CRYPTO_THREADID_hash(const CRYPTO_THREADID *id) | |||
330 | return id->val; | 330 | return id->val; |
331 | } | 331 | } |
332 | 332 | ||
333 | #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ | ||
334 | defined(__INTEL__) || \ | ||
335 | defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) | ||
336 | |||
337 | uint64_t OPENSSL_ia32cap_P; | ||
338 | |||
339 | uint64_t | ||
340 | crypto_cpu_caps_ia32(void) | ||
341 | { | ||
342 | return OPENSSL_ia32cap_P; | ||
343 | } | ||
344 | |||
345 | #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) | ||
346 | #define OPENSSL_CPUID_SETUP | ||
347 | void | ||
348 | OPENSSL_cpuid_setup(void) | ||
349 | { | ||
350 | uint64_t OPENSSL_ia32_cpuid(void); | ||
351 | |||
352 | OPENSSL_ia32cap_P = OPENSSL_ia32_cpuid(); | ||
353 | |||
354 | if ((OPENSSL_ia32cap_P & CPUCAP_MASK_AESNI) != 0) | ||
355 | crypto_cpu_caps |= CRYPTO_CPU_CAPS_ACCELERATED_AES; | ||
356 | } | ||
357 | #endif | ||
358 | |||
359 | #else | ||
360 | uint64_t | ||
361 | crypto_cpu_caps_ia32(void) | ||
362 | { | ||
363 | return 0; | ||
364 | } | ||
365 | #endif | ||
366 | |||
367 | #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) | 333 | #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) |
368 | void | 334 | void |
369 | OPENSSL_cpuid_setup(void) | 335 | OPENSSL_cpuid_setup(void) |
@@ -379,6 +345,14 @@ crypto_cpu_caps_init(void) | |||
379 | } | 345 | } |
380 | #endif | 346 | #endif |
381 | 347 | ||
348 | #ifndef HAVE_CRYPTO_CPU_CAPS_IA32 | ||
349 | uint64_t | ||
350 | crypto_cpu_caps_ia32(void) | ||
351 | { | ||
352 | return 0; | ||
353 | } | ||
354 | #endif | ||
355 | |||
382 | uint64_t | 356 | uint64_t |
383 | OPENSSL_cpu_caps(void) | 357 | OPENSSL_cpu_caps(void) |
384 | { | 358 | { |