Skip to content

Commit

Permalink
Fix other operations fail after rollback keys
Browse files Browse the repository at this point in the history
Signed-off-by: OuyangHang33 <[email protected]>
  • Loading branch information
OuyangHang33 committed Apr 24, 2024
1 parent acf74d7 commit 5a0279b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
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

0 comments on commit 5a0279b

Please sign in to comment.