Skip to content
Snippets Groups Projects
Commit 92fa8bbe authored by Niels Möller's avatar Niels Möller
Browse files

(yarrow_key_event_estimate): Check if

previous is zero.
(yarrow_key_event_init): Initialize previous to zero.

Rev: src/nettle/yarrow_key_event.c:1.2
parent b2a6b03a
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,8 @@ yarrow_key_event_init(struct yarrow_key_event_ctx *ctx) ...@@ -30,6 +30,8 @@ yarrow_key_event_init(struct yarrow_key_event_ctx *ctx)
unsigned i; unsigned i;
ctx->index = 0; ctx->index = 0;
ctx->previous = 0;
for (i = 0; i < YARROW_KEY_EVENT_BUFFER; i++) for (i = 0; i < YARROW_KEY_EVENT_BUFFER; i++)
ctx->chars[i] = 0; ctx->chars[i] = 0;
} }
...@@ -42,7 +44,7 @@ yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx, ...@@ -42,7 +44,7 @@ yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx,
unsigned i; unsigned i;
/* Look at timing first. */ /* Look at timing first. */
if (ctx->index) if (ctx->previous)
{ {
if ( (time - ctx->previous) < 256) if ( (time - ctx->previous) < 256)
entropy++; entropy++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment