Skip to content

Commit bf72cbc

Browse files
Fix ENCAP_CAP checks to accommodate SPDM 1.2
Fix #2959. Signed-off-by: Steven Bellock <[email protected]>
1 parent 87d6c6c commit bf72cbc

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

library/spdm_requester_lib/libspdm_req_key_exchange.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Copyright Notice:
3-
* Copyright 2021-2024 DMTF. All rights reserved.
3+
* Copyright 2021-2025 DMTF. All rights reserved.
44
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
55
**/
66

@@ -538,10 +538,6 @@ static libspdm_return_t libspdm_try_send_receive_key_exchange(
538538
spdm_context, true,
539539
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP,
540540
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP);
541-
const bool encap_cap_both = libspdm_is_capabilities_flag_supported(
542-
spdm_context, true,
543-
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP,
544-
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP);
545541
const bool cert_cap = libspdm_is_capabilities_flag_supported(
546542
spdm_context, true,
547543
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP,
@@ -600,8 +596,8 @@ static libspdm_return_t libspdm_try_send_receive_key_exchange(
600596
status = LIBSPDM_STATUS_INVALID_MSG_FIELD;
601597
goto receive_done;
602598
}
603-
/* Encapsulated flow requires ENCAP_CAP for both endpoints. */
604-
if (!encap_cap_both) {
599+
/* Encapsulated flow requires support for encapsulated messages by both endpoints. */
600+
if (!libspdm_is_encap_supported(spdm_context)) {
605601
libspdm_secured_message_dhe_free(
606602
spdm_context->connection_info.algorithm.dhe_named_group, dhe_context);
607603
status = LIBSPDM_STATUS_INVALID_MSG_FIELD;

library/spdm_responder_lib/libspdm_rsp_encap_response.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Copyright Notice:
3-
* Copyright 2021-2024 DMTF. All rights reserved.
3+
* Copyright 2021-2025 DMTF. All rights reserved.
44
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
55
**/
66

@@ -297,10 +297,7 @@ libspdm_return_t libspdm_get_response_encapsulated_response_ack(
297297
response_size, response);
298298
}
299299

300-
if (!libspdm_is_capabilities_flag_supported(
301-
spdm_context, false,
302-
SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP,
303-
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP)) {
300+
if (!libspdm_is_encap_supported(spdm_context)) {
304301
return libspdm_generate_error_response(
305302
spdm_context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
306303
SPDM_DELIVER_ENCAPSULATED_RESPONSE, response_size, response);

0 commit comments

Comments
 (0)