[Cryptech-Commits] [core/util/keywrap] 88/95: Fixed parameterized widths.

git at cryptech.is git at cryptech.is
Wed Mar 25 17:19:27 UTC 2020


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository core/util/keywrap.

commit 3455dd0940bb09e2f08c7951d3b10f415251af80
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Fri Jan 11 15:11:46 2019 +0100

    Fixed parameterized widths.
---
 src/rtl/keywrap.v      | 4 ++--
 src/rtl/keywrap_core.v | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v
index 73a861c..d6a2b5e 100644
--- a/src/rtl/keywrap.v
+++ b/src/rtl/keywrap.v
@@ -262,7 +262,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;
@@ -374,7 +374,7 @@ module keywrap #(parameter ADDR_BITS = 13)
                 api_rd_delay_new = timeout_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 3da4a19..adb3099 100644
--- a/src/rtl/keywrap_core.v
+++ b/src/rtl/keywrap_core.v
@@ -285,7 +285,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};



More information about the Commits mailing list