[Cryptech-Commits] [core/trng] 02/02: More debug fixes. We add one extra wait cycle to allow the mixer to detect that we want more seed.
git at cryptech.is
git at cryptech.is
Tue Sep 16 15:21:16 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 f2a4ea70dbee4c50b10045636dd91c3ef47386f1
Author: Joachim Strömbergson <joachim at secworks.se>
Date: Tue Sep 16 17:21:09 2014 +0200
More debug fixes. We add one extra wait cycle to allow the mixer to detect that we want more seed.
---
src/rtl/trng_csprng.v | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/rtl/trng_csprng.v b/src/rtl/trng_csprng.v
index 4d472d2..1bdc737 100644
--- a/src/rtl/trng_csprng.v
+++ b/src/rtl/trng_csprng.v
@@ -42,18 +42,18 @@ module trng_csprng(
input wire reset_n,
// Control, config and status.
+ input wire enable,
input debug_mode,
input wire [4 : 0] num_rounds,
input wire [63 : 0] num_blocks,
input wire seed,
- input wire enable,
output wire more_seed,
output wire ready,
output wire error,
// Seed input
- input wire seed_syn,
input [511 : 0] seed_data,
+ input wire seed_syn,
output wire seed_ack,
// Random data output
@@ -71,12 +71,13 @@ module trng_csprng(
parameter CTRL_IDLE = 4'h0;
parameter CTRL_SEED0 = 4'h1;
- parameter CTRL_SEED1 = 4'h2;
- parameter CTRL_INIT0 = 4'h3;
- parameter CTRL_INIT1 = 4'h4;
- parameter CTRL_NEXT0 = 4'h5;
- parameter CTRL_NEXT1 = 4'h6;
- parameter CTRL_MORE = 4'h7;
+ parameter CTRL_NSYN = 4'h2;
+ parameter CTRL_SEED1 = 4'h3;
+ parameter CTRL_INIT0 = 4'h4;
+ parameter CTRL_INIT1 = 4'h5;
+ parameter CTRL_NEXT0 = 4'h6;
+ parameter CTRL_NEXT1 = 4'h7;
+ parameter CTRL_MORE = 4'h8;
parameter CTRL_CANCEL = 4'hf;
@@ -133,6 +134,7 @@ module trng_csprng(
wire [511 : 0] cipher_data_out;
wire cipher_data_out_valid;
+ wire cipher_ready;
reg discard_outputs;
@@ -354,10 +356,24 @@ module trng_csprng(
end
else if (seed_syn)
begin
- more_seed_new = 1;
seed_ack_new = 1;
cipher_block_new = seed_data;
cipher_block_we = 1;
+ csprng_ctrl_new = CTRL_NSYN;
+ csprng_ctrl_we = 1;
+ end
+ end
+
+ CTRL_NSYN:
+ begin
+ if ((!enable) || (seed))
+ begin
+ csprng_ctrl_new = CTRL_CANCEL;
+ csprng_ctrl_we = 1;
+ end
+ else
+ begin
+ more_seed_new = 1;
csprng_ctrl_new = CTRL_SEED1;
csprng_ctrl_we = 1;
end
More information about the Commits
mailing list