@@ -165,7 +165,7 @@ static int exercise_cipher_key( psa_key_handle_t handle,
165
165
psa_key_usage_t usage,
166
166
psa_algorithm_t alg )
167
167
{
168
- psa_cipher_operation_t operation;
168
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
169
169
unsigned char iv[16] = {0};
170
170
size_t iv_length = sizeof( iv );
171
171
const unsigned char plaintext[16] = "Hello, world...";
@@ -1153,7 +1153,7 @@ void cipher_with_no_key_activity( )
1153
1153
psa_key_handle_t handle = 0;
1154
1154
psa_status_t status;
1155
1155
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
1156
- psa_cipher_operation_t operation;
1156
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
1157
1157
int exercise_alg = PSA_ALG_CTR;
1158
1158
1159
1159
PSA_ASSERT( psa_crypto_init( ) );
@@ -1210,7 +1210,7 @@ void cipher_after_import_failure( data_t *data, int type_arg,
1210
1210
int expected_import_status_arg )
1211
1211
{
1212
1212
psa_key_handle_t handle = 0;
1213
- psa_cipher_operation_t operation;
1213
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
1214
1214
psa_key_type_t type = type_arg;
1215
1215
psa_status_t status;
1216
1216
psa_status_t expected_import_status = expected_import_status_arg;
@@ -1481,7 +1481,7 @@ void cipher_key_policy( int policy_usage,
1481
1481
{
1482
1482
psa_key_handle_t handle = 0;
1483
1483
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
1484
- psa_cipher_operation_t operation;
1484
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
1485
1485
psa_status_t status;
1486
1486
1487
1487
PSA_ASSERT( psa_crypto_init( ) );
@@ -2049,6 +2049,20 @@ exit:
2049
2049
}
2050
2050
/* END_CASE */
2051
2051
2052
+ /* BEGIN_CASE */
2053
+ void cipher_operation_init()
2054
+ {
2055
+ psa_cipher_operation_t func = psa_cipher_operation_init();
2056
+ psa_cipher_operation_t init = PSA_CIPHER_OPERATION_INIT;
2057
+ psa_cipher_operation_t zero;
2058
+
2059
+ memset(&zero, 0, sizeof(zero));
2060
+
2061
+ TEST_EQUAL(memcmp(&func, &zero, sizeof(zero)), 0);
2062
+ TEST_EQUAL(memcmp(&init, &zero, sizeof(zero)), 0);
2063
+ }
2064
+ /* END_CASE */
2065
+
2052
2066
/* BEGIN_CASE */
2053
2067
void cipher_setup( int key_type_arg,
2054
2068
data_t *key,
@@ -2059,7 +2073,7 @@ void cipher_setup( int key_type_arg,
2059
2073
psa_key_type_t key_type = key_type_arg;
2060
2074
psa_algorithm_t alg = alg_arg;
2061
2075
psa_status_t expected_status = expected_status_arg;
2062
- psa_cipher_operation_t operation;
2076
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
2063
2077
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2064
2078
psa_status_t status;
2065
2079
@@ -2100,7 +2114,7 @@ void cipher_encrypt( int alg_arg, int key_type_arg,
2100
2114
size_t output_buffer_size = 0;
2101
2115
size_t function_output_length = 0;
2102
2116
size_t total_output_length = 0;
2103
- psa_cipher_operation_t operation;
2117
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
2104
2118
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2105
2119
2106
2120
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
@@ -2167,7 +2181,7 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
2167
2181
size_t output_buffer_size = 0;
2168
2182
size_t function_output_length = 0;
2169
2183
size_t total_output_length = 0;
2170
- psa_cipher_operation_t operation;
2184
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
2171
2185
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2172
2186
2173
2187
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
@@ -2237,7 +2251,7 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
2237
2251
size_t output_buffer_size = 0;
2238
2252
size_t function_output_length = 0;
2239
2253
size_t total_output_length = 0;
2240
- psa_cipher_operation_t operation;
2254
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
2241
2255
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2242
2256
2243
2257
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
@@ -2309,7 +2323,7 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
2309
2323
size_t output_buffer_size = 0;
2310
2324
size_t function_output_length = 0;
2311
2325
size_t total_output_length = 0;
2312
- psa_cipher_operation_t operation;
2326
+ psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT ;
2313
2327
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2314
2328
2315
2329
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
@@ -2379,8 +2393,8 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
2379
2393
size_t output2_size = 0;
2380
2394
size_t output2_length = 0;
2381
2395
size_t function_output_length = 0;
2382
- psa_cipher_operation_t operation1;
2383
- psa_cipher_operation_t operation2;
2396
+ psa_cipher_operation_t operation1 = PSA_CIPHER_OPERATION_INIT ;
2397
+ psa_cipher_operation_t operation2 = PSA_CIPHER_OPERATION_INIT ;
2384
2398
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2385
2399
2386
2400
PSA_ASSERT( psa_crypto_init( ) );
@@ -2464,8 +2478,8 @@ void cipher_verify_output_multipart( int alg_arg,
2464
2478
size_t output2_buffer_size = 0;
2465
2479
size_t output2_length = 0;
2466
2480
size_t function_output_length;
2467
- psa_cipher_operation_t operation1;
2468
- psa_cipher_operation_t operation2;
2481
+ psa_cipher_operation_t operation1 = PSA_CIPHER_OPERATION_INIT ;
2482
+ psa_cipher_operation_t operation2 = PSA_CIPHER_OPERATION_INIT ;
2469
2483
psa_key_policy_t policy = PSA_KEY_POLICY_INIT;
2470
2484
2471
2485
PSA_ASSERT( psa_crypto_init( ) );
0 commit comments