[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97371bc7-ebb6-92f2-bbaa-6b444e27cb8b@redhat.com>
Date: Thu, 20 Aug 2020 06:27:36 -0700
From: Tom Rix <trix@...hat.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: davem@...emloft.net, smueller@...onox.de,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: drbg: check blocklen is non zero
There are many divide by 0 reports. This one got attention because it is in crypto, where i believe problems, even false positives, should be fixed.
Tom
On 8/20/20 12:15 AM, Herbert Xu wrote:
> On Sun, Aug 02, 2020 at 10:12:47AM -0700, trix@...hat.com wrote:
>> 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;
> Yes but it can only fail if the drbg is not instantiated. If
> you're hitting the generate path with an uninstantiated drbg you've
> got bigger problems than a divide by zero.
>
> So how is this even possible?
>
> Cheers,
Powered by blists - more mailing lists