Skip to content

Commit

Permalink
add ifdefs to cpu_aarch64.h/c
Browse files Browse the repository at this point in the history
  • Loading branch information
billbo-yang committed Jun 5, 2023
1 parent e8c9115 commit 96ceac3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
2 changes: 0 additions & 2 deletions crypto/fipsmodule/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down
1 change: 1 addition & 0 deletions crypto/fipsmodule/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions crypto/fipsmodule/cpucap/cpu_aarch64.c
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -45,3 +47,5 @@ void handle_cpu_env(uint32_t *out, const char *in) {
out[0] = v;
}
}

#endif // OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP
4 changes: 4 additions & 0 deletions crypto/fipsmodule/cpucap/cpu_aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ extern "C" {
#include <stdlib.h>
#include <string.h>

#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
Expand Down
2 changes: 1 addition & 1 deletion crypto/fipsmodule/cpucap/cpu_aarch64_apple.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -23,6 +22,7 @@

#include <openssl/arm_arch.h>

#include "cpu_aarch64.h"

extern uint32_t OPENSSL_armcap_P;
extern uint8_t OPENSSL_cpucap_initialized;
Expand Down
2 changes: 1 addition & 1 deletion crypto/fipsmodule/cpucap/cpu_aarch64_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -26,6 +25,7 @@

#include <openssl/arm_arch.h>

#include "cpu_aarch64.h"

extern uint32_t OPENSSL_armcap_P;
extern uint8_t OPENSSL_cpucap_initialized;
Expand Down

0 comments on commit 96ceac3

Please sign in to comment.