Skip to content

Commit

Permalink
[hmac, rtl] Do not skip padding after a hash stop command
Browse files Browse the repository at this point in the history
This commit removes some conditional FSM states transition that were
deemed undesirable in `prim_sha2_pad`, see #23936. They made it
possible to cancel an ongoing padding operation, which is disallowed
by the HMAC module.

This change makes it impossible to transition into the `StFifoReceive`
state from either `StPad80`, `StPad00`, `StLenHi` or `StLenLo` by
asserting the `hash_go` signal.

Signed-off-by: Andrea Caforio <[email protected]>
  • Loading branch information
andrea-caforio committed Dec 18, 2024
1 parent 7501199 commit 54425d2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hw/ip/prim/rtl/prim_sha2_pad.sv
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,13 @@ module prim_sha2_pad import prim_sha2_pkg::*;
end
endcase

if (!sha_en_i) st_d = StIdle;
else if (hash_go) st_d = StFifoReceive;
if (!sha_en_i) begin
st_d = StIdle;
// We do not allow the cancellation of an ongoing padding operation, i.e., reverting back to the
// `StFifoReceive` state while being in the states `StPad80`, `StPad00`, `StLenHi` or `StLenLo`.
end else if (hash_go && (st_q == StIdle || st_q == StFifoReceive)) begin
st_d = StFifoReceive;
end
end

// tx_count
Expand Down

0 comments on commit 54425d2

Please sign in to comment.