[Cryptech-Commits] [core/hash/sha512] 01/01: Completed test case for state restore. The state restore functionality works. Minor tweak of work factor test.

git at cryptech.is git at cryptech.is
Sat Jul 18 13:26:24 UTC 2015


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

joachim at secworks.se pushed a commit to branch state_restore
in repository core/hash/sha512.

commit 9ddb7141ff98d550a652ae678a861fb2e0331486
Author: Joachim Strömbergson <joachim at secworks.se>
Date:   Sat Jul 18 15:26:18 2015 +0200

    Completed test case for state restore. The state restore functionality works. Minor tweak of work factor test.
---
 src/tb/tb_sha512.v | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/tb/tb_sha512.v b/src/tb/tb_sha512.v
index a3409f5..ff8138c 100644
--- a/src/tb/tb_sha512.v
+++ b/src/tb/tb_sha512.v
@@ -679,21 +679,21 @@ module tb_sha512();
 
       // Write state.
       write_word(ADDR_DIGEST0, state[511 : 480]);
-      write_word(ADDR_DIGEST0, state[479 : 448]);
-      write_word(ADDR_DIGEST0, state[447 : 416]);
-      write_word(ADDR_DIGEST0, state[415 : 384]);
-      write_word(ADDR_DIGEST0, state[383 : 352]);
-      write_word(ADDR_DIGEST0, state[351 : 320]);
-      write_word(ADDR_DIGEST0, state[319 : 288]);
-      write_word(ADDR_DIGEST0, state[287 : 256]);
-      write_word(ADDR_DIGEST0, state[255 : 224]);
-      write_word(ADDR_DIGEST0, state[223 : 192]);
-      write_word(ADDR_DIGEST0, state[191 : 160]);
-      write_word(ADDR_DIGEST0, state[159 : 128]);
-      write_word(ADDR_DIGEST0, state[127 : 096]);
-      write_word(ADDR_DIGEST0, state[095 : 064]);
-      write_word(ADDR_DIGEST0, state[063 : 032]);
-      write_word(ADDR_DIGEST0, state[031 : 000]);
+      write_word(ADDR_DIGEST1, state[479 : 448]);
+      write_word(ADDR_DIGEST2, state[447 : 416]);
+      write_word(ADDR_DIGEST3, state[415 : 384]);
+      write_word(ADDR_DIGEST4, state[383 : 352]);
+      write_word(ADDR_DIGEST5, state[351 : 320]);
+      write_word(ADDR_DIGEST6, state[319 : 288]);
+      write_word(ADDR_DIGEST7, state[287 : 256]);
+      write_word(ADDR_DIGEST8, state[255 : 224]);
+      write_word(ADDR_DIGEST9, state[223 : 192]);
+      write_word(ADDR_DIGEST10, state[191 : 160]);
+      write_word(ADDR_DIGEST11, state[159 : 128]);
+      write_word(ADDR_DIGEST12, state[127 : 096]);
+      write_word(ADDR_DIGEST13, state[095 : 064]);
+      write_word(ADDR_DIGEST14, state[063 : 032]);
+      write_word(ADDR_DIGEST15, state[031 : 000]);
 
       // Final block
       write_block(block);
@@ -728,13 +728,13 @@ module tb_sha512();
   //
   // Perform test of the work factor function.
   //----------------------------------------------------------------
-  task work_factor_test();
+  task work_factor_test(input [7 : 0] tc_number);
     reg [1023 : 0] my_block;
     reg [511 :  0] my_digest;
     reg [31 : 0]   my_ctrl_cmd;
 
     begin
-      $display("*** TC%01d - Work factor test started.", tc_ctr);
+      $display("*** TC%01d - Work factor test started.", tc_number);
 
       // Read out work factor number.
       read_word(ADDR_WORK_FACTOR_NUM);
@@ -843,12 +843,12 @@ module tb_sha512();
       tc12_expected = {384'h09330C33F71147E83D192FC782CD1B4753111B173B3B05D22FA08086E3B0F712FCC7C71A557E2DB966C3E9FA91746039, {4{32'h00000000}}};
       double_block_test(8'h08, MODE_SHA_384, double_block_one, double_block_two, tc11_expected, tc12_expected);
 
-      // Work factor test.
-//      work_factor_test();
-
       // State restore test.
       state_restore_test(8'h09, MODE_SHA_512, tc5_expected, double_block_two, tc6_expected);
 
+      // Work factor test.
+      work_factor_test(8'h0a);
+
       dump_dut_state();
 
       display_test_result();



More information about the Commits mailing list