aports/main/openssl/auxv.patch
psykose 95f446b5cc main/openssl: use the auxv cpu detection variant on ppc/s390x/arm
(cherry picked from commit 5546ff5086e2ac2856170da17edcc61533555062)
2024-07-11 10:06:07 +00:00

69 lines
2.0 KiB
Diff

this should not be glibc guarded, as this auxv fallback always works on linux
this makes libcrypto use the auxv for cpu feature detection instead of falling
back on the sigill trapping method on these arches
--
--- a/crypto/ppccap.c
+++ b/crypto/ppccap.c
@@ -207,18 +207,8 @@ size_t OPENSSL_instrument_bus2(unsigned int *out, size_t cnt, size_t max)
return 0;
}
-#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-# if __GLIBC_PREREQ(2, 16)
-# include <sys/auxv.h>
-# define OSSL_IMPLEMENT_GETAUXVAL
-# elif defined(__ANDROID_API__)
-/* see https://developer.android.google.cn/ndk/guides/cpu-features */
-# if __ANDROID_API__ >= 18
-# include <sys/auxv.h>
-# define OSSL_IMPLEMENT_GETAUXVAL
-# endif
-# endif
-#endif
+#include <sys/auxv.h>
+#define OSSL_IMPLEMENT_GETAUXVAL
#if defined(__FreeBSD__)
# include <sys/param.h>
--- a/crypto/armcap.c
+++ b/crypto/armcap.c
@@ -66,11 +66,9 @@
void OPENSSL_cpuid_setup(void) __attribute__ ((constructor));
# endif
-# if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-# if __GLIBC_PREREQ(2, 16)
+# if 1
# include <sys/auxv.h>
# define OSSL_IMPLEMENT_GETAUXVAL
-# endif
# elif defined(__ANDROID_API__)
/* see https://developer.android.google.cn/ndk/guides/cpu-features */
# if __ANDROID_API__ >= 18
--- a/crypto/s390xcap.c
+++ b/crypto/s390xcap.c
@@ -25,10 +25,10 @@
# include <unistd.h>
#endif
-#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-# if __GLIBC_PREREQ(2, 16)
+#if 1
+# if 1
# include <sys/auxv.h>
-# if defined(HWCAP_S390_STFLE) && defined(HWCAP_S390_VX)
+# if defined(HWCAP_S390_STFLE) && defined(HWCAP_S390_VXRS)
# define OSSL_IMPLEMENT_GETAUXVAL
# endif
# endif
@@ -129,7 +129,7 @@
OPENSSL_s390x_facilities();
/* protection against disabled vector facility */
- if (!(hwcap & HWCAP_S390_VX)) {
+ if (!(hwcap & HWCAP_S390_VXRS)) {
OPENSSL_s390xcap_P.stfle[2] &= ~(S390X_CAPBIT(S390X_VX)
| S390X_CAPBIT(S390X_VXD)
| S390X_CAPBIT(S390X_VXE));