From 92fa8bbef42a52a3b621c75265ce432dde88e33e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Wed, 10 Oct 2001 18:13:49 +0200
Subject: [PATCH] (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
---
 yarrow_key_event.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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++;
-- 
GitLab