aes: validate keys using crc before encryption/decryption
CRC is calculated when the key is set. This commit also adds new tests
for ecb encryption and decryption, simulating a fault injection after the key is set.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
index 98df7c5..db38e81 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -2735,11 +2735,23 @@
*
* Module: library/crc.c
*
- * This module enables mbedtls_crc_update.
+ * This module enables mbedtls_crc_update().
*/
//#define MBEDTLS_CRC_C
/**
+ * \def MBEDTLS_VALIDATE_AES_KEYS_INTEGRITY
+ *
+ * Enable validation of AES keys by checking their CRC
+ * during every encryption/decryption.
+ *
+ * Module: library/aes.c
+ *
+ * Requires: MBEDTLS_CRC_C
+ */
+//#define MBEDTLS_VALIDATE_AES_KEYS_INTEGRITY
+
+/**
* \def MBEDTLS_GCM_C
*
* Enable the Galois/Counter Mode (GCM) for AES.