Skip to content

Commit 0ab4262

Browse files
committed
AES-NI: Disable round keys realignment in mbedtls_aes_crypt_ecb()
Mbed TLS takes care of the alignment when creating the round keys (placing them accordingly within the larger context struct) and we hope we're not copying them to differently-aligned context structs (if we are, we'll need to fix that). See openwall#5593
1 parent e2a1b64 commit 0ab4262

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/mbedtls/aes.c

+5
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,8 @@ int mbedtls_internal_aes_decrypt(mbedtls_aes_context *ctx,
10001000
}
10011001
#endif /* !MBEDTLS_AES_DECRYPT_ALT && !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
10021002

1003+
/* Should be unneeded in JtR */
1004+
#if 0
10031005
/* VIA Padlock and our intrinsics-based implementation of AESNI require
10041006
* the round keys to be aligned on a 16-byte boundary. We take care of this
10051007
* before creating them, but the AES context may have moved (this can happen
@@ -1017,6 +1019,9 @@ MBEDTLS_MAYBE_UNUSED static void aes_maybe_realign(mbedtls_aes_context *ctx)
10171019
ctx->rk_offset = new_offset;
10181020
}
10191021
}
1022+
#else
1023+
#undef MAY_NEED_TO_ALIGN
1024+
#endif
10201025

10211026
/*
10221027
* AES-ECB block encryption/decryption

0 commit comments

Comments
 (0)