Add via padlock detection macro
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
2319af0d64
commit
9e628621b4
2 changed files with 9 additions and 7 deletions
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
#if !defined(MBEDTLS_AES_ALT)
|
#if !defined(MBEDTLS_AES_ALT)
|
||||||
|
|
||||||
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) && defined(__GNUC__)
|
#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
|
||||||
static int aes_padlock_ace = -1;
|
static int aes_padlock_ace = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ static unsigned mbedtls_aes_rk_offset(uint32_t *buf)
|
||||||
#if defined(MAY_NEED_TO_ALIGN)
|
#if defined(MAY_NEED_TO_ALIGN)
|
||||||
int align_16_bytes = 0;
|
int align_16_bytes = 0;
|
||||||
|
|
||||||
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) && defined(__GNUC__)
|
#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
|
||||||
if (aes_padlock_ace == -1) {
|
if (aes_padlock_ace == -1) {
|
||||||
aes_padlock_ace = mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE);
|
aes_padlock_ace = mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE);
|
||||||
}
|
}
|
||||||
|
@ -1102,7 +1102,7 @@ int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) && defined(__GNUC__)
|
#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
|
||||||
if (aes_padlock_ace > 0) {
|
if (aes_padlock_ace > 0) {
|
||||||
return mbedtls_padlock_xcryptecb(ctx, mode, input, output);
|
return mbedtls_padlock_xcryptecb(ctx, mode, input, output);
|
||||||
}
|
}
|
||||||
|
@ -1110,8 +1110,8 @@ int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx,
|
||||||
|
|
||||||
/* When runtime detection enabled and plain C is disabled, compiler
|
/* When runtime detection enabled and plain C is disabled, compiler
|
||||||
reports `-Werror=return-type`. */
|
reports `-Werror=return-type`. */
|
||||||
#if defined(MBEDTLS_HAVE_X86) && defined(MBEDTLS_AES_USE_HARDWARE_ONLY) && \
|
#if defined(MBEDTLS_AES_USE_HARDWARE_ONLY) && \
|
||||||
defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_AESNI_HAVE_CODE)
|
defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) && defined(MBEDTLS_AESNI_HAVE_CODE)
|
||||||
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
|
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1148,7 +1148,7 @@ int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx,
|
||||||
return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
|
return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) && defined(__GNUC__)
|
#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
|
||||||
if (aes_padlock_ace > 0) {
|
if (aes_padlock_ace > 0) {
|
||||||
if (mbedtls_padlock_xcryptcbc(ctx, mode, length, iv, input, output) == 0) {
|
if (mbedtls_padlock_xcryptcbc(ctx, mode, length, iv, input, output) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1912,7 +1912,7 @@ int mbedtls_aes_self_test(int verbose)
|
||||||
mbedtls_printf(" AES note: using AESNI.\n");
|
mbedtls_printf(" AES note: using AESNI.\n");
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) && defined(__GNUC__)
|
#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
|
||||||
if (mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE)) {
|
if (mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE)) {
|
||||||
mbedtls_printf(" AES note: using VIA Padlock.\n");
|
mbedtls_printf(" AES note: using VIA Padlock.\n");
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
|
#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
|
||||||
!defined(MBEDTLS_HAVE_ASAN)
|
!defined(MBEDTLS_HAVE_ASAN)
|
||||||
|
|
||||||
|
#define MBEDTLS_VIA_PADLOCK_HAVE_CODE
|
||||||
|
|
||||||
#ifndef MBEDTLS_HAVE_X86
|
#ifndef MBEDTLS_HAVE_X86
|
||||||
#define MBEDTLS_HAVE_X86
|
#define MBEDTLS_HAVE_X86
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue