Skip to content

Commit 32e5035

Browse files
tobluxgregkh
authored andcommitted
crypto: ecrdsa - fix unknown OID check in ecrdsa_param_curve
[ Upstream commit 2d7b2cf ] 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: 0d7a786 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e833e86 commit 32e5035

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crypto/ecrdsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ int ecrdsa_param_curve(void *context, size_t hdrlen, unsigned char tag,
153153
struct ecrdsa_ctx *ctx = context;
154154

155155
ctx->curve_oid = look_up_OID(value, vlen);
156-
if (!ctx->curve_oid)
156+
if (ctx->curve_oid == OID__NR)
157157
return -EINVAL;
158158
ctx->curve = get_curve_by_oid(ctx->curve_oid);
159159
return 0;

0 commit comments

Comments
 (0)