From 12350069f382f5c9604542a187f5f13cdc426704 Mon Sep 17 00:00:00 2001 From: miod <> Date: Sun, 13 Sep 2015 10:02:49 +0000 Subject: 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@ --- src/lib/libcrypto/cryptlib.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/cryptlib.c') 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 @@ -/* $OpenBSD: cryptlib.c,v 1.35 2015/06/27 22:42:02 doug Exp $ */ +/* $OpenBSD: cryptlib.c,v 1.36 2015/09/13 10:02:49 miod Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -641,6 +641,12 @@ OPENSSL_ia32cap_loc(void) return (unsigned long *)OPENSSL_ia32cap_P; } +uint64_t +OPENSSL_cpu_caps(void) +{ + return *(uint64_t *)OPENSSL_ia32cap_P; +} + #if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) #define OPENSSL_CPUID_SETUP typedef unsigned long long IA32CAP; @@ -673,6 +679,12 @@ OPENSSL_ia32cap_loc(void) { return NULL; } + +uint64_t +OPENSSL_cpu_caps(void) +{ + return 0; +} #endif #if !defined(OPENSSL_CPUID_SETUP) && !defined(OPENSSL_CPUID_OBJ) -- cgit v1.2.3-55-g6feb