Add guards for arm_neon.h
See: https://arm-software.github.io/acle/main/acle.html#arm_neonh
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/aesce.c b/library/aesce.c
index b46a0e4..d939e4a 100644
--- a/library/aesce.c
+++ b/library/aesce.c
@@ -66,7 +66,11 @@
# endif
#endif
+#ifdef __ARM_NEON
#include <arm_neon.h>
+#else
+#error "Target does not support NEON instructions"
+#endif
#if !(defined(__ARM_FEATURE_CRYPTO) || defined(__ARM_FEATURE_AES)) || \
defined(MBEDTLS_ENABLE_ARM_CRYPTO_EXTENSIONS_COMPILER_FLAG)
diff --git a/library/sha256.c b/library/sha256.c
index ae1b35c..104fa80 100644
--- a/library/sha256.c
+++ b/library/sha256.c
@@ -62,7 +62,13 @@
defined(MBEDTLS_SHA256_USE_A64_CRYPTO_ONLY)
/* *INDENT-OFF* */
-# include <arm_neon.h>
+
+# ifdef __ARM_NEON
+# include <arm_neon.h>
+# else
+# error "Target does not support NEON instructions"
+# endif
+
# if !defined(__ARM_FEATURE_CRYPTO) || defined(MBEDTLS_ENABLE_ARM_CRYPTO_EXTENSIONS_COMPILER_FLAG)
# if defined(__clang__)
# if __clang_major__ < 4
diff --git a/library/sha512.c b/library/sha512.c
index fc7de74..3b68801 100644
--- a/library/sha512.c
+++ b/library/sha512.c
@@ -60,7 +60,11 @@
# if defined(MBEDTLS_SHA512_USE_A64_CRYPTO_IF_PRESENT) || \
defined(MBEDTLS_SHA512_USE_A64_CRYPTO_ONLY)
/* *INDENT-OFF* */
-# include <arm_neon.h>
+# ifdef __ARM_NEON
+# include <arm_neon.h>
+# else
+# error "Target does not support NEON instructions"
+# endif
/*
* Best performance comes from most recent compilers, with intrinsics and -O3.
* Must compile with -march=armv8.2-a+sha3, but we can't detect armv8.2-a, and