Drop support for VIA Padlock
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
diff --git a/library/aes.c b/library/aes.c
index b1a5c3e..aaea70b 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -30,21 +30,6 @@
#endif
#endif
-#if defined(MBEDTLS_ARCH_IS_X86)
-#if defined(MBEDTLS_PADLOCK_C)
-#if !defined(MBEDTLS_HAVE_ASM)
-#error "MBEDTLS_PADLOCK_C defined, but not all prerequisites"
-#endif
-#if defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
-#error "MBEDTLS_AES_USE_HARDWARE_ONLY cannot be defined when " \
- "MBEDTLS_PADLOCK_C is set"
-#endif
-#endif
-#endif
-
-#if defined(MBEDTLS_PADLOCK_C)
-#include "padlock.h"
-#endif
#if defined(MBEDTLS_AESNI_C)
#include "aesni.h"
#endif
@@ -67,10 +52,6 @@
#if !defined(MBEDTLS_AES_ALT)
-#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
-static int aes_padlock_ace = -1;
-#endif
-
#if defined(MBEDTLS_AES_ROM_TABLES)
/*
* Forward S-box
@@ -527,8 +508,7 @@
* Note that the offset is in units of elements of buf, i.e. 32-bit words,
* i.e. an offset of 1 means 4 bytes and so on.
*/
-#if (defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)) || \
- (defined(MBEDTLS_AESNI_C) && MBEDTLS_AESNI_HAVE_CODE == 2)
+#if (defined(MBEDTLS_AESNI_C) && MBEDTLS_AESNI_HAVE_CODE == 2)
#define MAY_NEED_TO_ALIGN
#endif
@@ -537,15 +517,6 @@
#if defined(MAY_NEED_TO_ALIGN)
int align_16_bytes = 0;
-#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
- if (aes_padlock_ace == -1) {
- aes_padlock_ace = mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE);
- }
- if (aes_padlock_ace) {
- align_16_bytes = 1;
- }
-#endif
-
#if defined(MBEDTLS_AESNI_C) && MBEDTLS_AESNI_HAVE_CODE == 2
if (mbedtls_aesni_has_support(MBEDTLS_AESNI_AES)) {
align_16_bytes = 1;
@@ -1000,12 +971,13 @@
}
#endif /* !MBEDTLS_AES_DECRYPT_ALT && !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
-/* VIA Padlock and our intrinsics-based implementation of AESNI require
- * the round keys to be aligned on a 16-byte boundary. We take care of this
- * before creating them, but the AES context may have moved (this can happen
- * if the library is called from a language with managed memory), and in later
- * calls it might have a different alignment with respect to 16-byte memory.
- * So we may need to realign.
+/*
+ * Our intrinsics-based implementation of AESNI require the round keys to be
+ * aligned on a 16-byte boundary. We take care of this before creating them,
+ * but the AES context may have moved (this can happen if the library is
+ * called from a language with managed memory), and in later calls it might
+ * have a different alignment with respect to 16-byte memory. So we may need
+ * to realign.
*/
MBEDTLS_MAYBE_UNUSED static void aes_maybe_realign(mbedtls_aes_context *ctx)
{
@@ -1046,12 +1018,6 @@
}
#endif
-#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
- if (aes_padlock_ace > 0) {
- return mbedtls_padlock_xcryptecb(ctx, mode, input, output);
- }
-#endif
-
#if !defined(MBEDTLS_AES_USE_HARDWARE_ONLY)
#if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
if (mode == MBEDTLS_AES_DECRYPT) {
@@ -1092,18 +1058,6 @@
return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
}
-#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
- if (aes_padlock_ace > 0) {
- if (mbedtls_padlock_xcryptcbc(ctx, mode, length, iv, input, output) == 0) {
- return 0;
- }
-
- // If padlock data misaligned, we just fall back to
- // unaccelerated mode
- //
- }
-#endif
-
const unsigned char *ivp = iv;
if (mode == MBEDTLS_AES_DECRYPT) {
@@ -1860,11 +1814,6 @@
mbedtls_printf(" AES note: using AESNI.\n");
} else
#endif
-#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
- if (mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE)) {
- mbedtls_printf(" AES note: using VIA Padlock.\n");
- } else
-#endif
#if defined(MBEDTLS_AESCE_HAVE_CODE)
if (MBEDTLS_AESCE_HAS_SUPPORT()) {
mbedtls_printf(" AES note: using AESCE.\n");