The branch OpenSSL_1_1_0-stable has been updated
       via  8a4eee0b18cf5f927c528d6e7bd0470c1cb679cb (commit)
      from  a43cf4c0c00ac09bd83709305b5691c4010dba43 (commit)


- Log -----------------------------------------------------------------
commit 8a4eee0b18cf5f927c528d6e7bd0470c1cb679cb
Author: Andy Polyakov <[email protected]>
Date:   Sat Apr 1 15:28:28 2017 +0200

    crypto/ppccap.c: SIGILL-free processor capabilities detection on MacOS X.
    
    It seems to be problematic to probe processor capabilities with SIGILL
    on MacOS X. The problem should be limited to cases when application code
    is debugged, but crashes were reported even during normal execution...
    
    Reviewed-by: Kurt Roeckx <[email protected]>
    Reviewed-by: Richard Levitte <[email protected]>
    Reviewed-by: Rich Salz <[email protected]>
    (cherry picked from commit 0bd93bbe4ae60e5f318b298bfe617e468a7b71d0)

-----------------------------------------------------------------------

Summary of changes:
 crypto/ppccap.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/crypto/ppccap.c b/crypto/ppccap.c
index ef38b17..3baf9f7 100644
--- a/crypto/ppccap.c
+++ b/crypto/ppccap.c
@@ -22,6 +22,10 @@
 #  define __power_set(a) (_system_configuration.implementation & (a))
 # endif
 #endif
+#if defined(__APPLE__) && defined(__MACH__)
+# include <sys/types.h>
+# include <sys/sysctl.h>
+#endif
 #include <openssl/crypto.h>
 #include <openssl/bn.h>
 
@@ -230,6 +234,28 @@ void OPENSSL_cpuid_setup(void)
 # endif
 #endif
 
+#if defined(__APPLE__) && defined(__MACH__)
+    OPENSSL_ppccap_P |= PPC_FPU;
+
+    {
+        int val;
+        size_t len = sizeof(val);
+
+        if (sysctlbyname("hw.optional.64bitops", &val, &len, NULL, 0) == 0) {
+            if (val)
+                OPENSSL_ppccap_P |= PPC_FPU64;
+        }
+
+        len = sizeof(val);
+        if (sysctlbyname("hw.optional.altivec", &val, &len, NULL, 0) == 0) {
+            if (val)
+                OPENSSL_ppccap_P |= PPC_ALTIVEC;
+        }
+
+        return;
+    }
+#endif
+
     if (getauxval != NULL) {
         unsigned long hwcap = getauxval(HWCAP);
 
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to