* crypto: possible NULL reference
@ 2021-03-30 4:11 Randy Dunlap
2021-04-09 7:51 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2021-03-30 4:11 UTC (permalink / raw)
To: Linux Crypto Mailing List, Dexuan Cui, Eric Biggers; +Cc: LKML, Herbert Xu
As I was trying to document "fips=<integer", I noticed this.
In crypto/ecc.c, ecc_get_curve() can return NULL:
const struct ecc_curve *ecc_get_curve(unsigned int curve_id)
{
switch (curve_id) {
/* In FIPS mode only allow P256 and higher */
case ECC_CURVE_NIST_P192:
return fips_enabled ? NULL : &nist_p192;
case ECC_CURVE_NIST_P256:
return &nist_p256;
case ECC_CURVE_NIST_P384:
return &nist_p384;
default:
return NULL;
}
}
but when its return value is passed to
static int __ecc_is_key_valid(const struct ecc_curve *curve,
const u64 *private_key, unsigned int ndigits)
the use of <curve> here is not checked for NULL or not NULL
before it is used. Nor is the use of <curve> in most other functions
in ecc.c.
Is there something else protecting the improper use of <curve>
in these cases? or is a patch warranted?
thanks.
--
~Randy
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: crypto: possible NULL reference
2021-03-30 4:11 crypto: possible NULL reference Randy Dunlap
@ 2021-04-09 7:51 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2021-04-09 7:51 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Linux Crypto Mailing List, Dexuan Cui, Eric Biggers, LKML
On Mon, Mar 29, 2021 at 09:11:17PM -0700, Randy Dunlap wrote:
>
> Is there something else protecting the improper use of <curve>
> in these cases? or is a patch warranted?
The curve ID is always hard-coded and AFAIK we don't have any
use-cases where an unsupported curve ID is used.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-09 7:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 4:11 crypto: possible NULL reference Randy Dunlap
2021-04-09 7:51 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.