diff options
author | Niels Möller <nisse@lysator.liu.se> | 2001-10-10 18:13:49 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2001-10-10 18:13:49 +0200 |
commit | 92fa8bbef42a52a3b621c75265ce432dde88e33e (patch) | |
tree | 98d7bd027267d2f3f9eedfaec780f72edcd53817 /yarrow_key_event.c | |
parent | b2a6b03aa4bca0108e72dba281d53fcf1b39490d (diff) | |
download | nettle-92fa8bbef42a52a3b621c75265ce432dde88e33e.tar.gz |
(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
Diffstat (limited to 'yarrow_key_event.c')
-rw-r--r-- | yarrow_key_event.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/yarrow_key_event.c b/yarrow_key_event.c index 9ddbb00b..6ea9a811 100644 --- a/yarrow_key_event.c +++ b/yarrow_key_event.c @@ -30,6 +30,8 @@ yarrow_key_event_init(struct yarrow_key_event_ctx *ctx) unsigned i; ctx->index = 0; + ctx->previous = 0; + for (i = 0; i < YARROW_KEY_EVENT_BUFFER; i++) ctx->chars[i] = 0; } @@ -42,7 +44,7 @@ yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx, unsigned i; /* Look at timing first. */ - if (ctx->index) + if (ctx->previous) { if ( (time - ctx->previous) < 256) entropy++; |