Add functions to set ECDSA_METHOD structure.
[openssl.git] / crypto / ppccap.c
index ab89cca..2e2f3fc 100644 (file)
@@ -3,6 +3,10 @@
 #include <string.h>
 #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>
 
@@ -53,6 +57,7 @@ static sigjmp_buf ill_jmp;
 static void ill_handler (int sig) { siglongjmp(ill_jmp,sig); }
 
 void OPENSSL_ppc64_probe(void);
+void OPENSSL_altivec_probe(void);
 
 void OPENSSL_cpuid_setup(void)
        {
@@ -82,6 +87,17 @@ void OPENSSL_cpuid_setup(void)
 
        OPENSSL_ppccap_P = 0;
 
+#if defined(_AIX)
+       if (sizeof(size_t)==4)
+               {
+               struct utsname uts;
+# if defined(_SC_AIX_KERNEL_BITMODE)
+               if (sysconf(_SC_AIX_KERNEL_BITMODE)!=64)        return;
+# endif
+               if (uname(&uts)!=0 || atoi(uts.version)<6)      return;
+               }
+#endif
+
        memset(&ill_act,0,sizeof(ill_act));
        ill_act.sa_handler = ill_handler;
        ill_act.sa_mask    = all_masked;
@@ -91,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();