From c628486cd93aa6ea50755e8afe059fd5ebb54664 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Wed, 16 Aug 2023 16:08:42 +0800 Subject: [PATCH] enable runtime detection when padlock enabled and plain c disabled Signed-off-by: Jerry Yu --- library/aesni.c | 3 ++- library/aesni.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/library/aesni.c b/library/aesni.c index cc3a3b3f3..427c2fdc6 100644 --- a/library/aesni.c +++ b/library/aesni.c @@ -39,7 +39,8 @@ #include #endif -#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY) +#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY) || \ + (defined(MBEDTLS_HAVE_X86) && defined(MBEDTLS_PADLOCK_C)) /* * AES-NI support detection routine */ diff --git a/library/aesni.h b/library/aesni.h index 1cf01ec9e..9e0790572 100644 --- a/library/aesni.h +++ b/library/aesni.h @@ -97,7 +97,8 @@ extern "C" { * * \return 1 if CPU has support for the feature, 0 otherwise */ -#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY) +#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY) || \ + (defined(MBEDTLS_HAVE_X86) && defined(MBEDTLS_PADLOCK_C)) int mbedtls_aesni_has_support(unsigned int what); #else #define mbedtls_aesni_has_support(what) 1