Skip to content

Commit

Permalink
Fix ENCAP_CAP checks to accommodate SPDM 1.2
Browse files Browse the repository at this point in the history
Fix #2959.

Signed-off-by: Steven Bellock <sbellock@nvidia.com>
  • Loading branch information
steven-bellock committed Jan 15, 2025
1 parent 87d6c6c commit bf72cbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 3 additions & 7 deletions library/spdm_requester_lib/libspdm_req_key_exchange.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2024 DMTF. All rights reserved.
* Copyright 2021-2025 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -538,10 +538,6 @@ static libspdm_return_t libspdm_try_send_receive_key_exchange(
spdm_context, true,
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP,
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP);
const bool encap_cap_both = libspdm_is_capabilities_flag_supported(
spdm_context, true,
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP,
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP);
const bool cert_cap = libspdm_is_capabilities_flag_supported(
spdm_context, true,
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP,
Expand Down Expand Up @@ -600,8 +596,8 @@ static libspdm_return_t libspdm_try_send_receive_key_exchange(
status = LIBSPDM_STATUS_INVALID_MSG_FIELD;
goto receive_done;
}
/* Encapsulated flow requires ENCAP_CAP for both endpoints. */
if (!encap_cap_both) {
/* Encapsulated flow requires support for encapsulated messages by both endpoints. */
if (!libspdm_is_encap_supported(spdm_context)) {
libspdm_secured_message_dhe_free(
spdm_context->connection_info.algorithm.dhe_named_group, dhe_context);
status = LIBSPDM_STATUS_INVALID_MSG_FIELD;
Expand Down
7 changes: 2 additions & 5 deletions library/spdm_responder_lib/libspdm_rsp_encap_response.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2024 DMTF. All rights reserved.
* Copyright 2021-2025 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -297,10 +297,7 @@ libspdm_return_t libspdm_get_response_encapsulated_response_ack(
response_size, response);
}

if (!libspdm_is_capabilities_flag_supported(
spdm_context, false,
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP,
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP)) {
if (!libspdm_is_encap_supported(spdm_context)) {
return libspdm_generate_error_response(
spdm_context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_DELIVER_ENCAPSULATED_RESPONSE, response_size, response);
Expand Down

0 comments on commit bf72cbc

Please sign in to comment.