Don't define `OPENSSL_cpuid_setup` in NO_ASM builds.
The prototype isn't included by the preprocessor if OPENSSL_NO_ASM is
defined thus defining the function is an error.
Change-Id: I7176bb2c406f5597ae4033274141f69342a2b226
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/71167
Reviewed-by: David Benjamin <davidben@google.com>
Auto-Submit: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/cpu_aarch64_apple.c b/crypto/cpu_aarch64_apple.c
index c4fb679..6327ffa 100644
--- a/crypto/cpu_aarch64_apple.c
+++ b/crypto/cpu_aarch64_apple.c
@@ -15,7 +15,7 @@
#include "internal.h"
#if defined(OPENSSL_AARCH64) && defined(OPENSSL_APPLE) && \
- !defined(OPENSSL_STATIC_ARMCAP)
+ !defined(OPENSSL_STATIC_ARMCAP) && !defined(OPENSSL_NO_ASM)
#include <sys/sysctl.h>
#include <sys/types.h>
diff --git a/crypto/cpu_aarch64_fuchsia.c b/crypto/cpu_aarch64_fuchsia.c
index 6b2a8c8..893a9b7 100644
--- a/crypto/cpu_aarch64_fuchsia.c
+++ b/crypto/cpu_aarch64_fuchsia.c
@@ -15,7 +15,7 @@
#include "internal.h"
#if defined(OPENSSL_AARCH64) && defined(OPENSSL_FUCHSIA) && \
- !defined(OPENSSL_STATIC_ARMCAP)
+ !defined(OPENSSL_STATIC_ARMCAP) && !defined(OPENSSL_NO_ASM)
#include <zircon/features.h>
#include <zircon/syscalls.h>
diff --git a/crypto/cpu_aarch64_linux.c b/crypto/cpu_aarch64_linux.c
index 7b8aa40..ad2c86f 100644
--- a/crypto/cpu_aarch64_linux.c
+++ b/crypto/cpu_aarch64_linux.c
@@ -15,7 +15,7 @@
#include "internal.h"
#if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \
- !defined(OPENSSL_STATIC_ARMCAP)
+ !defined(OPENSSL_STATIC_ARMCAP) && !defined(OPENSSL_NO_ASM)
#include <sys/auxv.h>
diff --git a/crypto/cpu_aarch64_openbsd.c b/crypto/cpu_aarch64_openbsd.c
index 34d9304..ef3d862 100644
--- a/crypto/cpu_aarch64_openbsd.c
+++ b/crypto/cpu_aarch64_openbsd.c
@@ -15,11 +15,11 @@
#include <openssl/cpu.h>
#if defined(OPENSSL_AARCH64) && defined(OPENSSL_OPENBSD) && \
- !defined(OPENSSL_STATIC_ARMCAP)
+ !defined(OPENSSL_STATIC_ARMCAP) && !defined(OPENSSL_NO_ASM)
-#include <sys/sysctl.h>
-#include <machine/cpu.h>
#include <machine/armreg.h>
+#include <machine/cpu.h>
+#include <sys/sysctl.h>
#include <openssl/arm_arch.h>
@@ -27,7 +27,7 @@
void OPENSSL_cpuid_setup(void) {
- int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 };
+ int isar0_mib[] = {CTL_MACHDEP, CPU_ID_AA64ISAR0};
uint64_t cpu_id = 0;
size_t len = sizeof(cpu_id);
diff --git a/crypto/cpu_aarch64_sysreg.c b/crypto/cpu_aarch64_sysreg.c
index 6d4a0c8..aae5768 100644
--- a/crypto/cpu_aarch64_sysreg.c
+++ b/crypto/cpu_aarch64_sysreg.c
@@ -18,7 +18,8 @@
// expects userspace to simply read them. It traps the reads and fills in CPU
// capabilities.
#if defined(OPENSSL_AARCH64) && !defined(OPENSSL_STATIC_ARMCAP) && \
- (defined(ANDROID_BAREMETAL) || defined(OPENSSL_FREEBSD))
+ (defined(ANDROID_BAREMETAL) || defined(OPENSSL_FREEBSD)) && \
+ !defined(OPENSSL_NO_ASM)
#include <openssl/arm_arch.h>
diff --git a/crypto/cpu_aarch64_win.c b/crypto/cpu_aarch64_win.c
index 8acaf29..1955bf3 100644
--- a/crypto/cpu_aarch64_win.c
+++ b/crypto/cpu_aarch64_win.c
@@ -16,7 +16,7 @@
#include "internal.h"
#if defined(OPENSSL_AARCH64) && defined(OPENSSL_WINDOWS) && \
- !defined(OPENSSL_STATIC_ARMCAP)
+ !defined(OPENSSL_STATIC_ARMCAP) && !defined(OPENSSL_NO_ASM)
#include <windows.h>