aboutsummaryrefslogtreecommitdiff
path: root/src/rtl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtl')
-rw-r--r--src/rtl/keywrap.v6
-rw-r--r--src/rtl/keywrap_core.v6
-rw-r--r--src/rtl/keywrap_mkmif.v2
3 files changed, 6 insertions, 8 deletions
diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v
index 53deaaf..2e9a7f6 100644
--- a/src/rtl/keywrap.v
+++ b/src/rtl/keywrap.v
@@ -48,7 +48,7 @@
//
//======================================================================
-module keywrap #(parameter ADDR_BITS = 13)
+module keywrap #(parameter ADDR_BITS = 12)
(
input wire clk,
input wire reset_n,
@@ -281,7 +281,7 @@ module keywrap #(parameter ADDR_BITS = 13)
end
if (rlen_we)
- rlen_reg <= write_data[12 : 0];
+ rlen_reg <= write_data[(RLEN_BITS - 1) : 0];
if (a0_we)
a0_reg <= write_data;
@@ -383,7 +383,7 @@ module keywrap #(parameter ADDR_BITS = 13)
api_rd_delay_new = {30'h0, valid_reg, ready_reg};
if (address == {{PAD{1'h0}}, ADDR_RLEN})
- api_rd_delay_new = {19'h0, rlen_reg};
+ api_rd_delay_new = {{(32 - RLEN_BITS){1'h0}}, rlen_reg};
if (address == {{PAD{1'h0}}, ADDR_A0})
api_rd_delay_new = core_a_result[63 : 32];
diff --git a/src/rtl/keywrap_core.v b/src/rtl/keywrap_core.v
index 378a61a..3abe93c 100644
--- a/src/rtl/keywrap_core.v
+++ b/src/rtl/keywrap_core.v
@@ -4,7 +4,6 @@
// --------------
// Core that tries to implement AES KEY WRAP as specified in
// RFC 3394 and extended with padding in RFC 5649.
-// Experimental core at the moment. Does Not Work.
// The maximum wrap object size is 64 kByte.
//
//
@@ -244,7 +243,7 @@ module keywrap_core #(parameter MEM_BITS = 11)
begin
a_reg <= 64'h0;
ready_reg <= 1'h1;
- valid_reg <= 1'h1;
+ valid_reg <= 1'h0;
block_ctr_reg <= {(MEM_BITS - 1){1'h0}};
iteration_ctr_reg <= 3'h0;
keywrap_core_ctrl_reg <= CTRL_RESET;
@@ -287,7 +286,7 @@ module keywrap_core #(parameter MEM_BITS = 11)
core_addr = block_ctr_reg;
core_we = 1'h0;
- xor_val = (rlen * iteration_ctr_reg) + {51'h0, (block_ctr_reg + 1'h1)};
+ xor_val = (rlen * iteration_ctr_reg) + {53'h0, (block_ctr_reg + 1'h1)};
if (encdec)
aes_block = {a_reg, core_rd_data};
@@ -455,7 +454,6 @@ module keywrap_core #(parameter MEM_BITS = 11)
valid_new = 1'h0;
valid_we = 1'h1;
init_a = 1'h1;
-
if (encdec)
keywrap_core_ctrl_new = CTRL_NEXT_WSTART;
else
diff --git a/src/rtl/keywrap_mkmif.v b/src/rtl/keywrap_mkmif.v
index 2f7bebf..d73c5bd 100644
--- a/src/rtl/keywrap_mkmif.v
+++ b/src/rtl/keywrap_mkmif.v
@@ -357,7 +357,7 @@ module keywrap_mkmif (
mkm_read_op = 1'h1;
mkm_addr_new = MKM_KEY_BASE_WORD + {key_word_ctr_reg, 2'h0};
mkm_addr_we = 1'h1;
- keywrap_mkmif_ctrl_new = CTRL_WRITE_KEY_WAIT;
+ keywrap_mkmif_ctrl_new = CTRL_READ_KEY_WAIT;
keywrap_mkmif_ctrl_we = 1'h1;
end
else