diff --git a/library/spdm_requester_lib/libspdm_req_key_exchange.c b/library/spdm_requester_lib/libspdm_req_key_exchange.c index cb19e8a7317..8e77eddb15d 100644 --- a/library/spdm_requester_lib/libspdm_req_key_exchange.c +++ b/library/spdm_requester_lib/libspdm_req_key_exchange.c @@ -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, @@ -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; diff --git a/library/spdm_responder_lib/libspdm_rsp_encap_response.c b/library/spdm_responder_lib/libspdm_rsp_encap_response.c index d7622593f9c..6ade9b4c97c 100644 --- a/library/spdm_responder_lib/libspdm_rsp_encap_response.c +++ b/library/spdm_responder_lib/libspdm_rsp_encap_response.c @@ -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);