diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2018-12-13 16:36:05 +0100 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2018-12-13 16:36:05 +0100 |
commit | b57fa444b8f894debc762cc877e4c91773e2d605 (patch) | |
tree | a8cad783b125834e0d280d1cd81ffde5b8b978db /src/rtl | |
parent | 462c86f8f897448e45fa8b2e21a25c04d5c7dafd (diff) |
Fixed some bugs in auto-zeroise functionality. Now it really zeroises key automatically. It seems to work, but needs a bit more testing.
Diffstat (limited to 'src/rtl')
-rw-r--r-- | src/rtl/keywrap.v | 1 | ||||
-rw-r--r-- | src/rtl/keywrap_core.v | 17 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v index 36e95bf..47c40d6 100644 --- a/src/rtl/keywrap.v +++ b/src/rtl/keywrap.v @@ -302,6 +302,7 @@ module keywrap #(parameter ADDR_BITS = 13) a1_we = 1'h0; tmp_read_data = 32'h0; tmp_error = 1'h0; + timeout_we = 1'h0; ping_new = 1'h0; zeroise_new = 1'h0; api_rd_delay_new = 32'h0; diff --git a/src/rtl/keywrap_core.v b/src/rtl/keywrap_core.v index 5d628e2..866e132 100644 --- a/src/rtl/keywrap_core.v +++ b/src/rtl/keywrap_core.v @@ -123,8 +123,8 @@ module keywrap_core #(parameter MEM_BITS = 11) reg iteration_ctr_set; reg iteration_ctr_rst; - reg [35 : 0] key_timeout_ctr_reg; - reg [35 : 0] key_timeout_ctr_new; + reg [31 : 0] key_timeout_ctr_reg; + reg [31 : 0] key_timeout_ctr_new; reg key_timeout_ctr_we; reg key_timeout_ctr_set; reg key_timeout_ctr_dec; @@ -219,7 +219,7 @@ module keywrap_core #(parameter MEM_BITS = 11) valid_reg <= 1'h1; block_ctr_reg <= {(MEM_BITS - 1){1'h0}}; iteration_ctr_reg <= 3'h0; - key_timeout_ctr_reg <= 36'h0; + key_timeout_ctr_reg <= 32'h0; key_loaded_reg <= 1'h0; keywrap_core_ctrl_reg <= CTRL_IDLE; end @@ -387,20 +387,19 @@ module keywrap_core #(parameter MEM_BITS = 11) //---------------------------------------------------------------- always @* begin : key_timeout_ctr - key_timeout_ctr_new = 36'h0; + key_timeout_ctr_new = 32'h0; key_timeout_ctr_we = 1'h0; key_timeout = 1'h0; - if (key_timeout_ctr_reg == 36'h0) + if (key_timeout_ctr_reg == 32'h0) key_timeout = 1'h1; if (key_timeout_ctr_set || ping) begin - key_timeout_ctr_new = {timeout, 4'h0}; + key_timeout_ctr_new = timeout; key_timeout_ctr_we = 1'h1; end - - if (key_timeout_ctr_dec) + else if (key_timeout_ctr_dec) begin key_timeout_ctr_new = key_timeout_ctr_reg - 1'h1; key_timeout_ctr_we = 1'h1; @@ -452,7 +451,7 @@ module keywrap_core #(parameter MEM_BITS = 11) valid_new = 1'h0; valid_we = 1'h1; keywrap_core_ctrl_new = CTRL_ZERO_WAIT; - keywrap_core_ctrl_we = 1'h0; + keywrap_core_ctrl_we = 1'h1; end else begin |