evp/e_aes_cbc_hmac_sha*.c: limit multi-block fragmentation to 1KB.
[openssl.git] / crypto / ppccap.c
index f71ba66..2e2f3fc 100644 (file)
@@ -4,6 +4,9 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <unistd.h>
+#if defined(__linux) || defined(_AIX)
+#include <sys/utsname.h>
+#endif
 #include <crypto.h>
 #include <openssl/bn.h>
 
@@ -85,12 +88,14 @@ void OPENSSL_cpuid_setup(void)
        OPENSSL_ppccap_P = 0;
 
 #if defined(_AIX)
-       if (sizeof(size_t)==4
+       if (sizeof(size_t)==4)
+               {
+               struct utsname uts;
 # if defined(_SC_AIX_KERNEL_BITMODE)
-           && sysconf(_SC_AIX_KERNEL_BITMODE)!=64
+               if (sysconf(_SC_AIX_KERNEL_BITMODE)!=64)        return;
 # endif
-          )
-               return;
+               if (uname(&uts)!=0 || atoi(uts.version)<6)      return;
+               }
 #endif
 
        memset(&ill_act,0,sizeof(ill_act));
@@ -102,6 +107,10 @@ void OPENSSL_cpuid_setup(void)
 
        if (sizeof(size_t)==4)
                {
+#ifdef __linux
+               struct utsname uts;
+               if (uname(&uts)==0 && strcmp(uts.machine,"ppc64")==0)
+#endif
                if (sigsetjmp(ill_jmp,1) == 0)
                        {
                        OPENSSL_ppc64_probe();