Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An ERROR message with an ErrorCode == LargeResponse shall not be allowed in ResponseToLargeRequest. #2181

Closed
Zhiqiang520 opened this issue Jun 27, 2023 · 2 comments · Fixed by #2186
Assignees
Labels
bug Something isn't working

Comments

@Zhiqiang520
Copy link
Contributor

An ERROR message with an ErrorCode == LargeResponse shall not be allowed in ResponseToLargeRequest.

  1. Refer to paragraph 696 in DSP0274_1.2.1.

An ERROR message with an ErrorCode == LargeResponse shall not be allowed in ResponseToLargeRequest.

  1. I have submitted one pull request to add unit test for An ERROR message with an ErrorCode == LargeResponse shall not be allowed in ResponseToLargeRequest.

  2. Test result is fail: Put an ERROR message with an ErrorCode == LargeResponse in ResponseToLargeRequest, currently the requester take this LargeResponse ERROR message as a valid message and then send CHUNK_GET request message.
    I think it is not a right behavior, the requester should take it as a invalid message.

image
@steven-bellock steven-bellock added the bug Something isn't working label Jun 27, 2023
@steven-bellock
Copy link
Contributor

This is somewhat related to #1207.

@Zhiqiang520
Copy link
Contributor Author

I think maybe we can add the check whether ErrorCode == LargeResponse is in ResponseToLargeRequest field, before libspdm_copy_mem at the following line 489 and 517.

if (spdm_response->header.param1
& SPDM_CHUNK_SEND_ACK_RESPONSE_ATTRIBUTE_EARLY_ERROR_DETECTED) {
/* Store the error response in scratch buffer to be read by
* libspdm_receive_spdm_response and returned to its caller
* and handled in the error response handling flow */
libspdm_copy_mem(
send_info->large_message,
send_info->large_message_capacity,
(uint8_t*) (spdm_response + 1),
response_size - sizeof(spdm_chunk_send_ack_response_t));
send_info->large_message_size =
(response_size - sizeof(spdm_chunk_send_ack_response_t));
status = LIBSPDM_STATUS_SUCCESS;
break;
}

if (send_info->chunk_bytes_transferred >= send_info->large_message_size) {
/* All bytes have been transferred. Store response in scratch buffer
* to be read by libspdm_receive_spdm_response */
libspdm_copy_mem(
send_info->large_message, send_info->large_message_capacity,
chunk_ptr, response_size - sizeof(spdm_chunk_send_ack_response_t));
send_info->large_message_size =
(response_size - sizeof(spdm_chunk_send_ack_response_t));
break;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants