Add checks for BAD_STATE before calling psa_pake_setup() in ecjpake_setup() test

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2022-06-08 17:36:23 +02:00
parent 707d9574f8
commit 645cccd6a8

View file

@ -8128,6 +8128,23 @@ void ecjpake_setup( int alg_arg, int primitive_arg, int hash_arg, int role_arg,
psa_pake_cs_set_primitive( &cipher_suite, primitive_arg ); psa_pake_cs_set_primitive( &cipher_suite, primitive_arg );
psa_pake_cs_set_hash( &cipher_suite, hash_alg ); psa_pake_cs_set_hash( &cipher_suite, hash_alg );
PSA_ASSERT( psa_pake_abort( &operation ) );
TEST_EQUAL( psa_pake_set_user( &operation, NULL, 0 ),
PSA_ERROR_BAD_STATE );
TEST_EQUAL( psa_pake_set_peer( &operation, NULL, 0 ),
PSA_ERROR_BAD_STATE );
TEST_EQUAL( psa_pake_set_password_key( &operation, key ),
PSA_ERROR_BAD_STATE );
TEST_EQUAL( psa_pake_set_role( &operation, role ),
PSA_ERROR_BAD_STATE );
TEST_EQUAL( psa_pake_output( &operation, step, NULL, 0, NULL ),
PSA_ERROR_BAD_STATE );
TEST_EQUAL( psa_pake_input( &operation, step, NULL, 0),
PSA_ERROR_BAD_STATE );
PSA_ASSERT( psa_pake_abort( &operation ) );
status = psa_pake_setup( &operation, &cipher_suite ); status = psa_pake_setup( &operation, &cipher_suite );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
{ {