提交 ce5481d0 编写于 作者: S Stephan Mueller 提交者: Herbert Xu

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: NStephan Mueller <smueller@chronox.de>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 63917232
...@@ -1500,7 +1500,7 @@ static int drbg_generate_long(struct drbg_state *drbg, ...@@ -1500,7 +1500,7 @@ static int drbg_generate_long(struct drbg_state *drbg,
if (0 >= tmplen) if (0 >= tmplen)
return tmplen; return tmplen;
len += tmplen; len += tmplen;
} while (slice > 0); } while (slice > 0 && (len < buflen));
return len; return len;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册