mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
AES cleanup
This commit is contained in:
parent
b2689b4f01
commit
a95977590d
@ -32,7 +32,7 @@ module aes64d(
|
|||||||
output logic [63:0] result
|
output logic [63:0] result
|
||||||
);
|
);
|
||||||
|
|
||||||
logic [63:0] ShiftRowsOut, SboxOut, MixcolIn, MixcolOut;
|
logic [63:0] ShiftRowsOut, SboxOut, MixcolsIn, MixcolsOut;
|
||||||
|
|
||||||
// Apply inverse shiftrows to rs2 and rs1
|
// Apply inverse shiftrows to rs2 and rs1
|
||||||
aesinvshiftrows64 srow({rs2, rs1}, ShiftRowsOut);
|
aesinvshiftrows64 srow({rs2, rs1}, ShiftRowsOut);
|
||||||
@ -40,12 +40,12 @@ module aes64d(
|
|||||||
// Apply full word inverse substitution to lower doubleord of shiftrow out
|
// Apply full word inverse substitution to lower doubleord of shiftrow out
|
||||||
aesinvsbox64 invsbox(ShiftRowsOut, SboxOut);
|
aesinvsbox64 invsbox(ShiftRowsOut, SboxOut);
|
||||||
|
|
||||||
mux2 #(64) mixcolmux(SboxOut, rs1, aes64im, MixcolIn);
|
mux2 #(64) mixcolmux(SboxOut, rs1, aes64im, MixcolsIn);
|
||||||
|
|
||||||
// Apply inverse MixColumns to sbox outputs
|
// Apply inverse MixColumns to sbox outputs
|
||||||
aesinvmixcolumns32 invmw0(MixcolIn[31:0], MixcolOut[31:0]);
|
aesinvmixcolumns32 invmw0(MixcolsIn[31:0], MixcolsOut[31:0]);
|
||||||
aesinvmixcolumns32 invmw1(MixcolIn[63:32], MixcolOut[63:32]);
|
aesinvmixcolumns32 invmw1(MixcolsIn[63:32], MixcolsOut[63:32]);
|
||||||
|
|
||||||
// Final round skips mixcolumns.
|
// Final round skips mixcolumns.
|
||||||
mux2 #(64) resultmux(MixcolOut, SboxOut, finalround, result);
|
mux2 #(64) resultmux(MixcolsOut, SboxOut, finalround, result);
|
||||||
endmodule
|
endmodule
|
||||||
|
@ -34,7 +34,7 @@ module aes64e(
|
|||||||
output logic [63:0] result
|
output logic [63:0] result
|
||||||
);
|
);
|
||||||
|
|
||||||
logic [63:0] ShiftRowsOut, SboxOut, MixcolOut;
|
logic [63:0] ShiftRowsOut, SboxOut, MixcolsOut;
|
||||||
|
|
||||||
// AES shiftrow unit
|
// AES shiftrow unit
|
||||||
aesshiftrows64 srow({rs2,rs1}, ShiftRowsOut);
|
aesshiftrows64 srow({rs2,rs1}, ShiftRowsOut);
|
||||||
@ -47,9 +47,9 @@ module aes64e(
|
|||||||
aessbox32 sbox1(ShiftRowsOut[63:32], SboxOut[63:32]); // instantiate second sbox
|
aessbox32 sbox1(ShiftRowsOut[63:32], SboxOut[63:32]); // instantiate second sbox
|
||||||
|
|
||||||
// Apply MixColumns operations
|
// Apply MixColumns operations
|
||||||
aesmixcolumns32 mw0(SboxOut[31:0], MixcolOut[31:0]);
|
aesmixcolumns32 mw0(SboxOut[31:0], MixcolsOut[31:0]);
|
||||||
aesmixcolumns32 mw1(SboxOut[63:32], MixcolOut[63:32]);
|
aesmixcolumns32 mw1(SboxOut[63:32], MixcolsOut[63:32]);
|
||||||
|
|
||||||
// Skip mixcolumns on last round
|
// Skip mixcolumns on last round
|
||||||
mux2 #(64) resultmux(MixcolOut, SboxOut, finalround, result);
|
mux2 #(64) resultmux(MixcolsOut, SboxOut, finalround, result);
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user