Skip to content

Commit

Permalink
Fix aes_shift_rows_fwd and aes_shift_rows_inv functions from latest v…
Browse files Browse the repository at this point in the history
…ector spec

This PR updates the aes_shift_rows_fwd and aes_shift_rows_inv functions to match the versions defined in the latest vector crypto spec after this fix: riscv/riscv-crypto@a19ae20.

These functions are not used in any scalar instructions and are not currently called anywhere, so no existing functionality should be affected, but this change is necessary for the upcoming vector crypto implementation and ensures the versions in the scalar spec match the vector crypto spec (as the Sail versions are used directly in the scalar spec).
  • Loading branch information
mlawson-tt authored Dec 19, 2024
1 parent fb68dcd commit 3707d0b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions model/riscv_types_kext.sail
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ function aes_shift_rows_fwd(x) = {
let ic2 : bits(32) = aes_get_column(x, 2);
let ic1 : bits(32) = aes_get_column(x, 1);
let ic0 : bits(32) = aes_get_column(x, 0);
let oc0 : bits(32) = ic0[31..24] @ ic1[23..16] @ ic2[15.. 8] @ ic3[ 7.. 0];
let oc1 : bits(32) = ic1[31..24] @ ic2[23..16] @ ic3[15.. 8] @ ic0[ 7.. 0];
let oc2 : bits(32) = ic2[31..24] @ ic3[23..16] @ ic0[15.. 8] @ ic1[ 7.. 0];
let oc3 : bits(32) = ic3[31..24] @ ic0[23..16] @ ic1[15.. 8] @ ic2[ 7.. 0];
let oc0 : bits(32) = ic3[31..24] @ ic2[23..16] @ ic1[15.. 8] @ ic0[ 7.. 0];
let oc1 : bits(32) = ic0[31..24] @ ic3[23..16] @ ic2[15.. 8] @ ic1[ 7.. 0];
let oc2 : bits(32) = ic1[31..24] @ ic0[23..16] @ ic3[15.. 8] @ ic2[ 7.. 0];
let oc3 : bits(32) = ic2[31..24] @ ic1[23..16] @ ic0[15.. 8] @ ic3[ 7.. 0];
(oc3 @ oc2 @ oc1 @ oc0) /* Return value */
}

Expand All @@ -304,10 +304,10 @@ function aes_shift_rows_inv(x) = {
let ic2 : bits(32) = aes_get_column(x, 2);
let ic1 : bits(32) = aes_get_column(x, 1);
let ic0 : bits(32) = aes_get_column(x, 0);
let oc0 : bits(32) = ic0[31..24] @ ic3[23..16] @ ic2[15.. 8] @ ic1[ 7.. 0];
let oc1 : bits(32) = ic1[31..24] @ ic0[23..16] @ ic3[15.. 8] @ ic2[ 7.. 0];
let oc2 : bits(32) = ic2[31..24] @ ic1[23..16] @ ic0[15.. 8] @ ic3[ 7.. 0];
let oc3 : bits(32) = ic3[31..24] @ ic2[23..16] @ ic1[15.. 8] @ ic0[ 7.. 0];
let oc0 : bits(32) = ic1[31..24] @ ic2[23..16] @ ic3[15.. 8] @ ic0[ 7.. 0];
let oc1 : bits(32) = ic2[31..24] @ ic3[23..16] @ ic0[15.. 8] @ ic1[ 7.. 0];
let oc2 : bits(32) = ic3[31..24] @ ic0[23..16] @ ic1[15.. 8] @ ic2[ 7.. 0];
let oc3 : bits(32) = ic0[31..24] @ ic1[23..16] @ ic2[15.. 8] @ ic3[ 7.. 0];
(oc3 @ oc2 @ oc1 @ oc0) /* Return value */
}

Expand Down

0 comments on commit 3707d0b

Please sign in to comment.