[Cryptech-Commits] [user/js/keywrap] branch master updated: Debugged key unwrap. First testcase for unwerap passed. Added some more debug outputs.

git at cryptech.is git at cryptech.is
Fri Jul 6 10:35:29 UTC 2018


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

joachim at secworks.se pushed a commit to branch master
in repository user/js/keywrap.

The following commit(s) were added to refs/heads/master by this push:
     new 697456b  Debugged key unwrap. First testcase for unwerap passed. Added some more debug outputs.
697456b is described below

commit 697456be8bf1eb4585dd0d88b185659b4bc17fe9
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Fri Jul 6 12:35:14 2018 +0200

    Debugged key unwrap. First testcase for unwerap passed. Added some more debug outputs.
---
 src/rtl/keywrap_core.v | 18 +++++++++---------
 src/tb/tb_keywrap.v    |  1 +
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/rtl/keywrap_core.v b/src/rtl/keywrap_core.v
index 35bdfa6..1e8ac5b 100644
--- a/src/rtl/keywrap_core.v
+++ b/src/rtl/keywrap_core.v
@@ -233,10 +233,10 @@ module keywrap_core (
 
       a_new     = 64'h0;
       a_we      = 1'h0;
-      core_addr = block_ctr_reg - 1'h1;
+      core_addr = block_ctr_reg;
       core_we   = 1'h0;
 
-      xor_val = (rlen * iteration_ctr_reg) + {51'h0, block_ctr_reg};
+      xor_val = (rlen * iteration_ctr_reg) + {51'h0, (block_ctr_reg + 1'h1)};
 
       if (encdec)
         aes_block = {a_reg, core_rd_data};
@@ -274,13 +274,13 @@ module keywrap_core (
 
       if (block_ctr_rst)
         begin
-          block_ctr_new = 13'h1;
+          block_ctr_new = 13'h0;
           block_ctr_we  = 1'h1;
         end
 
       if (block_ctr_set)
         begin
-          block_ctr_new = rlen;
+          block_ctr_new = (rlen - 1);
           block_ctr_we  = 1'h1;
         end
 
@@ -320,7 +320,7 @@ module keywrap_core (
 
       if (iteration_ctr_dec)
         begin
-          iteration_ctr_new = iteration_ctr_reg + 1'h1;
+          iteration_ctr_new = iteration_ctr_reg - 1'h1;
           iteration_ctr_we  = 1'h1;
         end
 
@@ -458,7 +458,7 @@ module keywrap_core (
 
         CTRL_NEXT_WCHECK:
           begin
-            if (block_ctr_reg < rlen)
+            if (block_ctr_reg < (rlen - 1))
               begin
                 block_ctr_inc         = 1'h1;
                 keywrap_core_ctrl_new = CTRL_NEXT_LOOP0;
@@ -483,10 +483,10 @@ module keywrap_core (
 
         CTRL_NEXT_UCHECK:
           begin
-            if (block_ctr_reg > 1)
+            if (block_ctr_reg > 0)
               begin
                 block_ctr_dec         = 1'h1;
-                keywrap_core_ctrl_new = CTRL_NEXT_LOOP;
+                keywrap_core_ctrl_new = CTRL_NEXT_LOOP0;
                 keywrap_core_ctrl_we  = 1'h1;
               end
 
@@ -494,7 +494,7 @@ module keywrap_core (
               begin
                 block_ctr_set         = 1'h1;
                 iteration_ctr_dec     = 1'h1;
-                keywrap_core_ctrl_new = CTRL_NEXT_LOOP;
+                keywrap_core_ctrl_new = CTRL_NEXT_LOOP0;
                 keywrap_core_ctrl_we  = 1'h1;
               end
 
diff --git a/src/tb/tb_keywrap.v b/src/tb/tb_keywrap.v
index a13521c..edbbbcf 100644
--- a/src/tb/tb_keywrap.v
+++ b/src/tb/tb_keywrap.v
@@ -272,6 +272,7 @@ module tb_keywrap();
                    dut.core.core_we, dut.core.core_addr);
           $display("core_rd_data = 0x%0x  core_wr_data = 0x%0x ",
                    dut.core.core_rd_data, dut.core.core_wr_data);
+          $display("xor_val = 0x%0x", dut.core.keywrap_logic.xor_val);
           $display("");
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list