From 4f2618cd7e9b62d7dfb737eeb081d3fdcfe65297 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Fri, 16 Dec 2022 14:44:11 +0000 Subject: [PATCH] Add interruptible to psa_op_fail tests Signed-off-by: Paul Elliott --- .../test_suite_psa_crypto_op_fail.function | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/suites/test_suite_psa_crypto_op_fail.function b/tests/suites/test_suite_psa_crypto_op_fail.function index 8b50f102918d..98f0d7a67897 100644 --- a/tests/suites/test_suite_psa_crypto_op_fail.function +++ b/tests/suites/test_suite_psa_crypto_op_fail.function @@ -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( ); @@ -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 @@ -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: