Skip to content

Commit 1f2aa0e

Browse files
Remove useless null checks of data_t* parameters
The test framework never passes NULL for a data_t* parameter, so testing them against NULL is clutter.
1 parent 40ab95b commit 1f2aa0e

File tree

1 file changed

+0
-70
lines changed

1 file changed

+0
-70
lines changed

tests/suites/test_suite_psa_crypto.function

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ void import( data_t *data, int type, int expected_status_arg )
877877
psa_status_t expected_status = expected_status_arg;
878878
psa_status_t status;
879879

880-
TEST_ASSERT( data != NULL );
881880
PSA_ASSERT( psa_crypto_init( ) );
882881

883882
PSA_ASSERT( psa_allocate_key( type, KEY_BITS_FROM_DATA( type, data ),
@@ -995,7 +994,6 @@ void import_export( data_t *data,
995994
size_t got_bits;
996995
psa_key_policy_t policy;
997996

998-
TEST_ASSERT( data != NULL );
999997
export_size = (ptrdiff_t) data->len + export_size_delta;
1000998
ASSERT_ALLOC( exported, export_size );
1001999
if( ! canonical_input )
@@ -2005,10 +2003,6 @@ void mac_verify( int key_type_arg,
20052003

20062004
TEST_ASSERT( expected_mac->len <= PSA_MAC_MAX_SIZE );
20072005

2008-
TEST_ASSERT( key != NULL );
2009-
TEST_ASSERT( input != NULL );
2010-
TEST_ASSERT( expected_mac != NULL );
2011-
20122006
PSA_ASSERT( psa_crypto_init( ) );
20132007

20142008
PSA_ASSERT( psa_allocate_key( key_type, PSA_BYTES_TO_BITS( key->len ),
@@ -2090,10 +2084,6 @@ void cipher_encrypt( int alg_arg, int key_type_arg,
20902084
psa_cipher_operation_t operation;
20912085
psa_key_policy_t policy;
20922086

2093-
TEST_ASSERT( key != NULL );
2094-
TEST_ASSERT( input != NULL );
2095-
TEST_ASSERT( expected_output != NULL );
2096-
20972087
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
20982088
memset( iv, 0x2a, iv_size );
20992089

@@ -2162,10 +2152,6 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
21622152
psa_cipher_operation_t operation;
21632153
psa_key_policy_t policy;
21642154

2165-
TEST_ASSERT( key != NULL );
2166-
TEST_ASSERT( input != NULL );
2167-
TEST_ASSERT( expected_output != NULL );
2168-
21692155
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
21702156
memset( iv, 0x2a, iv_size );
21712157

@@ -2237,10 +2223,6 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
22372223
psa_cipher_operation_t operation;
22382224
psa_key_policy_t policy;
22392225

2240-
TEST_ASSERT( key != NULL );
2241-
TEST_ASSERT( input != NULL );
2242-
TEST_ASSERT( expected_output != NULL );
2243-
22442226
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
22452227
memset( iv, 0x2a, iv_size );
22462228

@@ -2314,10 +2296,6 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
23142296
psa_cipher_operation_t operation;
23152297
psa_key_policy_t policy;
23162298

2317-
TEST_ASSERT( key != NULL );
2318-
TEST_ASSERT( input != NULL );
2319-
TEST_ASSERT( expected_output != NULL );
2320-
23212299
iv_size = PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
23222300
memset( iv, 0x2a, iv_size );
23232301

@@ -2390,9 +2368,6 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
23902368
psa_cipher_operation_t operation2;
23912369
psa_key_policy_t policy;
23922370

2393-
TEST_ASSERT( key != NULL );
2394-
TEST_ASSERT( input != NULL );
2395-
23962371
PSA_ASSERT( psa_crypto_init( ) );
23972372

23982373
PSA_ASSERT( psa_allocate_key( key_type, PSA_BYTES_TO_BITS( key->len ),
@@ -2479,9 +2454,6 @@ void cipher_verify_output_multipart( int alg_arg,
24792454
psa_cipher_operation_t operation2;
24802455
psa_key_policy_t policy;
24812456

2482-
TEST_ASSERT( key != NULL );
2483-
TEST_ASSERT( input != NULL );
2484-
24852457
PSA_ASSERT( psa_crypto_init( ) );
24862458

24872459
PSA_ASSERT( psa_allocate_key( key_type, PSA_BYTES_TO_BITS( key->len ),
@@ -2583,11 +2555,6 @@ void aead_encrypt_decrypt( int key_type_arg, data_t *key_data,
25832555
psa_status_t expected_result = expected_result_arg;
25842556
psa_key_policy_t policy;
25852557

2586-
TEST_ASSERT( key_data != NULL );
2587-
TEST_ASSERT( input_data != NULL );
2588-
TEST_ASSERT( nonce != NULL );
2589-
TEST_ASSERT( additional_data != NULL );
2590-
25912558
output_size = input_data->len + tag_length;
25922559
ASSERT_ALLOC( output_data, output_size );
25932560

@@ -2655,12 +2622,6 @@ void aead_encrypt( int key_type_arg, data_t *key_data,
26552622
size_t tag_length = 16;
26562623
psa_key_policy_t policy;
26572624

2658-
TEST_ASSERT( key_data != NULL );
2659-
TEST_ASSERT( input_data != NULL );
2660-
TEST_ASSERT( additional_data != NULL );
2661-
TEST_ASSERT( nonce != NULL );
2662-
TEST_ASSERT( expected_result != NULL );
2663-
26642625
output_size = input_data->len + tag_length;
26652626
ASSERT_ALLOC( output_data, output_size );
26662627

@@ -2712,12 +2673,6 @@ void aead_decrypt( int key_type_arg, data_t *key_data,
27122673
psa_key_policy_t policy;
27132674
psa_status_t expected_result = expected_result_arg;
27142675

2715-
TEST_ASSERT( key_data != NULL );
2716-
TEST_ASSERT( input_data != NULL );
2717-
TEST_ASSERT( additional_data != NULL );
2718-
TEST_ASSERT( nonce != NULL );
2719-
TEST_ASSERT( expected_data != NULL );
2720-
27212676
output_size = input_data->len + tag_length;
27222677
ASSERT_ALLOC( output_data, output_size );
27232678

@@ -2782,10 +2737,6 @@ void sign_deterministic( int key_type_arg, data_t *key_data,
27822737
size_t signature_length = 0xdeadbeef;
27832738
psa_key_policy_t policy;
27842739

2785-
TEST_ASSERT( key_data != NULL );
2786-
TEST_ASSERT( input_data != NULL );
2787-
TEST_ASSERT( output_data != NULL );
2788-
27892740
PSA_ASSERT( psa_crypto_init( ) );
27902741

27912742
PSA_ASSERT( psa_allocate_key( key_type,
@@ -2841,9 +2792,6 @@ void sign_fail( int key_type_arg, data_t *key_data,
28412792
size_t signature_length = 0xdeadbeef;
28422793
psa_key_policy_t policy;
28432794

2844-
TEST_ASSERT( key_data != NULL );
2845-
TEST_ASSERT( input_data != NULL );
2846-
28472795
ASSERT_ALLOC( signature, signature_size );
28482796

28492797
PSA_ASSERT( psa_crypto_init( ) );
@@ -2962,10 +2910,6 @@ void asymmetric_verify( int key_type_arg, data_t *key_data,
29622910

29632911
TEST_ASSERT( signature_data->len <= PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE );
29642912

2965-
TEST_ASSERT( key_data != NULL );
2966-
TEST_ASSERT( hash_data != NULL );
2967-
TEST_ASSERT( signature_data != NULL );
2968-
29692913
PSA_ASSERT( psa_crypto_init( ) );
29702914

29712915
PSA_ASSERT( psa_allocate_key( key_type,
@@ -3002,10 +2946,6 @@ void asymmetric_verify_fail( int key_type_arg, data_t *key_data,
30022946
psa_status_t expected_status = expected_status_arg;
30032947
psa_key_policy_t policy;
30042948

3005-
TEST_ASSERT( key_data != NULL );
3006-
TEST_ASSERT( hash_data != NULL );
3007-
TEST_ASSERT( signature_data != NULL );
3008-
30092949
PSA_ASSERT( psa_crypto_init( ) );
30102950

30112951
PSA_ASSERT( psa_allocate_key( key_type,
@@ -3124,9 +3064,6 @@ void asymmetric_encrypt_decrypt( int key_type_arg,
31243064
size_t output2_length = ~0;
31253065
psa_key_policy_t policy;
31263066

3127-
TEST_ASSERT( key_data != NULL );
3128-
TEST_ASSERT( input_data != NULL );
3129-
31303067
PSA_ASSERT( psa_crypto_init( ) );
31313068

31323069
PSA_ASSERT( psa_allocate_key( key_type,
@@ -3195,10 +3132,6 @@ void asymmetric_decrypt( int key_type_arg,
31953132
size_t output_length = ~0;
31963133
psa_key_policy_t policy;
31973134

3198-
TEST_ASSERT( key_data != NULL );
3199-
TEST_ASSERT( input_data != NULL );
3200-
TEST_ASSERT( expected_data != NULL );
3201-
32023135
output_size = key_data->len;
32033136
ASSERT_ALLOC( output, output_size );
32043137

@@ -3266,9 +3199,6 @@ void asymmetric_decrypt_fail( int key_type_arg,
32663199
psa_status_t expected_status = expected_status_arg;
32673200
psa_key_policy_t policy;
32683201

3269-
TEST_ASSERT( key_data != NULL );
3270-
TEST_ASSERT( input_data != NULL );
3271-
32723202
output_size = key_data->len;
32733203
ASSERT_ALLOC( output, output_size );
32743204

0 commit comments

Comments
 (0)