Initial prototype and demonstrator for parameter validation
Adds a new configurable option for the parameter validation level.
diff --git a/library/aes.c b/library/aes.c
index b0aea00..dff424b 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -531,14 +531,7 @@
unsigned int i;
uint32_t *RK;
-#if !defined(MBEDTLS_AES_ROM_TABLES)
- if( aes_init_done == 0 )
- {
- aes_gen_tables();
- aes_init_done = 1;
-
- }
-#endif
+ MBEDTLS_AES_VALIDATE( ctx != NULL && key != NULL );
switch( keybits )
{
@@ -548,6 +541,15 @@
default : return( MBEDTLS_ERR_AES_INVALID_KEY_LENGTH );
}
+#if !defined(MBEDTLS_AES_ROM_TABLES)
+ if( aes_init_done == 0 )
+ {
+ aes_gen_tables();
+ aes_init_done = 1;
+
+ }
+#endif
+
#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_PADLOCK_ALIGN16)
if( aes_padlock_ace == -1 )
aes_padlock_ace = mbedtls_padlock_has_support( MBEDTLS_PADLOCK_ACE );