aria: rationalize buffer sizes in test functions
diff --git a/include/mbedtls/aria.h b/include/mbedtls/aria.h
index b361750..2eed2f9 100644
--- a/include/mbedtls/aria.h
+++ b/include/mbedtls/aria.h
@@ -42,8 +42,9 @@
 #define MBEDTLS_ARIA_ENCRYPT     1 /**< ARIA encryption. */
 #define MBEDTLS_ARIA_DECRYPT     0 /**< ARIA decryption. */
 
-#define MBEDTLS_ARIA_BLOCKSIZE  16 /**< ARIA block size in bytes. */
-#define MBEDTLS_ARIA_MAX_ROUNDS 16 /**< Maxiumum number of rounds in ARIA. */
+#define MBEDTLS_ARIA_BLOCKSIZE   16 /**< ARIA block size in bytes. */
+#define MBEDTLS_ARIA_MAX_ROUNDS  16 /**< Maxiumum number of rounds in ARIA. */
+#define MBEDTLS_ARIA_MAX_KEYSIZE 32 /**< Maximum size of an ARIA key in bytes. */
 
 #define MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH   -0x005C  /**< Invalid key length. */
 #define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E  /**< Invalid data input length. */
diff --git a/tests/suites/test_suite_aria.function b/tests/suites/test_suite_aria.function
index 38fc7e3..b363406 100644
--- a/tests/suites/test_suite_aria.function
+++ b/tests/suites/test_suite_aria.function
@@ -1,5 +1,14 @@
 /* BEGIN_HEADER */
 #include "mbedtls/aria.h"
+
+/* Maxium size of data used by test vectors
+ * WARNING: to be adapted if and when adding larger test cases */
+#define ARIA_MAX_DATASIZE  160
+
+/* Maximum sizes of hexified things */
+#define ARIA_MAX_KEY_STR    ( 2 * MBEDTLS_ARIA_MAX_KEYSIZE + 1 )
+#define ARIA_BLOCK_STR      ( 2 * MBEDTLS_ARIA_BLOCKSIZE + 1 )
+#define ARIA_MAX_DATA_STR   ( 2 * ARIA_MAX_DATASIZE + 1 )
 /* END_HEADER */
 
 /* BEGIN_DEPENDENCIES
@@ -11,17 +20,17 @@
 void aria_encrypt_ecb( char *hex_key_string, char *hex_src_string,
                        char *hex_dst_string, int setkey_result )
 {
-    unsigned char key_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     int key_len, data_len, i;
 
-    memset( key_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -31,7 +40,7 @@
                  == setkey_result );
     if( setkey_result == 0 )
     {
-        for( i = 0; i < data_len; i += 16 )
+        for( i = 0; i < data_len; i += MBEDTLS_ARIA_BLOCKSIZE )
         {
             TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, MBEDTLS_ARIA_ENCRYPT,
                          src_str + i, output + i ) == 0 );
@@ -50,17 +59,17 @@
 void aria_decrypt_ecb( char *hex_key_string, char *hex_src_string,
                        char *hex_dst_string, int setkey_result )
 {
-    unsigned char key_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     int key_len, data_len, i;
 
-    memset( key_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -70,7 +79,7 @@
                  == setkey_result );
     if( setkey_result == 0 )
     {
-        for( i = 0; i < data_len; i += 16 )
+        for( i = 0; i < data_len; i += MBEDTLS_ARIA_BLOCKSIZE )
         {
             TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, MBEDTLS_ARIA_DECRYPT,
             src_str + i, output + i ) == 0 );
@@ -90,19 +99,19 @@
                        char *hex_src_string, char *hex_dst_string,
                        int cbc_result )
 {
-    unsigned char key_str[1000];
-    unsigned char iv_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char iv_str[ARIA_BLOCK_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     int key_len, data_len;
 
-    memset( key_str, 0x00, 1000 );
-    memset( iv_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( iv_str, 0x00, sizeof( iv_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -130,19 +139,19 @@
                        char *hex_src_string, char *hex_dst_string,
                        int cbc_result )
 {
-    unsigned char key_str[1000];
-    unsigned char iv_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char iv_str[ARIA_BLOCK_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     int key_len, data_len;
 
-    memset( key_str, 0x00, 1000 );
-    memset( iv_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( iv_str, 0x00, sizeof( iv_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -170,20 +179,20 @@
                           char *hex_src_string, char *hex_dst_string,
                           int result )
 {
-    unsigned char key_str[1000];
-    unsigned char iv_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char iv_str[ARIA_BLOCK_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
     int key_len, data_len;
 
-    memset( key_str, 0x00, 1000 );
-    memset( iv_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( iv_str, 0x00, sizeof( iv_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -208,20 +217,20 @@
                           char *hex_src_string, char *hex_dst_string,
                           int result  )
 {
-    unsigned char key_str[1000];
-    unsigned char iv_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char iv_str[ARIA_BLOCK_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
     int key_len, data_len;
 
-    memset( key_str, 0x00, 1000 );
-    memset( iv_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( iv_str, 0x00, sizeof( iv_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -246,21 +255,21 @@
                        char *hex_src_string, char *hex_dst_string,
                        int result )
 {
-    unsigned char key_str[1000];
-    unsigned char iv_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
-    unsigned char blk[16];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char iv_str[ARIA_BLOCK_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
+    unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
     int key_len, data_len;
 
-    memset( key_str, 0x00, 1000 );
-    memset( iv_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( iv_str, 0x00, sizeof( iv_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );
@@ -284,21 +293,21 @@
                        char *hex_src_string, char *hex_dst_string,
                        int result )
 {
-    unsigned char key_str[1000];
-    unsigned char iv_str[1000];
-    unsigned char src_str[1000];
-    unsigned char dst_str[1000];
-    unsigned char output[1000];
-    unsigned char blk[16];
+    unsigned char key_str[ARIA_MAX_KEY_STR];
+    unsigned char iv_str[ARIA_BLOCK_STR];
+    unsigned char src_str[ARIA_MAX_DATA_STR];
+    unsigned char dst_str[ARIA_MAX_DATA_STR];
+    unsigned char output[ARIA_MAX_DATASIZE];
+    unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
     int key_len, data_len;
 
-    memset( key_str, 0x00, 1000 );
-    memset( iv_str, 0x00, 1000 );
-    memset( src_str, 0x00, 1000 );
-    memset( dst_str, 0x00, 1000 );
-    memset( output, 0x00, 1000 );
+    memset( key_str, 0x00, sizeof( key_str ) );
+    memset( iv_str, 0x00, sizeof( iv_str ) );
+    memset( src_str, 0x00, sizeof( src_str ) );
+    memset( dst_str, 0x00, sizeof( dst_str ) );
+    memset( output, 0x00, sizeof( output ) );
     mbedtls_aria_init( &ctx );
 
     key_len = unhexify( key_str, hex_key_string );