(yarrow_key_event_estimate): Check if
authorNiels Möller <nisse@lysator.liu.se>
Wed, 10 Oct 2001 16:13:49 +0000 (18:13 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 10 Oct 2001 16:13:49 +0000 (18:13 +0200)
previous is zero.
(yarrow_key_event_init): Initialize previous to zero.

Rev: src/nettle/yarrow_key_event.c:1.2

yarrow_key_event.c

index 9ddbb00b9de668999690bf5b2990a20856392a83..6ea9a8114bfe48627ba6b02a4551e6d08c532793 100644 (file)
@@ -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++;