Skip to content

Commit

Permalink
some clean up for set_key_pair_info_ack.
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <[email protected]>
  • Loading branch information
jyao1 committed Sep 12, 2024
1 parent 5140cee commit 2634426
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions library/spdm_responder_lib/libspdm_rsp_set_key_pair_info_ack.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ libspdm_return_t libspdm_get_response_set_key_pair_info_ack(libspdm_context_t *s
NULL, NULL);
if (!result) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_INVALID_REQUEST, 0,
SPDM_ERROR_CODE_UNSPECIFIED, 0,
response_size, response);
}

Expand Down Expand Up @@ -170,6 +170,7 @@ libspdm_return_t libspdm_get_response_set_key_pair_info_ack(libspdm_context_t *s
response_size, response);
}
if (((capabilities & SPDM_KEY_PAIR_CAP_CERT_ASSOC_CAP) == 0) &&
(desired_assoc_cert_slot_mask != 0) &&
(desired_assoc_cert_slot_mask != assoc_cert_slot_mask)) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_INVALID_REQUEST, 0,
Expand Down Expand Up @@ -213,15 +214,8 @@ libspdm_return_t libspdm_get_response_set_key_pair_info_ack(libspdm_context_t *s
response_size, response);
}

if (operation == SPDM_SET_KEY_PAIR_INFO_ERASE_OPERATION) {
if (assoc_cert_slot_mask != 0) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_OPERATION_FAILED, 0,
response_size, response);
}
}

if (operation == SPDM_SET_KEY_PAIR_INFO_GENERATE_OPERATION) {
if ((operation == SPDM_SET_KEY_PAIR_INFO_ERASE_OPERATION) ||
(operation == SPDM_SET_KEY_PAIR_INFO_GENERATE_OPERATION)) {
if (assoc_cert_slot_mask != 0) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_OPERATION_FAILED, 0,
Expand Down Expand Up @@ -249,11 +243,7 @@ libspdm_return_t libspdm_get_response_set_key_pair_info_ack(libspdm_context_t *s
spdm_response = response;
*response_size = sizeof(spdm_set_key_pair_info_ack_response_t);


if (libspdm_is_capabilities_flag_supported(
spdm_context, false, 0,
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_INSTALL_RESET_CAP) &&
need_reset) {
if (need_reset) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_RESET_REQUIRED, 0,
response_size, response);
Expand Down

0 comments on commit 2634426

Please sign in to comment.