summaryrefslogtreecommitdiff
path: root/crypto/ppccap.c
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2021-01-09 14:17:29 +0000
committerMatt Caswell <matt@openssl.org>2021-01-14 08:27:14 +0000
commitb57ec7394aace731c460b509aa84039274337600 (patch)
treef9c97afefecb57179e69bcdb52fa9da4f1f9b99d /crypto/ppccap.c
parent879365e6d4a53d80e83bbe468fcf2cdd02d30ba1 (diff)
downloadopenssl-new-b57ec7394aace731c460b509aa84039274337600.tar.gz
OPENSSL_cpuid_setup FreeBSD PowerPC update
Reviewed-by: Ben Kaduk <kaduk@mit.edu> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13821)
Diffstat (limited to 'crypto/ppccap.c')
-rw-r--r--crypto/ppccap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/ppccap.c b/crypto/ppccap.c
index 4989e43221..d2adb0a441 100644
--- a/crypto/ppccap.c
+++ b/crypto/ppccap.c
@@ -229,6 +229,24 @@ size_t OPENSSL_instrument_bus2(unsigned int *out, size_t cnt, size_t max)
# endif
#endif
+#if defined(__FreeBSD__)
+# include <sys/param.h>
+# if __FreeBSD_version >= 1200000
+# include <sys/auxv.h>
+# define OSSL_IMPLEMENT_GETAUXVAL
+
+static unsigned long getauxval(unsigned long key)
+{
+ unsigned long val = 0ul;
+
+ if (elf_aux_info((int)key, &val, sizeof(val)) != 0)
+ return 0ul;
+
+ return val;
+}
+# endif
+#endif
+
/* I wish <sys/auxv.h> was universally available */
#define HWCAP 16 /* AT_HWCAP */
#define HWCAP_PPC64 (1U << 30)