summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2008-09-15 22:22:26 +0200
committerNiels Möller <nisse@lysator.liu.se>2008-09-15 22:22:26 +0200
commit2e98908a8517c807e938413eb8d4a0a06d07fdd6 (patch)
tree8febb920643452963752dd2877b9631ce6cb1679
parent122b8a1b7e6014d1a9a79baa7f0a0c43be4402f2 (diff)
downloadnettle-2e98908a8517c807e938413eb8d4a0a06d07fdd6.tar.gz
(yarrow256_seed): Disallow length == 0.
Rev: nettle/yarrow256.c:1.3
-rw-r--r--yarrow256.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/yarrow256.c b/yarrow256.c
index 7b72a617..184c5a33 100644
--- a/yarrow256.c
+++ b/yarrow256.c
@@ -109,9 +109,7 @@ yarrow256_seed(struct yarrow256_ctx *ctx,
unsigned length,
const uint8_t *seed_file)
{
- /* FIXME: Perhaps it's better to use assert ? */
- if (!length)
- return;
+ assert(length > 0);
sha256_update(&ctx->pools[YARROW_FAST], length, seed_file);
yarrow_fast_reseed(ctx);
@@ -133,7 +131,7 @@ yarrow_generate_block(struct yarrow256_ctx *ctx,
* machine independent, and follows appendix B of the NIST
* specification of cipher modes of operation.
*
- * We could keep a representation of thy counter as 4 32-bit values,
+ * We could keep a representation of the counter as 4 32-bit values,
* and write entire words (in big-endian byteorder) into the counter
* block, whenever they change. */
for (i = sizeof(ctx->counter); i--; )
@@ -278,9 +276,6 @@ yarrow256_update(struct yarrow256_ctx *ctx,
&& (entropy > YARROW_MULTIPLIER * length) )
entropy = YARROW_MULTIPLIER * length;
- /* FIXME: Calling a more sophisticated estimator could be done
- * here. */
-
entropy += source->estimate[current];
if (entropy > YARROW_MAX_ENTROPY)
entropy = YARROW_MAX_ENTROPY;
@@ -308,10 +303,6 @@ yarrow256_update(struct yarrow256_ctx *ctx,
case YARROW_SLOW:
{
- /* FIXME: This is somewhat inefficient. It would be better to
- * either maintain the count, or do this loop only if the
- * current source just crossed the threshold. */
-
if (!yarrow256_needed_sources(ctx))
{
yarrow_slow_reseed(ctx);