[Cryptech-Commits] [user/js/keywrap] branch integrate_mkmif updated: Fixed incorrect address used for the key. Added testcase to verify reading of status word.

git at cryptech.is git at cryptech.is
Tue Nov 6 15:40:57 UTC 2018


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

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

The following commit(s) were added to refs/heads/integrate_mkmif by this push:
     new 42d6350  Fixed incorrect address used for the key. Added testcase to verify reading of status word.
42d6350 is described below

commit 42d63504f02f895a7b89dc164571c4b0d21cf8d4
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Tue Nov 6 16:40:14 2018 +0100

    Fixed incorrect address used for the key. Added testcase to verify reading of status word.
---
 src/rtl/keywrap_mkmif.v   |  4 ++--
 src/tb/tb_keywrap_mkmif.v | 40 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/src/rtl/keywrap_mkmif.v b/src/rtl/keywrap_mkmif.v
index ad2121e..e2b9302 100644
--- a/src/rtl/keywrap_mkmif.v
+++ b/src/rtl/keywrap_mkmif.v
@@ -331,7 +331,7 @@ module keywrap_mkmif (
             if (key_word_ctr_reg < 8)
               begin
                 mkm_read_op            = 1'h1;
-                mkm_addr_new           = MKM_STATUS_WORD + {key_word_ctr_reg, 2'h0};
+                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_we  = 1'h1;
@@ -361,7 +361,7 @@ module keywrap_mkmif (
             if (key_word_ctr_reg < 8)
               begin
                 mkm_write_op           = 1'h1;
-                mkm_addr_new           = MKM_STATUS_WORD + {key_word_ctr_reg, 2'h0};
+                mkm_addr_new           = MKM_KEY_BASE_WORD + {key_word_ctr_reg, 2'h0};
                 mkm_addr_we            = 1'h1;
                 mkm_write_data_new     = wr_key[key_word_ctr_reg * 32 +: 32];
                 mkm_write_data_we      = 1'h1;
diff --git a/src/tb/tb_keywrap_mkmif.v b/src/tb/tb_keywrap_mkmif.v
index 8bd3a05..e917c2c 100644
--- a/src/tb/tb_keywrap_mkmif.v
+++ b/src/tb/tb_keywrap_mkmif.v
@@ -182,9 +182,9 @@ module tb_keywrap_mkm();
       tc_ctr = tc_ctr + 1;
 
       $display("TEST AUTO-LOAD START");
-      $display("Check that correct ICV is generated for a single block message.");
+      $display("Check that key and key status is read automatically after reset.");
 
-      // Observe SPI for a number of cycles. Reset the DUT during monitoring.
+      // Observe SPI for a number of cycles. Reset the DUT during observation.
       show_spi = 1;
       #(10 * CLK_PERIOD);
       reset_dut();
@@ -197,21 +197,51 @@ module tb_keywrap_mkm();
   endtask // auto_load
 
 
+  //----------------------------------------------------------------
+  // test_write_status
+  //----------------------------------------------------------------
+  task test_write_status;
+    begin
+      tc_ctr = tc_ctr + 1;
+
+      $display("TEST WRITE STATUS START");
+      $display("Check that we can write the key status word.");
+
+      // Observe SPI for a number of cycles. Reset the DUT during observation.
+      show_spi = 1;
+      #(10 * CLK_PERIOD);
+
+      tb_key_status = 1'h0;
+      tb_write      = 1'h1;
+      tb_wr_status  = 32'hdeadbeef;
+
+      #(CLK_PERIOD);
+      tb_write      = 1'h0;
+
+      #(100 * CLK_PERIOD);
+      show_spi = 0;
+
+      $display("TEST WRITE STATUS END");
+      $display("");
+    end
+  endtask // test_write_status
+
 
   //----------------------------------------------------------------
   // main
   //----------------------------------------------------------------
   initial
     begin : main
-      $display("   -= Testbench for Keywrap mkmif wrapper started =-");
-      $display("    ================================================");
+      $display("   -= Testbench for Keywrap mkmif integration started =-");
+      $display("    ====================================================");
       $display("");
 
       init_sim();
       test_auto_load();
+      test_write_status();
 
       $display("");
-      $display("*** Keywrap mkmif wrapper testbench done. ***");
+      $display("*** Keywrap mkmif integration testbench done. ***");
       $finish;
     end // main
 

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


More information about the Commits mailing list