summaryrefslogtreecommitdiffstats
path: root/crypto/ppccap.c
diff options
context:
space:
mode:
authorpkubaj <pkubaj@FreeBSD.org>2021-11-20 20:40:06 +0000
committerTomas Mraz <tomas@openssl.org>2022-11-09 15:29:59 +0100
commit923140bd0036ac629cbaa712fbc2d8c11f7854fa (patch)
tree488798c98fcfdf7dbd8bfd4549fd91d2355c8434 /crypto/ppccap.c
parent3d2b47bcdf8cf407ef1e459d54d4501cc19f0227 (diff)
Add support for BSD-ppc, BSD-ppc64 and BSD-ppc64le configurations
OpenSSL assumes AT_HWCAP = 16 (as on Linux), but on FreeBSD AT_HWCAP = 25 Switch to using AT_HWCAP, and setting it to 16 if it is not defined. CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17090) (cherry picked from commit f5485b97b6c9977c0d39c7669b9f97a879312447)
Diffstat (limited to 'crypto/ppccap.c')
-rw-r--r--crypto/ppccap.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/crypto/ppccap.c b/crypto/ppccap.c
index 8bcfed25e0..7d7634138f 100644
--- a/crypto/ppccap.c
+++ b/crypto/ppccap.c
@@ -117,14 +117,18 @@ static unsigned long getauxval(unsigned long key)
#endif
/* I wish <sys/auxv.h> was universally available */
-#define HWCAP 16 /* AT_HWCAP */
+#ifndef AT_HWCAP
+# define AT_HWCAP 16 /* AT_HWCAP */
+#endif
#define HWCAP_PPC64 (1U << 30)
#define HWCAP_ALTIVEC (1U << 28)
#define HWCAP_FPU (1U << 27)
#define HWCAP_POWER6_EXT (1U << 9)
#define HWCAP_VSX (1U << 7)
-#define HWCAP2 26 /* AT_HWCAP2 */
+#ifndef AT_HWCAP2
+# define AT_HWCAP2 26 /* AT_HWCAP2 */
+#endif
#define HWCAP_VEC_CRYPTO (1U << 25)
#define HWCAP_ARCH_3_00 (1U << 23)
@@ -215,8 +219,8 @@ void OPENSSL_cpuid_setup(void)
#ifdef OSSL_IMPLEMENT_GETAUXVAL
{
- unsigned long hwcap = getauxval(HWCAP);
- unsigned long hwcap2 = getauxval(HWCAP2);
+ unsigned long hwcap = getauxval(AT_HWCAP);
+ unsigned long hwcap2 = getauxval(AT_HWCAP2);
if (hwcap & HWCAP_FPU) {
OPENSSL_ppccap_P |= PPC_FPU;