Add option to disable built-in aes implementation.
For time being, there are only two aes implementations for known
architectures. I define runtime detection function as const when
built-in was disabled. In this case, compiler will remove dead
built-in code.
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/aesni.c b/library/aesni.c
index 9d1c0f1..b6d1191 100644
--- a/library/aesni.c
+++ b/library/aesni.c
@@ -39,6 +39,7 @@
#include <immintrin.h>
#endif
+#if !defined(MBEDTLS_AES_HAS_NO_BUILTIN)
/*
* AES-NI support detection routine
*/
@@ -68,6 +69,7 @@
return (c & what) != 0;
}
+#endif /* !MBEDTLS_AES_HAS_NO_BUILTIN */
#if MBEDTLS_AESNI_HAVE_CODE == 2