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

RequestResync Error Code Handling #3022

Open
Ankur-80 opened this issue Mar 28, 2025 · 4 comments
Open

RequestResync Error Code Handling #3022

Ankur-80 opened this issue Mar 28, 2025 · 4 comments

Comments

@Ankur-80
Copy link

Ankur-80 commented Mar 28, 2025

When checking the SPDM functionality using storage controller, synchronization is not reestablished if the responder experiences a reset and loses the last negotiated state.
The sequence of events is as follows:

  1. The requester and responder successfully negotiate the SPDM version to 1.1.
  2. A controller reset takes place, and the responder's last negotiated state is lost.
  3. Despite the reset, the requester continues to believe that the SPDM version is 1.1.
  4. The requester sends a GET_DIGEST command with a version of 1.1.
  5. Since the responder has not been in a negotiated state following the reset, it responds with an error message indicating a request for resynchronization (0x43), but with an SPDM version of 1.0.
    spdm_response->header.spdm_version = libspdm_get_connection_version (spdm_context); if (spdm_response->header.spdm_version == 0) { /* if version is not negotiated, then use default version 1.0 */ spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10; }
  6. On the requester's side, the version is validated before the error message is checked, and a version mismatch is identified, resulting in the return of an "InvalidMessage" value.
    /* -=[Validate Response Phase]=- */ if (spdm_response_size < sizeof(spdm_message_header_t)) { status = LIBSPDM_STATUS_INVALID_MSG_SIZE; goto receive_done; } if (spdm_response->header.spdm_version != spdm_request->header.spdm_version) { status = LIBSPDM_STATUS_INVALID_MSG_FIELD; goto receive_done; } if (spdm_response->header.request_response_code == SPDM_ERROR) { status = libspdm_handle_error_response_main( spdm_context, session_id, &spdm_response_size, (void **)&spdm_response, SPDM_GET_DIGESTS, SPDM_DIGESTS); if (LIBSPDM_STATUS_IS_ERROR(status)) { goto receive_done; } }
@steven-bellock steven-bellock changed the title Issue with RequestResync (0x43) Error Code Handling RequestResync Error Code Handling Mar 28, 2025
@steven-bellock
Copy link
Contributor

If the Responder has been completely reset, and does not remember that there even was a connection, then it should reply with UnexpectedRequest. But that UnexpectedRequest would be a 1.0 error message as well and should be conveyed accurately to the Integrator.

I am somewhat sure that RequestResynch must maintain the negotiated version, but I can clarify that with the SPDM Working Group.

@Ankur-80
Copy link
Author

Ankur-80 commented Apr 1, 2025

As per Spec, Responder can send either UnexpectedRequest or RequestResynch. If RequestResynch is received then Requester will initiate the authentication again.
Image

It is mentioned that RequestResynch can come after firmware update. If device doesn't support Cache Capability then after firmware update it will lost the last negotiated version.
Image

@steven-bellock
Copy link
Contributor

As per Spec, Responder can send either UnexpectedRequest or RequestResynch.

Interestingly the passage

When requests are received out of order, the Responder can silently discard all requests or return an ERROR message with ErrorCode=RequestResynch (with the exception of GET_VERSION ) until the Requester issues a GET_VERSION.

was added in the SPDM 1.2 specification. So I guess that does not apply to your example, where the version is 1.0/1.1? Also the "General ordering rules" section says

These general ordering rules apply to SPDM messages that form a transcript that eventually gets signed.

but what about messages that do not eventually get signed, such as GET_KEY_PAIR_INFO?

On the Responder side I think the fundamental question is

Is it legal for a newly powered-on or reset Responder to return RequestResync to non-GET_VERSION messages?

which hopefully the SPDM Working Group will answer on Thursday.

@Ankur-80
Copy link
Author

Ankur-80 commented Apr 2, 2025

It is mentioned in the 1.1 specification that if the Responder completes the firmware update, it should either respond with a RequestResynch or discard the message.

Image

This issue is also observed in version 1.2. It is a version-independent issue that can occur if the Responder resets after a firmware update and the Requester sends a command request.
We will wait for the SPDM Group to provide clarity on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants