diff options
Diffstat (limited to 'src/lib/libcrypto/cryptlib.c')
| -rw-r--r-- | src/lib/libcrypto/cryptlib.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index b9ea39285d..d929b0daaa 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cryptlib.c,v 1.52 2024/07/09 07:16:44 beck Exp $ */ | 1 | /* $OpenBSD: cryptlib.c,v 1.53 2024/08/31 12:43:58 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 | * |
| @@ -125,6 +125,10 @@ | |||
| 125 | #include <openssl/crypto.h> | 125 | #include <openssl/crypto.h> |
| 126 | 126 | ||
| 127 | #include "crypto_local.h" | 127 | #include "crypto_local.h" |
| 128 | #include "x86_arch.h" | ||
| 129 | |||
| 130 | /* Machine independent capabilities. */ | ||
| 131 | uint64_t crypto_cpu_caps; | ||
| 128 | 132 | ||
| 129 | static void (*locking_callback)(int mode, int type, | 133 | static void (*locking_callback)(int mode, int type, |
| 130 | const char *file, int line) = NULL; | 134 | const char *file, int line) = NULL; |
| @@ -330,13 +334,6 @@ CRYPTO_THREADID_hash(const CRYPTO_THREADID *id) | |||
| 330 | 334 | ||
| 331 | uint64_t OPENSSL_ia32cap_P; | 335 | uint64_t OPENSSL_ia32cap_P; |
| 332 | 336 | ||
| 333 | uint64_t | ||
| 334 | OPENSSL_cpu_caps(void) | ||
| 335 | { | ||
| 336 | return OPENSSL_ia32cap_P; | ||
| 337 | } | ||
| 338 | LCRYPTO_ALIAS(OPENSSL_cpu_caps); | ||
| 339 | |||
| 340 | #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) | 337 | #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) |
| 341 | #define OPENSSL_CPUID_SETUP | 338 | #define OPENSSL_CPUID_SETUP |
| 342 | void | 339 | void |
| @@ -349,16 +346,12 @@ OPENSSL_cpuid_setup(void) | |||
| 349 | return; | 346 | return; |
| 350 | trigger = 1; | 347 | trigger = 1; |
| 351 | OPENSSL_ia32cap_P = OPENSSL_ia32_cpuid(); | 348 | OPENSSL_ia32cap_P = OPENSSL_ia32_cpuid(); |
| 349 | |||
| 350 | if ((OPENSSL_ia32cap_P & CPUCAP_MASK_AESNI) != 0) | ||
| 351 | crypto_cpu_caps |= CRYPTO_CPU_CAPS_ACCELERATED_AES; | ||
| 352 | } | 352 | } |
| 353 | #endif | 353 | #endif |
| 354 | 354 | ||
| 355 | #else | ||
| 356 | uint64_t | ||
| 357 | OPENSSL_cpu_caps(void) | ||
| 358 | { | ||
| 359 | return 0; | ||
| 360 | } | ||
| 361 | LCRYPTO_ALIAS(OPENSSL_cpu_caps); | ||
| 362 | #endif | 355 | #endif |
| 363 | 356 | ||
| 364 | #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) | 357 | #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) |
| @@ -368,6 +361,13 @@ OPENSSL_cpuid_setup(void) | |||
| 368 | } | 361 | } |
| 369 | #endif | 362 | #endif |
| 370 | 363 | ||
| 364 | uint64_t | ||
| 365 | OPENSSL_cpu_caps(void) | ||
| 366 | { | ||
| 367 | return crypto_cpu_caps; | ||
| 368 | } | ||
| 369 | LCRYPTO_ALIAS(OPENSSL_cpu_caps); | ||
| 370 | |||
| 371 | static void | 371 | static void |
| 372 | OPENSSL_showfatal(const char *fmta, ...) | 372 | OPENSSL_showfatal(const char *fmta, ...) |
| 373 | { | 373 | { |
