From c2eedffb1fa9fc1573f6864a745f17f88a0ee6c3 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Mon, 9 Aug 2021 13:02:50 -0400 Subject: [PATCH] Fix a bug where intrinsics were ignored when compiling for apple silicon (#1074) * Found an error on apple silicon not reporting that it supports SHA2 instructions * Update output of test_hash Co-authored-by: Jason Goertzen --- .CMake/detect_gcc_clang_intrinsics.c | 2 +- tests/system_info.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.CMake/detect_gcc_clang_intrinsics.c b/.CMake/detect_gcc_clang_intrinsics.c index 049727e4c..eae7c736d 100644 --- a/.CMake/detect_gcc_clang_intrinsics.c +++ b/.CMake/detect_gcc_clang_intrinsics.c @@ -54,7 +54,7 @@ int main(void) { #if defined(__ARM_FEATURE_AES) printf("ARM_AES;"); #endif -#if defined(__ARM_FEATURE_SHA2) +#if (defined(__APPLE__) && defined(__aarch64__)) || defined(__ARM_FEATURE_SHA2) printf("ARM_SHA2;"); #endif #if defined(__ARM_FEATURE_SHA3) diff --git a/tests/system_info.c b/tests/system_info.c index d71ac0577..150a7ea3e 100644 --- a/tests/system_info.c +++ b/tests/system_info.c @@ -186,6 +186,8 @@ static void print_oqs_configuration(void) { #endif #if defined(OQS_USE_SHA2_OPENSSL) printf("SHA-2: OpenSSL\n"); +#elif defined(OQS_USE_ARM_SHA2_INSTRUCTIONS) + printf("SHA-2: C and ARM CRYPTO extensions\n"); #else printf("SHA-2: C\n"); #endif