add encryption only test case
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 10687cd..a582b56 100755
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -655,3 +655,70 @@
mbedtls_psa_crypto_free( );
}
/* END_CASE */
+
+/* BEGIN_CASE */
+void aead_encrypt( int key_type_arg, char * key_hex,
+ int alg_arg, char * input_hex,
+ char * add_data, char * nonce_hex,
+ char * expected_result_hex )
+{
+ int slot = 1;
+ psa_key_type_t key_type = key_type_arg;
+ psa_algorithm_t alg = alg_arg;
+ unsigned char *key_data = NULL;
+ size_t key_size;
+ unsigned char *input_data = NULL;
+ size_t input_size;
+ unsigned char *output_data = NULL;
+ size_t output_size = 0;
+ size_t output_length = 0;
+ unsigned char *expected_result = NULL;
+ size_t expected_result_length = 0;
+ uint8_t* nonce = NULL;
+ size_t nonce_length = 0;
+ size_t tag_length = 16;
+ unsigned char *additional_data = NULL;
+ size_t additional_data_length = 0;
+
+
+ key_data = unhexify_alloc( key_hex, &key_size );
+ TEST_ASSERT( key_data != NULL );
+ input_data = unhexify_alloc( input_hex, &input_size );
+ TEST_ASSERT( input_data != NULL );
+ additional_data = unhexify_alloc( add_data, &additional_data_length );
+ TEST_ASSERT( input_data != NULL );
+ output_size = input_size + tag_length;
+ output_data = mbedtls_calloc( 1, output_size );
+ TEST_ASSERT( output_data != NULL );
+ nonce = unhexify_alloc( nonce_hex, &nonce_length );
+ TEST_ASSERT( nonce != NULL );
+ expected_result = unhexify_alloc( expected_result_hex, &expected_result_length );
+ TEST_ASSERT( expected_result != NULL );
+
+ TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
+
+ TEST_ASSERT( psa_import_key( slot, key_type,
+ key_data, key_size ) == PSA_SUCCESS );
+
+ TEST_ASSERT( psa_aead_encrypt( slot, alg,
+ nonce, nonce_length,
+ additional_data, additional_data_length,
+ input_data, input_size, output_data,
+ output_size, &output_length ) == PSA_SUCCESS );
+
+
+ TEST_ASSERT( memcmp( output_data, expected_result,
+ output_length ) == 0 );
+
+
+exit:
+ psa_destroy_key( slot );
+ mbedtls_free( key_data );
+ mbedtls_free( input_data );
+ mbedtls_free( additional_data );
+ mbedtls_free( output_data );
+ mbedtls_free( nonce );
+ mbedtls_free( expected_result );
+ mbedtls_psa_crypto_free( );
+}
+/* END_CASE */