Skip to content

Commit

Permalink
Add interruptible to psa_op_fail tests
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Elliott <[email protected]>
  • Loading branch information
paul-elliott-arm committed Dec 17, 2022
1 parent 8f20152 commit 4f2618c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/suites/test_suite_psa_crypto_op_fail.function
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ void sign_fail( int key_type_arg, data_t *key_data,
uint8_t input[1] = {'A'};
uint8_t output[PSA_SIGNATURE_MAX_SIZE] = {0};
size_t length = SIZE_MAX;
psa_sign_hash_interruptible_operation_t sign_operation =
psa_sign_hash_interruptible_operation_init( );

psa_verify_hash_interruptible_operation_t verify_operation =
psa_verify_hash_interruptible_operation_init( );



PSA_INIT( );

Expand All @@ -238,6 +245,16 @@ void sign_fail( int key_type_arg, data_t *key_data,
psa_sign_hash( key_id, alg,
input, sizeof( input ),
output, sizeof( output ), &length ) );

if( PSA_KEY_TYPE_IS_ECC( key_type ) )
{
TEST_STATUS( expected_status,
psa_sign_hash_start( &sign_operation, key_id, alg,
input, sizeof( input ) ) );

PSA_ASSERT( psa_sign_hash_abort( &sign_operation ) );
}

if( ! private_only )
{
/* Determine a plausible signature size to avoid an INVALID_SIGNATURE
Expand All @@ -254,6 +271,16 @@ void sign_fail( int key_type_arg, data_t *key_data,
psa_verify_hash( key_id, alg,
input, sizeof( input ),
output, output_length ) );

if( PSA_KEY_TYPE_IS_ECC( key_type ) )
{
TEST_STATUS( expected_status,
psa_verify_hash_start( &verify_operation, key_id, alg,
input, sizeof( input ),
output, output_length ) );

PSA_ASSERT( psa_verify_hash_abort( &verify_operation ) );
}
}

exit:
Expand Down

0 comments on commit 4f2618c

Please sign in to comment.