Fix test output size

1. set output size to safe value
2. set output size correctly
3. check correct length of actual output
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index b6ba9b4..caa0abd 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -638,14 +638,16 @@
     unsigned char *input_data = NULL;
     size_t input_size;
     unsigned char *output = NULL;
-    size_t output_size = 4096;
+    size_t output_size = 0;
     size_t output_length = 0;
     unsigned char *output2 = NULL;
-    size_t output2_size = 4096;
+    size_t output2_size = 0;
     size_t output2_length = 0;
 
     key_data = unhexify_alloc( key_hex, &key_size );
     TEST_ASSERT( key_data != NULL );
+    output_size = key_size;
+    output2_size = key_size;
     input_data = unhexify_alloc( input_hex, &input_size );
     TEST_ASSERT( input_data != NULL );
     output = mbedtls_calloc( 1, output_size );
@@ -704,19 +706,19 @@
     unsigned char *input_data = NULL;
     size_t input_size;
     unsigned char *output = NULL;
-    size_t output_size = 4096;
+    size_t output_size = 0;
     size_t output_length = 0;
     psa_status_t actual_status;
     psa_status_t expected_status = expected_status_arg;
 
     key_data = unhexify_alloc( key_hex, &key_size );
     TEST_ASSERT( key_data != NULL );
+    output_size = key_size;
     input_data = unhexify_alloc( input_hex, &input_size );
     TEST_ASSERT( input_data != NULL );
     output = mbedtls_calloc( 1, output_size );
     TEST_ASSERT( output != NULL );
 
-
     TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
 
     TEST_ASSERT( psa_import_key( slot, key_type,
@@ -756,11 +758,13 @@
     unsigned char *expected_data = NULL;
     size_t expected_data_size;
     unsigned char *output = NULL;
-    size_t output_size = 4096;
+    size_t output_size = 0;
     size_t output_length = 0;
+    psa_key_policy_t policy = {0};
 
     key_data = unhexify_alloc( key_hex, &key_size );
     TEST_ASSERT( key_data != NULL );
+    output_size = key_size;
     input_data = unhexify_alloc( input_hex, &input_size );
     TEST_ASSERT( input_data != NULL );
     expected_data = unhexify_alloc( expected_hex, &expected_data_size );
@@ -768,7 +772,6 @@
     output = mbedtls_calloc( 1, output_size );
     TEST_ASSERT( output != NULL );
 
-
     TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
 
     TEST_ASSERT( psa_import_key( slot, key_type,
@@ -782,7 +785,7 @@
                                     output_size,
                                     &output_length) == PSA_SUCCESS );
     TEST_ASSERT( ((size_t)expected_size) == output_length );
-    TEST_ASSERT( memcmp( expected_data, output, (output_length/8) ) == 0 );
+    TEST_ASSERT( memcmp( expected_data, output, (output_length) ) == 0 );
 
 exit:
     psa_destroy_key( slot );
@@ -811,19 +814,19 @@
     unsigned char *input_data = NULL;
     size_t input_size;
     unsigned char *output = NULL;
-    size_t output_size = 4096;
+    size_t output_size = 0;
     size_t output_length = 0;
     psa_status_t actual_status;
     psa_status_t expected_status = expected_status_arg;
 
     key_data = unhexify_alloc( key_hex, &key_size );
     TEST_ASSERT( key_data != NULL );
+    output_size = key_size;
     input_data = unhexify_alloc( input_hex, &input_size );
     TEST_ASSERT( input_data != NULL );
     output = mbedtls_calloc( 1, output_size );
     TEST_ASSERT( output != NULL );
 
-
     TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
 
     TEST_ASSERT( psa_import_key( slot, key_type,