Skip to content

Commit d6f4b0b

Browse files
Xiaojyao1
Xiao
authored andcommitted
Fix the failure of test_spdm_responder when it is run multiple times.
Signed-off-by: Xiao <[email protected]>
1 parent a1dfef5 commit d6f4b0b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

unit_test/test_spdm_responder/set_key_pair_info_ack.c

+25
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,31 @@ void libspdm_test_responder_set_key_pair_info_ack_case3(void **state)
476476
assert_int_equal(spdm_response->header.param1,
477477
SPDM_ERROR_CODE_INVALID_REQUEST);
478478
assert_int_equal(spdm_response->header.param2, 0);
479+
480+
/*Before reset, change: remove an association with slot*/
481+
set_key_pair_info_request_size =
482+
sizeof(spdm_set_key_pair_info_request_t) +
483+
sizeof(uint8_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint8_t);
484+
485+
libspdm_zero_mem(set_key_pair_info_request, set_key_pair_info_request_size);
486+
set_key_pair_info_request->header.spdm_version = SPDM_MESSAGE_VERSION_13;
487+
set_key_pair_info_request->header.request_response_code = SPDM_SET_KEY_PAIR_INFO;
488+
set_key_pair_info_request->header.param1 = SPDM_SET_KEY_PAIR_INFO_CHANGE_OPERATION;
489+
set_key_pair_info_request->header.param2 = 0;
490+
set_key_pair_info_request->key_pair_id = 0x1;
491+
492+
response_size = sizeof(response);
493+
status = libspdm_get_response_set_key_pair_info_ack(
494+
spdm_context, set_key_pair_info_request_size,
495+
set_key_pair_info_request, &response_size, response);
496+
assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
497+
assert_int_equal(response_size, sizeof(spdm_error_response_t));
498+
spdm_response = (void *)response;
499+
assert_int_equal(spdm_response->header.request_response_code,
500+
SPDM_ERROR);
501+
assert_int_equal(spdm_response->header.param1,
502+
SPDM_ERROR_CODE_RESET_REQUIRED);
503+
assert_int_equal(spdm_response->header.param2, 0);
479504
}
480505

481506
int libspdm_responder_set_key_pair_info_ack_test_main(void)

0 commit comments

Comments
 (0)