From: David Carlier Date: Wed, 9 Dec 2020 20:23:32 +0000 (+0000) Subject: OPENSSL_cpuid_setup FreeBSD arm update. X-Git-Tag: openssl-3.0.0-alpha11~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eb24fbd1c3e0d130ba7f81f1ccf457a2b9d75ad;p=thirdparty%2Fopenssl.git OPENSSL_cpuid_setup FreeBSD arm update. when possible using the getauxval equivalent which has similar ids as Linux, instead of bad instructions catch approach. Reviewed-by: Ben Kaduk Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/13650) --- diff --git a/crypto/armcap.c b/crypto/armcap.c index 7bd82f8ebc4..6c0acda2445 100644 --- a/crypto/armcap.c +++ b/crypto/armcap.c @@ -71,6 +71,23 @@ void OPENSSL_cpuid_setup(void) __attribute__ ((constructor)); # define OSSL_IMPLEMENT_GETAUXVAL # endif # endif +# if defined(__FreeBSD__) +# include +# if __FreeBSD_version >= 1200000 +# include +# 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 /* * ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas