crypto/ppccap.c: Fix which hwcap value used to check for HWCAP_ARCH_3_00
authorRashmica Gupta <rashmica.g@gmail.com>
Tue, 7 May 2019 02:42:59 +0000 (12:42 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 9 May 2019 04:19:46 +0000 (14:19 +1000)
CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8889)

crypto/ppccap.c

index 9601674041020e2cb65d725ecb771a7f1a53ff3a..0d5ab794bd15504ce37cc74de562f7200d62e130 100644 (file)
@@ -323,6 +323,7 @@ void OPENSSL_cpuid_setup(void)
 #ifdef OSSL_IMPLEMENT_GETAUXVAL
     {
         unsigned long hwcap = getauxval(HWCAP);
+        unsigned long hwcap2 = getauxval(HWCAP2);
 
         if (hwcap & HWCAP_FPU) {
             OPENSSL_ppccap_P |= PPC_FPU;
@@ -341,11 +342,11 @@ void OPENSSL_cpuid_setup(void)
         if (hwcap & HWCAP_ALTIVEC) {
             OPENSSL_ppccap_P |= PPC_ALTIVEC;
 
-            if ((hwcap & HWCAP_VSX) && (getauxval(HWCAP2) & HWCAP_VEC_CRYPTO))
+            if ((hwcap & HWCAP_VSX) && (hwcap2 & HWCAP_VEC_CRYPTO))
                 OPENSSL_ppccap_P |= PPC_CRYPTO207;
         }
 
-        if (hwcap & HWCAP_ARCH_3_00) {
+        if (hwcap2 & HWCAP_ARCH_3_00) {
             OPENSSL_ppccap_P |= PPC_MADD300;
         }
     }