Message ID | 2357671.arYJ3FSGcR@myon.chronox.de (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Herbert Xu |
Headers | show |
Am Samstag, 18. April 2015, 16:42:20 schrieb Stephan Mueller: Hi Stephan, > 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 <herbert@gondor.apana.org.au> > 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 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) Please disregard this patch :-( I need to update that one further -- my preliminary tests worked but more extensive tests showed that the patch is wrong. > return tmplen; > len += tmplen; > } while (slice > 0 && (len < buflen));
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));
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 <herbert@gondor.apana.org.au> Signed-off-by: Stephan Mueller <smueller@chronox.de> --- crypto/drbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)