The drbg_generate returns 0 in success case. That means that
drbg_generate_long will always only generate drbg_max_request_bytes at
most. Longer requests will be truncated to drbg_max_request_bytes.

Reported-by: Herbert Xu <herb...@gondor.apana.org.au>
Signed-off-by: Stephan Mueller <smuel...@chronox.de>
---
 crypto/drbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/drbg.c b/crypto/drbg.c
index b69409c..74f7c1e 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1450,7 +1450,7 @@ static int drbg_generate_long(struct drbg_state *drbg,
                slice = ((buflen - len) / drbg_max_request_bytes(drbg));
                chunk = slice ? drbg_max_request_bytes(drbg) : (buflen - len);
                tmplen = drbg_generate(drbg, buf + len, chunk, addtl);
-               if (0 >= tmplen)
+               if (0 > tmplen)
                        return tmplen;
                len += tmplen;
        } while (slice > 0 && (len < buflen));
-- 
2.1.0


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to