From 9f98bd62b5811dc1239ca4a121b39c3d962c73c2 Mon Sep 17 00:00:00 2001 From: tb <> Date: Fri, 26 Dec 2025 18:41:05 +0000 Subject: Add nid to EC_POINT for compat checking It is annoying that an EC_POINT does not really know on what EC_GROUP it lives. Adding a refcount to EC_GROUP is slightly tricky, so instead use a nid which we will know unless the group was constructed by hand. ok jsing kenjiro --- src/lib/libcrypto/ec/ec_lib.c | 5 ++++- src/lib/libcrypto/ec/ec_local.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 36f42ecc05..b31c132a77 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_lib.c,v 1.126 2025/08/02 15:47:27 jsing Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.127 2025/12/26 18:41:05 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -815,6 +815,7 @@ EC_POINT_new(const EC_GROUP *group) goto err; point->meth = group->meth; + point->nid = group->nid; return point; @@ -856,6 +857,8 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src) if (dst == src) return 1; + dst->nid = src->nid; + if (!bn_copy(dst->X, src->X)) return 0; if (!bn_copy(dst->Y, src->Y)) diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h index 48a7d929ea..933fd98f14 100644 --- a/src/lib/libcrypto/ec/ec_local.h +++ b/src/lib/libcrypto/ec/ec_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_local.h,v 1.71 2025/11/26 10:19:57 tb Exp $ */ +/* $OpenBSD: ec_local.h,v 1.72 2025/12/26 18:41:05 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -170,6 +170,7 @@ struct ec_group_st { struct ec_point_st { const EC_METHOD *meth; + int nid; /* * Jacobian projective coordinates: (X, Y, Z) represents (X/Z^2, Y/Z^3) -- cgit v1.2.3-55-g6feb