From: Thorsten Blum Date: Sat, 2 May 2026 19:09:04 +0000 (+0200) Subject: crypto: ecrdsa - fix unknown OID check in ecrdsa_param_curve X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=2d7b2cfc59998baf5e8622a24dc28f69a5212e06;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Lukas Wunner Reviewed-by: Vitaly Chikunov Signed-off-by: Herbert Xu --- 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;