summaryrefslogtreecommitdiff
path: root/crypto/drbg.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2016-11-18 12:27:56 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-11-21 22:50:24 +0800
commit7bebee1d5e4b7e74e6afe6b188da3f0d485269cb (patch)
tree4331284c0813a73a928afca06611dfefa23d7133 /crypto/drbg.c
parente4fb45f88b5c1ad085777d3681d82fbb17a89ac5 (diff)
downloadlinux-crypto-7bebee1d5e4b7e74e6afe6b188da3f0d485269cb.tar.gz
linux-crypto-7bebee1d5e4b7e74e6afe6b188da3f0d485269cb.zip
crypto: drbg - advance output buffer pointer
The CTR DRBG segments the number of random bytes to be generated into 128 byte blocks. The current code misses the advancement of the output buffer pointer when the requestor asks for more than 128 bytes of data. In this case, the next 128 byte block of random numbers is copied to the beginning of the output buffer again. This implies that only the first 128 bytes of the output buffer would ever be filled. The patch adds the advancement of the buffer pointer to fill the entire buffer. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/drbg.c')
-rw-r--r--crypto/drbg.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c
index fb33f7d3..9a95b619 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1766,6 +1766,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
init_completion(&drbg->ctr_completion);
outlen -= cryptlen;
+ outbuf += cryptlen;
}
return 0;