Initialise OPENSSL_armcap_P to 0 before setting it based on capabilities, not after
authorTom Cosgrove <tom.cosgrove@arm.com>
Wed, 26 May 2021 15:46:00 +0000 (16:46 +0100)
committerPauli <pauli@openssl.org>
Fri, 28 May 2021 00:28:29 +0000 (10:28 +1000)
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15486)

crypto/armcap.c

index 28cadfbb2ecec8fd3f0bff6a33be79408dfa2ca9..43438e0aa4f2241d6b660ae0043d71481fee6d84 100644 (file)
@@ -133,6 +133,8 @@ void OPENSSL_cpuid_setup(void)
         return;
     trigger = 1;
 
+    OPENSSL_armcap_P = 0;
+
     if ((e = getenv("OPENSSL_armcap"))) {
         OPENSSL_armcap_P = (unsigned int)strtoul(e, NULL, 0);
         return;
@@ -166,8 +168,6 @@ void OPENSSL_cpuid_setup(void)
 #   endif
 # endif
 
-    OPENSSL_armcap_P = 0;
-
 # ifdef OSSL_IMPLEMENT_GETAUXVAL
     if (getauxval(HWCAP) & HWCAP_NEON) {
         unsigned long hwcap = getauxval(HWCAP_CE);