2008-07-07 14:22:26

by Neil Horman

[permalink] [raw]
Subject: [PATCH] prng: fix repetition test to properly update on each iteration


Fixing a silly bug that I missed in the initial submission
Fix the repetition test in prng to update on each iteration. Currently we check
against the last iteration to make sure the given prng context isn't stuck, but
we never update the last data buffer.

Best
Neil

Signed-off-by: Neil Horman <[email protected]>


prng.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/crypto/prng.c b/crypto/prng.c
index 1310175..5b66bdf 100644
--- a/crypto/prng.c
+++ b/crypto/prng.c
@@ -153,6 +153,7 @@ static int _get_more_prng_bytes(struct prng_context *ctx)
ctx->flags |= PRNG_NEED_RESET;
return -1;
}
+ memcpy(ctx->last_rand_data, ctx->rand_data, DEFAULT_BLK_SZ);

/*
* Lastly xor the random data with I
--
/****************************************************
* Neil Horman <[email protected]>
* Software Engineer, Red Hat
****************************************************/


2008-07-07 14:42:05

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] prng: fix repetition test to properly update on each iteration

On Mon, Jul 07, 2008 at 10:22:10AM -0400, Neil Horman wrote:
>
> Fixing a silly bug that I missed in the initial submission
> Fix the repetition test in prng to update on each iteration. Currently we check
> against the last iteration to make sure the given prng context isn't stuck, but
> we never update the last data buffer.
>
> Best
> Neil
>
> Signed-off-by: Neil Horman <[email protected]>

Patch applied. Thanks!
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt