Tests for AES encypt only
diff --git a/library/aes.c b/library/aes.c
index 733aef8..8ce31cf 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -1860,7 +1860,15 @@
mbedtls_printf( "skipped\n" );
continue;
}
-#endif
+#endif /* MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH */
+
+#if defined(MBEDTLS_AES_ONLY_ENCRYPT)
+ if( mode == MBEDTLS_AES_DECRYPT )
+ {
+ mbedtls_printf( "skipped\n" );
+ continue;
+ }
+#endif /* MBEDTLS_AES_ONLY_ENCRYPT */
mbedtls_platform_memset( buf, 0, 16 );
@@ -1932,6 +1940,14 @@
}
#endif
+#if defined(MBEDTLS_AES_ONLY_ENCRYPT)
+ if( mode == MBEDTLS_AES_DECRYPT )
+ {
+ mbedtls_printf( "skipped\n" );
+ continue;
+ }
+#endif /* MBEDTLS_AES_ONLY_ENCRYPT */
+
mbedtls_platform_memset( iv , 0, 16 );
mbedtls_platform_memset( prv, 0, 16 );
mbedtls_platform_memset( buf, 0, 16 );
@@ -2015,6 +2031,14 @@
}
#endif
+#if defined(MBEDTLS_AES_ONLY_ENCRYPT)
+ if( mode == MBEDTLS_AES_DECRYPT )
+ {
+ mbedtls_printf( "skipped\n" );
+ continue;
+ }
+#endif /* MBEDTLS_AES_ONLY_ENCRYPT */
+
memcpy( iv, aes_test_cfb128_iv, 16 );
memcpy( key, aes_test_cfb128_key[u], keybits / 8 );
@@ -2085,6 +2109,15 @@
continue;
}
#endif
+
+#if defined(MBEDTLS_AES_ONLY_ENCRYPT)
+ if( mode == MBEDTLS_AES_DECRYPT )
+ {
+ mbedtls_printf( "skipped\n" );
+ continue;
+ }
+#endif /* MBEDTLS_AES_ONLY_ENCRYPT */
+
memcpy( iv, aes_test_ofb_iv, 16 );
memcpy( key, aes_test_ofb_key[u], keybits / 8 );
@@ -2155,6 +2188,14 @@
}
#endif
+#if defined(MBEDTLS_AES_ONLY_ENCRYPT)
+ if( mode == MBEDTLS_AES_DECRYPT )
+ {
+ mbedtls_printf( "skipped\n" );
+ continue;
+ }
+#endif /* MBEDTLS_AES_ONLY_ENCRYPT */
+
memcpy( nonce_counter, aes_test_ctr_nonce_counter[u], 16 );
memcpy( key, aes_test_ctr_key[u], 16 );
@@ -2215,6 +2256,14 @@
mbedtls_printf( " AES-XTS-128 (%s): ",
( mode == MBEDTLS_AES_DECRYPT ) ? "dec" : "enc" );
+#if defined(MBEDTLS_AES_ONLY_ENCRYPT)
+ if( mode == MBEDTLS_AES_DECRYPT )
+ {
+ mbedtls_printf( "skipped\n" );
+ continue;
+ }
+#endif /* MBEDTLS_AES_ONLY_ENCRYPT */
+
mbedtls_platform_memset( key, 0, sizeof( key ) );
memcpy( key, aes_test_xts_key[u], 32 );
data_unit = aes_test_xts_data_unit[u];