diff --git a/crypto/fipsmodule/CMakeLists.txt b/crypto/fipsmodule/CMakeLists.txt index 2064bd0647f..62b49875e27 100644 --- a/crypto/fipsmodule/CMakeLists.txt +++ b/crypto/fipsmodule/CMakeLists.txt @@ -374,7 +374,6 @@ if(FIPS_DELOCATE) fips_shared_support.c cpucap/cpucap.c - cpucap/cpu_aarch64.c ) target_compile_definitions(fipsmodule PRIVATE BORINGSSL_IMPLEMENTATION) @@ -394,7 +393,6 @@ elseif(FIPS_SHARED) fips_shared_support.c cpucap/cpucap.c - cpucap/cpu_aarch64.c ) target_compile_definitions(fipsmodule PRIVATE BORINGSSL_IMPLEMENTATION) diff --git a/crypto/fipsmodule/bcm.c b/crypto/fipsmodule/bcm.c index c85d15c59db..64d576930e3 100644 --- a/crypto/fipsmodule/bcm.c +++ b/crypto/fipsmodule/bcm.c @@ -71,6 +71,7 @@ #include "cipher/e_aesccm.c" #include "cpucap/internal.h" +#include "cpucap/cpu_aarch64.c" #include "cpucap/cpu_aarch64_apple.c" #include "cpucap/cpu_aarch64_freebsd.c" #include "cpucap/cpu_aarch64_fuchsia.c" diff --git a/crypto/fipsmodule/cpucap/cpu_aarch64.c b/crypto/fipsmodule/cpucap/cpu_aarch64.c index df1b0732438..e94e45b61d1 100644 --- a/crypto/fipsmodule/cpucap/cpu_aarch64.c +++ b/crypto/fipsmodule/cpucap/cpu_aarch64.c @@ -1,6 +1,8 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR ISC +#if defined(OPENSSL_AARCH64) && !defined(OPENSSL_STATIC_ARMCAP) + #include "cpu_aarch64.h" void handle_cpu_env(uint32_t *out, const char *in) { @@ -45,3 +47,5 @@ void handle_cpu_env(uint32_t *out, const char *in) { out[0] = v; } } + +#endif // OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP diff --git a/crypto/fipsmodule/cpucap/cpu_aarch64.h b/crypto/fipsmodule/cpucap/cpu_aarch64.h index d6cc0b2a876..0999d58c53f 100644 --- a/crypto/fipsmodule/cpucap/cpu_aarch64.h +++ b/crypto/fipsmodule/cpucap/cpu_aarch64.h @@ -14,12 +14,16 @@ extern "C" { #include #include +#if defined(OPENSSL_AARCH64) && !defined(OPENSSL_STATIC_ARMCAP) + // cpu_aarch64 contains common functions used across multiple cpu_aarch64_* files // handle_cpu_env applies the value from |in| to the CPUID values in |out[0]|. // See the comment in |OPENSSL_cpuid_setup| about this. void handle_cpu_env(uint32_t *out, const char *in); +#endif // OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP + #if defined(__cplusplus) } #endif diff --git a/crypto/fipsmodule/cpucap/cpu_aarch64_apple.c b/crypto/fipsmodule/cpucap/cpu_aarch64_apple.c index 724e875a537..c62a21ba8f4 100644 --- a/crypto/fipsmodule/cpucap/cpu_aarch64_apple.c +++ b/crypto/fipsmodule/cpucap/cpu_aarch64_apple.c @@ -13,7 +13,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "internal.h" -#include "cpu_aarch64.h" #if defined(OPENSSL_AARCH64) && defined(OPENSSL_APPLE) && \ !defined(OPENSSL_STATIC_ARMCAP) @@ -23,6 +22,7 @@ #include +#include "cpu_aarch64.h" extern uint32_t OPENSSL_armcap_P; extern uint8_t OPENSSL_cpucap_initialized; diff --git a/crypto/fipsmodule/cpucap/cpu_aarch64_linux.c b/crypto/fipsmodule/cpucap/cpu_aarch64_linux.c index 4c336bbe4a5..aea4b5095a4 100644 --- a/crypto/fipsmodule/cpucap/cpu_aarch64_linux.c +++ b/crypto/fipsmodule/cpucap/cpu_aarch64_linux.c @@ -13,7 +13,6 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "internal.h" -#include "cpu_aarch64.h" #if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \ !defined(OPENSSL_STATIC_ARMCAP) @@ -26,6 +25,7 @@ #include +#include "cpu_aarch64.h" extern uint32_t OPENSSL_armcap_P; extern uint8_t OPENSSL_cpucap_initialized;