diff options
author | Stephan Mueller <smueller@chronox.de> | 2014-07-31 15:47:33 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-08-01 10:36:14 -0400 |
commit | ce5481d01f67ad304908ec2113515440c0fa86eb (patch) | |
tree | eb6d591256bcfaec0febc7edcf603566544a1210 /crypto | |
parent | 6391723293bb55f05b43973bbbc7a06822b50555 (diff) |
crypto: drbg - fix failure of generating multiple of 2**16 bytes
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/drbg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c index ff975d9e0c2a..7894db9ca90b 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
@@ -1500,7 +1500,7 @@ static int drbg_generate_long(struct drbg_state *drbg, | |||
1500 | if (0 >= tmplen) | 1500 | if (0 >= tmplen) |
1501 | return tmplen; | 1501 | return tmplen; |
1502 | len += tmplen; | 1502 | len += tmplen; |
1503 | } while (slice > 0); | 1503 | } while (slice > 0 && (len < buflen)); |
1504 | return len; | 1504 | return len; |
1505 | } | 1505 | } |
1506 | 1506 | ||