summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/cryptlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/cryptlib.c')
-rw-r--r--src/lib/libcrypto/cryptlib.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c
index fa091fbaea..8dec9caa93 100644
--- a/src/lib/libcrypto/cryptlib.c
+++ b/src/lib/libcrypto/cryptlib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cryptlib.c,v 1.38 2016/11/04 13:56:04 miod Exp $ */ 1/* $OpenBSD: cryptlib.c,v 1.39 2016/11/04 17:30:30 miod 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 *
@@ -627,47 +627,30 @@ CRYPTO_get_lock_name(int type)
627 defined(__INTEL__) || \ 627 defined(__INTEL__) || \
628 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) 628 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
629 629
630unsigned int OPENSSL_ia32cap_P[2]; 630uint64_t OPENSSL_ia32cap_P;
631 631
632uint64_t 632uint64_t
633OPENSSL_cpu_caps(void) 633OPENSSL_cpu_caps(void)
634{ 634{
635 return *(uint64_t *)OPENSSL_ia32cap_P; 635 return OPENSSL_ia32cap_P;
636} 636}
637 637
638#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) 638#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM)
639#define OPENSSL_CPUID_SETUP 639#define OPENSSL_CPUID_SETUP
640typedef unsigned long long IA32CAP;
641void 640void
642OPENSSL_cpuid_setup(void) 641OPENSSL_cpuid_setup(void)
643{ 642{
644 static int trigger = 0; 643 static int trigger = 0;
645 IA32CAP OPENSSL_ia32_cpuid(void); 644 uint64_t OPENSSL_ia32_cpuid(void);
646 IA32CAP vec;
647 645
648 if (trigger) 646 if (trigger)
649 return; 647 return;
650 trigger = 1; 648 trigger = 1;
651 649 OPENSSL_ia32cap_P = OPENSSL_ia32_cpuid();
652 vec = OPENSSL_ia32_cpuid();
653
654 /*
655 * |(1<<10) sets a reserved bit to signal that variable
656 * was initialized already... This is to avoid interference
657 * with cpuid snippets in ELF .init segment.
658 */
659 OPENSSL_ia32cap_P[0] = (unsigned int)vec | (1 << 10);
660 OPENSSL_ia32cap_P[1] = (unsigned int)(vec >> 32);
661} 650}
662#endif 651#endif
663 652
664#else 653#else
665unsigned long *
666OPENSSL_ia32cap_loc(void)
667{
668 return NULL;
669}
670
671uint64_t 654uint64_t
672OPENSSL_cpu_caps(void) 655OPENSSL_cpu_caps(void)
673{ 656{