From 378dd9c314f4f5febb2ad2e05d104b16c6893a31 Mon Sep 17 00:00:00 2001 From: Xiaohanjlll Date: Tue, 23 May 2023 11:47:38 +0800 Subject: [PATCH] fix csr message format Fix:#2039 Signed-off-by: Xiaohanjlll --- library/spdm_requester_lib/libspdm_req_get_csr.c | 12 ++++++------ library/spdm_responder_lib/libspdm_rsp_csr.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/spdm_requester_lib/libspdm_req_get_csr.c b/library/spdm_requester_lib/libspdm_req_get_csr.c index 6cfebd27e6c..3e3891f2bc3 100644 --- a/library/spdm_requester_lib/libspdm_req_get_csr.c +++ b/library/spdm_requester_lib/libspdm_req_get_csr.c @@ -93,16 +93,16 @@ static libspdm_return_t libspdm_try_get_csr(libspdm_context_t *spdm_context, spdm_request->opaque_data_length = opaque_data_length; spdm_request->requester_info_length = requester_info_length; - if (opaque_data_length != 0) { + if (requester_info_length != 0) { libspdm_copy_mem(spdm_request + 1, spdm_request_size - sizeof(spdm_get_csr_request_t), - (uint8_t *)opaque_data, opaque_data_length); + (uint8_t *)requester_info, requester_info_length); } - if (requester_info_length != 0) { - libspdm_copy_mem((uint8_t *)(spdm_request + 1) + opaque_data_length, - spdm_request_size - sizeof(spdm_get_csr_request_t), - (uint8_t *)requester_info, requester_info_length); + if (opaque_data_length != 0) { + libspdm_copy_mem((uint8_t *)(spdm_request + 1) + requester_info_length, + spdm_request_size - sizeof(spdm_get_csr_request_t) - requester_info_length, + (uint8_t *)opaque_data, opaque_data_length); } LIBSPDM_ASSERT(spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_12); diff --git a/library/spdm_responder_lib/libspdm_rsp_csr.c b/library/spdm_responder_lib/libspdm_rsp_csr.c index b35aacefff0..45d41081955 100644 --- a/library/spdm_responder_lib/libspdm_rsp_csr.c +++ b/library/spdm_responder_lib/libspdm_rsp_csr.c @@ -112,9 +112,9 @@ libspdm_return_t libspdm_get_response_csr(libspdm_context_t *spdm_context, response_size, response); } - opaque_data = (void*)((size_t)(spdm_request + 1)); + requester_info = (void *)((size_t)(spdm_request + 1)); - requester_info = (void*)(opaque_data + opaque_data_length); + opaque_data = (void *)(requester_info + requester_info_length); need_reset = libspdm_is_capabilities_flag_supported( spdm_context, false, 0,