test: psa_pake: fixes in ecjpake_setup()

Both changes concern the ERR_INJECT_UNINITIALIZED_ACCESS case:

- removed unnecessary psa_pake_abort()
- added psa_pake_get_implicit_key()

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
Valerio Setti 2022-11-21 15:38:29 +01:00
parent e5d7864aa0
commit e65a41f278

View File

@ -687,6 +687,7 @@ void ecjpake_setup( int alg_arg, int key_type_pw_arg, int key_usage_pw_arg,
unsigned char *output_buffer = NULL;
size_t output_len = 0;
const uint8_t unsupp_id[] = "abcd";
psa_key_derivation_operation_t key_derivation;
PSA_INIT( );
@ -713,23 +714,20 @@ void ecjpake_setup( int alg_arg, int key_type_pw_arg, int key_usage_pw_arg,
{
TEST_EQUAL( psa_pake_set_user( &operation, NULL, 0 ),
expected_error );
PSA_ASSERT( psa_pake_abort( &operation ) );
TEST_EQUAL( psa_pake_set_peer( &operation, NULL, 0 ),
expected_error );
PSA_ASSERT( psa_pake_abort( &operation ) );
TEST_EQUAL( psa_pake_set_password_key( &operation, key ),
expected_error );
PSA_ASSERT( psa_pake_abort( &operation ) );
TEST_EQUAL( psa_pake_set_role( &operation, role ),
expected_error );
PSA_ASSERT( psa_pake_abort( &operation ) );
TEST_EQUAL( psa_pake_output( &operation, PSA_PAKE_STEP_KEY_SHARE,
NULL, 0, NULL ),
expected_error );
PSA_ASSERT( psa_pake_abort( &operation ) );
TEST_EQUAL( psa_pake_input( &operation, PSA_PAKE_STEP_KEY_SHARE, NULL, 0),
TEST_EQUAL( psa_pake_input( &operation, PSA_PAKE_STEP_KEY_SHARE,
NULL, 0 ),
expected_error );
TEST_EQUAL( psa_pake_get_implicit_key( &operation, &key_derivation ),
expected_error );
PSA_ASSERT( psa_pake_abort( &operation ) );
goto exit;
}