]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
OPENSSL_cpuid_setup FreeBSD PowerPC update
authorDavid Carlier <devnexen@gmail.com>
Sat, 9 Jan 2021 14:17:29 +0000 (14:17 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 14 Jan 2021 08:31:03 +0000 (08:31 +0000)
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13821)

(cherry picked from commit b57ec7394aace731c460b509aa84039274337600)

crypto/ppccap.c

index b12cd949ccfe1b70b1cd1ccbb763a262cc3c176e..1d6222696561179c336367771d7d46ef45638d52 100644 (file)
@@ -214,6 +214,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)