aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
authorThorsten Blum <thorsten.blum@linux.dev>2026-05-02 21:09:04 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2026-05-07 16:10:03 +0800
commit2d7b2cfc59998baf5e8622a24dc28f69a5212e06 (patch)
tree2dba1886621130cbaf26b903d090748c9fda4834 /crypto
parentc04337343ef6e1d5ee5b49ac386e468c2d063e07 (diff)
downloadlinux-next-history-2d7b2cfc59998baf5e8622a24dc28f69a5212e06.tar.gz
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: 0d7a78643f69 ("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>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ecrdsa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/ecrdsa.c b/crypto/ecrdsa.c
index 2c0602f0cd406..0cd7eb3676041 100644
--- a/crypto/ecrdsa.c
+++ b/crypto/ecrdsa.c
@@ -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;