Skip to content

Commit

Permalink
Fix requester can't receive err ms from respondergafter sending incor…
Browse files Browse the repository at this point in the history
…rect UpdateAllKeys operation

Signed-off-by: OuyangHang33 <[email protected]>
  • Loading branch information
OuyangHang33 committed Apr 21, 2024
1 parent 4852b72 commit 1aafb0d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions spdmlib/src/common/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,10 +919,24 @@ impl SpdmSession {
app_buffer,
&self.application_secret.response_direction,
);
if r != Err(SPDM_STATUS_SEQUENCE_NUMBER_OVERFLOW) {
// When meet Generic failure, try backup keys before aborting.
if r == Err(SPDM_STATUS_CRYPTO_ERROR) && self.responder_backup_valid {
// Retry decoding message with backup Requester key.
let r_backup = self.decode_msg(
secured_buffer,
app_buffer,
&self.application_secret_backup.response_direction,
);
if r_backup != Err(SPDM_STATUS_SEQUENCE_NUMBER_OVERFLOW) {
self.application_secret.response_direction.sequence_number += 1;
}
r_backup
} else if r != Err(SPDM_STATUS_SEQUENCE_NUMBER_OVERFLOW) {
self.application_secret.response_direction.sequence_number += 1;
r
} else {
r
}
r
}
}
_ => Err(SPDM_STATUS_INVALID_STATE_LOCAL),
Expand Down

0 comments on commit 1aafb0d

Please sign in to comment.