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

Fix other operation fail after key_update fail and rollback #81

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion spdmlib/src/common/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,9 @@ impl SpdmSession {
&self.application_secret_backup.response_direction,
);
if r_backup != Err(SPDM_STATUS_SEQUENCE_NUMBER_OVERFLOW) {
self.application_secret.response_direction.sequence_number += 1;
self.application_secret_backup
.response_direction
.sequence_number += 1;
}
r_backup
} else if r != Err(SPDM_STATUS_SEQUENCE_NUMBER_OVERFLOW) {
Expand Down
20 changes: 17 additions & 3 deletions spdmlib/src/requester/key_update_req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,27 @@ impl RequesterContext {
Err(SPDM_STATUS_INVALID_MSG_FIELD)
}
}
SpdmRequestResponseCode::SpdmResponseError => self
.spdm_handle_error_response_main(
SpdmRequestResponseCode::SpdmResponseError => {
let spdm_version_sel = self.common.negotiate_info.spdm_version_sel;
let session = if let Some(s) = self.common.get_session_via_id(session_id) {
s
} else {
return Err(SPDM_STATUS_INVALID_PARAMETER);
};
error!("!!! key_update : fail !!! rollback all keys\n");
session.activate_data_secret_update(
spdm_version_sel,
update_requester,
update_responder,
false,
)?;
self.spdm_handle_error_response_main(
Some(session_id),
receive_buffer,
SpdmRequestResponseCode::SpdmRequestKeyUpdate,
SpdmRequestResponseCode::SpdmResponseKeyUpdateAck,
),
)
}
_ => Err(SPDM_STATUS_ERROR_PEER),
}
}
Expand Down
Loading