Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ENCAP_CAP checks to accommodate SPDM 1.2 #2960

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading