Skip to content

Commit

Permalink
Fix vendor response test case issues
Browse files Browse the repository at this point in the history
Signed-off-by: Xiao <[email protected]>
  • Loading branch information
Xiao authored and jyao1 committed May 23, 2024
1 parent a576846 commit e27d0a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void libspdm_test_responder_vendor_cmds_err_case1(void **state)
libspdm_return_t status;
libspdm_test_context_t *spdm_test_context;
libspdm_context_t *spdm_context;
uint8_t request_buffer[255] = {0};
uint8_t request_buffer[LIBSPDM_MAX_SPDM_MSG_SIZE] = {0};
libspdm_vendor_request_test request;
libspdm_vendor_response_test response = {0};
response.vendor_id_len = sizeof(response.vendor_id);
Expand All @@ -93,16 +93,15 @@ static void libspdm_test_responder_vendor_cmds_err_case1(void **state)
assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);

request.standard_id = 6;
request.vendor_id_len = 2;
request.vendor_id[0] = 0xAA;
request.vendor_id[1] = 0xAA;
request.vendor_id_len = sizeof(request.vendor_id);
libspdm_set_mem(request.vendor_id, sizeof(request.vendor_id), 0xAA);
request.data_len = sizeof(request.data);
libspdm_set_mem(request.data, sizeof(request.data), 0xAA);

response_len = sizeof(response);

/* copy header of request structure to buffer */
libspdm_copy_mem(request_buffer, 255, &request,
libspdm_copy_mem(request_buffer, sizeof(request_buffer), &request,
sizeof(request.header) + 3 + request.vendor_id_len);
/* copy the request data to the correct offset in the request_buffer */
libspdm_copy_mem(request_buffer + sizeof(request.header) + 3 + request.vendor_id_len,
Expand Down
11 changes: 5 additions & 6 deletions unit_test/test_spdm_responder/vendor_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ static void libspdm_test_responder_vendor_cmds_case1(void **state)
libspdm_return_t status;
libspdm_test_context_t *spdm_test_context;
libspdm_context_t *spdm_context;
uint8_t request_buffer[255] = {0};
uint8_t response_buffer[255] = {0};
uint8_t request_buffer[LIBSPDM_MAX_SPDM_MSG_SIZE] = {0};
uint8_t response_buffer[LIBSPDM_MAX_SPDM_MSG_SIZE] = {0};
libspdm_vendor_request_test request = {0};
libspdm_vendor_response_test response = {0};
size_t response_len = 0;
Expand All @@ -120,16 +120,15 @@ static void libspdm_test_responder_vendor_cmds_case1(void **state)
assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);

request.standard_id = 6;
request.vendor_id_len = 2;
request.vendor_id[0] = 0xAA;
request.vendor_id[1] = 0xAA;
request.vendor_id_len = sizeof(request.vendor_id);
libspdm_set_mem(request.vendor_id, sizeof(request.vendor_id), 0xAA);
request.data_len = sizeof(request.data);
libspdm_set_mem(request.data, sizeof(request.data), 0xAA);

response_len = sizeof(response);

/* copy header of request structure to buffer */
libspdm_copy_mem(request_buffer, 255, &request,
libspdm_copy_mem(request_buffer, sizeof(request_buffer), &request,
sizeof(request.header) + 3 + request.vendor_id_len);
/* copy the request data to the correct offset in the request_buffer */
libspdm_copy_mem(request_buffer + sizeof(request.header) + 3 + request.vendor_id_len,
Expand Down

0 comments on commit e27d0a2

Please sign in to comment.