[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9904643.2WqB4rESCP@tauon.chronox.de>
Date:   Sun, 02 Aug 2020 20:29:05 +0200
From:   Stephan Mueller <smueller@...onox.de>
To:     herbert@...dor.apana.org.au, davem@...emloft.net, trix@...hat.com
Cc:     linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
        Tom Rix <trix@...hat.com>
Subject: Re: [PATCH] crypto: drbg: check blocklen is non zero
Am Sonntag, 2. August 2020, 19:12:47 CEST schrieb trix@...hat.com:
Hi Tom,
> From: Tom Rix <trix@...hat.com>
> 
> Clang static analysis reports this error
> 
> crypto/drbg.c:441:40: warning: Division by zero
>         padlen = (inputlen + sizeof(L_N) + 1) % (drbg_blocklen(drbg));
>                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
> 
> When drbg_bocklen fails it returns 0.
> 
> 	if (drbg && drbg->core)
> 		return drbg->core->blocklen_bytes;
> 	return 0;
> 
> In many places in drbg_ctr_df drbg_bocklen is assumed to be non zero.
> So turn the assumption into a check.
> 
> Fixes: 541af946fe13 ("crypto: drbg - SP800-90A Deterministic Random Bit
> Generator")
> 
> Signed-off-by: Tom Rix <trix@...hat.com>
Thank you.
Reviewed-by: Stephan Mueller <smueller@...onox.de>
Ciao
Stephan
Powered by blists - more mailing lists
 
