From 645cccd6a836d5dcb0f523da3b4e6550260e44c8 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Wed, 8 Jun 2022 17:36:23 +0200 Subject: [PATCH] Add checks for BAD_STATE before calling psa_pake_setup() in ecjpake_setup() test Signed-off-by: Neil Armstrong --- tests/suites/test_suite_psa_crypto.function | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index caa5987405..e7746a45d6 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -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_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 ); if( status != PSA_SUCCESS ) {