* [PATCH] DRBG: fix failure of generating multiple of 2**16 bytes
@ 2014-07-31 19:47 Stephan Mueller
2014-08-01 14:41 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Stephan Mueller @ 2014-07-31 19:47 UTC (permalink / raw)
To: herbert; +Cc: linux-kernel, linux-crypto
The function drbg_generate_long slices the request into 2**16 byte
or smaller chunks. However, the loop, however invokes the random number
generation function with zero bytes when the request size is a multiple
of 2**16 bytes. The fix prevents zero bytes requests.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
crypto/drbg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/drbg.c b/crypto/drbg.c
index ff975d9..7894db9 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1500,7 +1500,7 @@ static int drbg_generate_long(struct drbg_state *drbg,
if (0 >= tmplen)
return tmplen;
len += tmplen;
- } while (slice > 0);
+ } while (slice > 0 && (len < buflen));
return len;
}
--
1.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] DRBG: fix failure of generating multiple of 2**16 bytes
2014-07-31 19:47 [PATCH] DRBG: fix failure of generating multiple of 2**16 bytes Stephan Mueller
@ 2014-08-01 14:41 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2014-08-01 14:41 UTC (permalink / raw)
To: Stephan Mueller; +Cc: linux-kernel, linux-crypto
On Thu, Jul 31, 2014 at 09:47:33PM +0200, Stephan Mueller wrote:
> The function drbg_generate_long slices the request into 2**16 byte
> or smaller chunks. However, the loop, however invokes the random number
> generation function with zero bytes when the request size is a multiple
> of 2**16 bytes. The fix prevents zero bytes requests.
>
> Signed-off-by: Stephan Mueller <smueller@chronox.de>
Patch applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-01 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 19:47 [PATCH] DRBG: fix failure of generating multiple of 2**16 bytes Stephan Mueller
2014-08-01 14:41 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®