[Cryptech-Commits] [core/trng] 01/01: (1) Reducing timepout for entropy sources. Updated interface for sha-512 to match new interface with work factor ports. We are not using the work factor here at the moment.

git at cryptech.is git at cryptech.is
Thu Nov 20 09:42:29 UTC 2014


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

joachim at secworks.se pushed a commit to branch master
in repository core/trng.

commit b69155ba2de4ec405652748f83c0648fa3045328
Author: Joachim Strömbergson <joachim at secworks.se>
Date:   Thu Nov 20 10:42:24 2014 +0100

    (1) Reducing timepout for entropy sources. Updated interface for sha-512 to match new interface with work factor ports. We are not using the work factor here at the moment.
---
 src/rtl/trng_mixer.v | 80 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 35 deletions(-)

diff --git a/src/rtl/trng_mixer.v b/src/rtl/trng_mixer.v
index 821601b..455d15c 100644
--- a/src/rtl/trng_mixer.v
+++ b/src/rtl/trng_mixer.v
@@ -6,33 +6,33 @@
 //
 //
 // Author: Joachim Strombergson
-// Copyright (c) 2014, NORDUnet A/S All rights reserved.
+// Copyright (c) 2014, SUNET
+// All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-// - Redistributions of source code must retain the above copyright notice,
-//   this list of conditions and the following disclaimer.
+// Redistribution and use in source and binary forms, with or
+// without modification, are permitted provided that the following
+// conditions are met:
 //
-// - Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
 //
-// - Neither the name of the NORDUnet nor the names of its contributors may
-//   be used to endorse or promote products derived from this software
-//   without specific prior written permission.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in
+//    the documentation and/or other materials provided with the
+//    distribution.
 //
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
 //======================================================================
 
@@ -103,7 +103,7 @@ module trng_mixer(
   parameter ADDR_MIXER_STATUS      = 8'h11;
   parameter ADDR_MIXER_TIMEOUT     = 8'h20;
 
-  parameter DEFAULT_ENTROPY_TIMEOUT = 24'h800000;
+  parameter DEFAULT_ENTROPY_TIMEOUT = 24'h100000;
 
 
   //----------------------------------------------------------------
@@ -226,6 +226,10 @@ module trng_mixer(
   reg             hash_init;
   reg             hash_next;
 
+  wire            hash_work_factor;
+  wire [31 : 0]   hash_work_factor_num;
+
+
   wire [1023 : 0] hash_block;
   wire            hash_ready;
   wire [511 : 0]  hash_digest;
@@ -260,6 +264,9 @@ module trng_mixer(
                        block28_reg, block29_reg,
                        block30_reg, block31_reg};
 
+  assign hash_work_factor     = 0;
+  assign hash_work_factor_num = 32'h00000000;
+
   assign entropy0_ack = tmp_entropy0_ack;
   assign entropy1_ack = tmp_entropy1_ack;
   assign entropy2_ack = tmp_entropy2_ack;
@@ -270,20 +277,23 @@ module trng_mixer(
   //----------------------------------------------------------------
   // core instantiation.
   //----------------------------------------------------------------
-  sha512_core hash(
-                   .clk(clk),
-                   .reset_n(reset_n),
+  sha512_core hash_inst(
+                        .clk(clk),
+                        .reset_n(reset_n),
+
+                        .init(hash_init),
+                        .next(hash_next),
+                        .mode(MODE_SHA_512),
 
-                   .init(hash_init),
-                   .next(hash_next),
-                   .mode(MODE_SHA_512),
+                        .work_factor(hash_work_factor),
+                        .work_factor_num(hash_work_factor_num),
 
-                   .block(hash_block),
+                        .block(hash_block),
 
-                   .ready(hash_ready),
-                   .digest(hash_digest),
-                   .digest_valid(hash_digest_valid)
-                  );
+                        .ready(hash_ready),
+                        .digest(hash_digest),
+                        .digest_valid(hash_digest_valid)
+                       );
 
 
   //----------------------------------------------------------------



More information about the Commits mailing list