summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormiod <>2015-09-13 10:02:49 +0000
committermiod <>2015-09-13 10:02:49 +0000
commit12350069f382f5c9604542a187f5f13cdc426704 (patch)
tree360415740c3bcfc8c18a28a02f9843f406141836 /src/lib
parent86b9c46552e3f57d558ae8570ed33059e9418153 (diff)
downloadopenbsd-12350069f382f5c9604542a187f5f13cdc426704.tar.gz
openbsd-12350069f382f5c9604542a187f5f13cdc426704.tar.bz2
openbsd-12350069f382f5c9604542a187f5f13cdc426704.zip
Add a new interface, OPENSSL_cpu_caps(), to return the currently running
cpu's specific hardware capabilities users of libcrypto might be interested in, as an integer value. This deprecates the existing OPENSSL_ia32cap() macro and the OPENSSL_ia32cap_loc() function (which returns the pointer so that you can mess with stuff you shouldn't mess with). Interpreting the value returned by OPENSSL_cpu_caps() is, of course, machine-dependent. Minor version bump for libcrypto. ok beck@ jsing@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/cryptlib.c14
-rw-r--r--src/lib/libcrypto/crypto.h5
-rw-r--r--src/lib/libcrypto/crypto/shlib_version2
-rw-r--r--src/lib/libcrypto/shlib_version2
-rw-r--r--src/lib/libssl/src/crypto/cryptlib.c14
-rw-r--r--src/lib/libssl/src/crypto/crypto.h5
6 files changed, 36 insertions, 6 deletions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c
index 896e3d39cf..fff59f2dfd 100644
--- a/src/lib/libcrypto/cryptlib.c
+++ b/src/lib/libcrypto/cryptlib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cryptlib.c,v 1.35 2015/06/27 22:42:02 doug Exp $ */ 1/* $OpenBSD: cryptlib.c,v 1.36 2015/09/13 10:02:49 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 *
@@ -641,6 +641,12 @@ OPENSSL_ia32cap_loc(void)
641 return (unsigned long *)OPENSSL_ia32cap_P; 641 return (unsigned long *)OPENSSL_ia32cap_P;
642} 642}
643 643
644uint64_t
645OPENSSL_cpu_caps(void)
646{
647 return *(uint64_t *)OPENSSL_ia32cap_P;
648}
649
644#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) 650#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
645#define OPENSSL_CPUID_SETUP 651#define OPENSSL_CPUID_SETUP
646typedef unsigned long long IA32CAP; 652typedef unsigned long long IA32CAP;
@@ -673,6 +679,12 @@ OPENSSL_ia32cap_loc(void)
673{ 679{
674 return NULL; 680 return NULL;
675} 681}
682
683uint64_t
684OPENSSL_cpu_caps(void)
685{
686 return 0;
687}
676#endif 688#endif
677 689
678#if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) 690#if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ)
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 612b390f27..f53b858d19 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto.h,v 1.37 2015/09/10 16:35:15 jsing Exp $ */ 1/* $OpenBSD: crypto.h,v 1.38 2015/09/13 10:02:49 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 *
@@ -496,6 +496,9 @@ void OpenSSLDie(const char *file, int line, const char *assertion);
496 496
497unsigned long *OPENSSL_ia32cap_loc(void); 497unsigned long *OPENSSL_ia32cap_loc(void);
498#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) 498#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
499
500uint64_t OPENSSL_cpu_caps(void);
501
499int OPENSSL_isservice(void); 502int OPENSSL_isservice(void);
500 503
501void OPENSSL_init(void); 504void OPENSSL_init(void);
diff --git a/src/lib/libcrypto/crypto/shlib_version b/src/lib/libcrypto/crypto/shlib_version
index db69fac89e..7d59659df1 100644
--- a/src/lib/libcrypto/crypto/shlib_version
+++ b/src/lib/libcrypto/crypto/shlib_version
@@ -1,3 +1,3 @@
1# Don't forget to give libssl and libtls the same type of bump! 1# Don't forget to give libssl and libtls the same type of bump!
2major=35 2major=35
3minor=0 3minor=1
diff --git a/src/lib/libcrypto/shlib_version b/src/lib/libcrypto/shlib_version
index db69fac89e..7d59659df1 100644
--- a/src/lib/libcrypto/shlib_version
+++ b/src/lib/libcrypto/shlib_version
@@ -1,3 +1,3 @@
1# Don't forget to give libssl and libtls the same type of bump! 1# Don't forget to give libssl and libtls the same type of bump!
2major=35 2major=35
3minor=0 3minor=1
diff --git a/src/lib/libssl/src/crypto/cryptlib.c b/src/lib/libssl/src/crypto/cryptlib.c
index 896e3d39cf..fff59f2dfd 100644
--- a/src/lib/libssl/src/crypto/cryptlib.c
+++ b/src/lib/libssl/src/crypto/cryptlib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cryptlib.c,v 1.35 2015/06/27 22:42:02 doug Exp $ */ 1/* $OpenBSD: cryptlib.c,v 1.36 2015/09/13 10:02:49 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 *
@@ -641,6 +641,12 @@ OPENSSL_ia32cap_loc(void)
641 return (unsigned long *)OPENSSL_ia32cap_P; 641 return (unsigned long *)OPENSSL_ia32cap_P;
642} 642}
643 643
644uint64_t
645OPENSSL_cpu_caps(void)
646{
647 return *(uint64_t *)OPENSSL_ia32cap_P;
648}
649
644#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) 650#if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
645#define OPENSSL_CPUID_SETUP 651#define OPENSSL_CPUID_SETUP
646typedef unsigned long long IA32CAP; 652typedef unsigned long long IA32CAP;
@@ -673,6 +679,12 @@ OPENSSL_ia32cap_loc(void)
673{ 679{
674 return NULL; 680 return NULL;
675} 681}
682
683uint64_t
684OPENSSL_cpu_caps(void)
685{
686 return 0;
687}
676#endif 688#endif
677 689
678#if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) 690#if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ)
diff --git a/src/lib/libssl/src/crypto/crypto.h b/src/lib/libssl/src/crypto/crypto.h
index 612b390f27..f53b858d19 100644
--- a/src/lib/libssl/src/crypto/crypto.h
+++ b/src/lib/libssl/src/crypto/crypto.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto.h,v 1.37 2015/09/10 16:35:15 jsing Exp $ */ 1/* $OpenBSD: crypto.h,v 1.38 2015/09/13 10:02:49 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 *
@@ -496,6 +496,9 @@ void OpenSSLDie(const char *file, int line, const char *assertion);
496 496
497unsigned long *OPENSSL_ia32cap_loc(void); 497unsigned long *OPENSSL_ia32cap_loc(void);
498#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) 498#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
499
500uint64_t OPENSSL_cpu_caps(void);
501
499int OPENSSL_isservice(void); 502int OPENSSL_isservice(void);
500 503
501void OPENSSL_init(void); 504void OPENSSL_init(void);