Stop using unimplemented cipher classes.
[openssl.git] / crypto / ppccap.c
index b2b898e797a021aaf36088820bd040470cee2871..2f7cd8e6e7634429e0fc28a8935244f257ce5683 100644 (file)
 #  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>
 
@@ -240,6 +244,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);