mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
crypto: ecrdsa - fix unknown OID check in ecrdsa_param_curve
The ->curve_oid check in ecrdsa_param_curve() rejects the valid enum
value 0 (OID_id_dsa_with_sha1), but look_up_OID() returns OID__NR on
lookup failure. Compare ->curve_oid with OID__NR instead to ensure that
only unknown OIDs return -EINVAL.
Fixes: 0d7a78643f ("crypto: ecrdsa - add EC-RDSA (GOST 34.10) algorithm")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
c04337343e
commit
2d7b2cfc59
|
|
@ -145,7 +145,7 @@ int ecrdsa_param_curve(void *context, size_t hdrlen, unsigned char tag,
|
|||
struct ecrdsa_ctx *ctx = context;
|
||||
|
||||
ctx->curve_oid = look_up_OID(value, vlen);
|
||||
if (!ctx->curve_oid)
|
||||
if (ctx->curve_oid == OID__NR)
|
||||
return -EINVAL;
|
||||
ctx->curve = get_curve_by_oid(ctx->curve_oid);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user