Skip to content

Commit

Permalink
fix csr message format Fix:#2039
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaohanjlll <[email protected]>
  • Loading branch information
Xiaohanjlll authored and jyao1 committed May 23, 2023
1 parent 8c3972c commit 378dd9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions library/spdm_requester_lib/libspdm_req_get_csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 378dd9c

Please sign in to comment.