summaryrefslogtreecommitdiff
path: root/yarrow256.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2001-12-12 11:06:22 +0100
committerNiels Möller <nisse@lysator.liu.se>2001-12-12 11:06:22 +0100
commit16a4227a5b0920ff7c3184e92b607cc43164eef9 (patch)
tree0124d4d630e875cf1a08f02764b2d0a54b957edd /yarrow256.c
parent15240e01440e98672f2ac7e7d16c3c651e595f67 (diff)
downloadnettle-16a4227a5b0920ff7c3184e92b607cc43164eef9.tar.gz
(yarrow_slow_reseed): Bug fix, update the fast pool
with the digest of the slow pool. (yarrow256_init): Initialize seed_file and counter to zero, to ease debugging. Rev: src/nettle/yarrow256.c:1.14
Diffstat (limited to 'yarrow256.c')
-rw-r--r--yarrow256.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/yarrow256.c b/yarrow256.c
index af3160d9..ad6c3b56 100644
--- a/yarrow256.c
+++ b/yarrow256.c
@@ -84,6 +84,11 @@ yarrow256_init(struct yarrow256_ctx *ctx,
ctx->seeded = 0;
+ /* Not strictly, necessary, but it makes it easier to see if the
+ * values are sane. */
+ memset(ctx->seed_file, 0, YARROW256_SEED_FILE_SIZE);
+ memset(ctx->counter, 0, sizeof(ctx->counter));
+
ctx->nsources = n;
ctx->sources = s;
@@ -228,7 +233,7 @@ yarrow_slow_reseed(struct yarrow256_ctx *ctx)
sha256_init(&ctx->pools[YARROW_SLOW]);
/* Feed it into the fast pool */
- sha256_update(&ctx->pools[YARROW_SLOW], sizeof(digest), digest);
+ sha256_update(&ctx->pools[YARROW_FAST], sizeof(digest), digest);
yarrow_fast_reseed(ctx);