Skip to content

Commit

Permalink
Add slot_id check
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxing Hou <[email protected]>
  • Loading branch information
Wenxing-hou authored and jyao1 committed Jun 30, 2022
1 parent f73d435 commit 97d23cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/spdm_responder_lib/libspdm_rsp_certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ libspdm_return_t libspdm_get_response_certificate(void *context,
if (spdm_context->local_context
.local_cert_chain_provision[slot_id] == NULL) {
return libspdm_generate_error_response(
spdm_context, SPDM_ERROR_CODE_UNSPECIFIED,
spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
0, response_size, response);
}

Expand Down
9 changes: 9 additions & 0 deletions library/spdm_responder_lib/libspdm_rsp_challenge_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ libspdm_return_t libspdm_get_response_challenge_auth(void *context,
response_size, response);
}

if (slot_id != 0xFF) {
if (spdm_context->local_context
.local_cert_chain_provision[slot_id] == NULL) {
return libspdm_generate_error_response(
spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
0, response_size, response);
}
}

signature_size = libspdm_get_asym_signature_size(
spdm_context->connection_info.algorithm.base_asym_algo);
hash_size = libspdm_get_hash_size(
Expand Down
9 changes: 9 additions & 0 deletions library/spdm_responder_lib/libspdm_rsp_key_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ libspdm_return_t libspdm_get_response_key_exchange(void *context,
response_size, response);
}

if (slot_id != 0xFF) {
if (spdm_context->local_context
.local_cert_chain_provision[slot_id] == NULL) {
return libspdm_generate_error_response(
spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
0, response_size, response);
}
}

if (slot_id == 0xFF) {
slot_id = spdm_context->local_context.provisioned_slot_id;
}
Expand Down

0 comments on commit 97d23cb

Please sign in to comment.