diff --git a/library/spdm_requester_lib/libspdm_req_get_csr.c b/library/spdm_requester_lib/libspdm_req_get_csr.c index a3ce7423220..7aa914597b5 100644 --- a/library/spdm_requester_lib/libspdm_req_get_csr.c +++ b/library/spdm_requester_lib/libspdm_req_get_csr.c @@ -89,16 +89,16 @@ static libspdm_return_t libspdm_try_get_csr(void *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 e74a03a205c..83f4d3375ce 100644 --- a/library/spdm_responder_lib/libspdm_rsp_csr.c +++ b/library/spdm_responder_lib/libspdm_rsp_csr.c @@ -26,7 +26,6 @@ libspdm_return_t libspdm_get_response_csr(void *context, size_t request_size, uint8_t *csr_p = csr_pointer; uint16_t requester_info_length; uint16_t opaque_data_length; - uint8_t *opaque_data; uint8_t *requester_info; bool need_reset; @@ -103,9 +102,7 @@ libspdm_return_t libspdm_get_response_csr(void *context, size_t request_size, response_size, response); } - opaque_data = (void*)((size_t)(spdm_request + 1)); - - requester_info = (void*)(opaque_data + opaque_data_length); + requester_info = (void *)((size_t)(spdm_request + 1)); need_reset = libspdm_is_capabilities_flag_supported( spdm_context, false, 0,