- Changed interface for AES and Camellia setkey functions to indicate invalid key lengths.
diff --git a/tests/suites/test_suite_camellia.function b/tests/suites/test_suite_camellia.function
index 7507fea..408fb6c 100644
--- a/tests/suites/test_suite_camellia.function
+++ b/tests/suites/test_suite_camellia.function
@@ -3,7 +3,7 @@
END_HEADER
BEGIN_CASE
-camellia_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string
+camellia_encrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result
{
unsigned char key_str[100];
unsigned char src_str[100];
@@ -20,16 +20,19 @@
key_len = unhexify( key_str, {hex_key_string} );
unhexify( src_str, {hex_src_string} );
- camellia_setkey_enc( &ctx, key_str, key_len * 8 );
- camellia_crypt_ecb( &ctx, CAMELLIA_ENCRYPT, src_str, output );
- hexify( dst_str, output, 16 );
+ TEST_ASSERT( camellia_setkey_enc( &ctx, key_str, key_len * 8 ) == {setkey_result} );
+ if( {setkey_result} == 0 )
+ {
+ camellia_crypt_ecb( &ctx, CAMELLIA_ENCRYPT, src_str, output );
+ hexify( dst_str, output, 16 );
- TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
+ TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
+ }
}
END_CASE
BEGIN_CASE
-camellia_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string
+camellia_decrypt_ecb:hex_key_string:hex_src_string:hex_dst_string:setkey_result
{
unsigned char key_str[100];
unsigned char src_str[100];
@@ -46,11 +49,14 @@
key_len = unhexify( key_str, {hex_key_string} );
unhexify( src_str, {hex_src_string} );
- camellia_setkey_dec( &ctx, key_str, key_len * 8 );
- camellia_crypt_ecb( &ctx, CAMELLIA_DECRYPT, src_str, output );
- hexify( dst_str, output, 16 );
+ TEST_ASSERT( camellia_setkey_dec( &ctx, key_str, key_len * 8 ) == {setkey_result} );
+ if( {setkey_result} == 0 )
+ {
+ camellia_crypt_ecb( &ctx, CAMELLIA_DECRYPT, src_str, output );
+ hexify( dst_str, output, 16 );
- TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
+ TEST_ASSERT( strcasecmp( (char *) dst_str, {hex_dst_string} ) == 0 );
+ }
}
END_CASE