summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2025-12-26 18:41:05 +0000
committertb <>2025-12-26 18:41:05 +0000
commit9f98bd62b5811dc1239ca4a121b39c3d962c73c2 (patch)
treefd09183064be2434ff34bf37bf3b51ec876d957d /src
parent07a51ef39a66b69f85c35d11f0f5d8b9a351c25e (diff)
downloadopenbsd-9f98bd62b5811dc1239ca4a121b39c3d962c73c2.tar.gz
openbsd-9f98bd62b5811dc1239ca4a121b39c3d962c73c2.tar.bz2
openbsd-9f98bd62b5811dc1239ca4a121b39c3d962c73c2.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c5
-rw-r--r--src/lib/libcrypto/ec/ec_local.h3
2 files changed, 6 insertions, 2 deletions
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 @@
1/* $OpenBSD: ec_lib.c,v 1.126 2025/08/02 15:47:27 jsing Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.127 2025/12/26 18:41:05 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -815,6 +815,7 @@ EC_POINT_new(const EC_GROUP *group)
815 goto err; 815 goto err;
816 816
817 point->meth = group->meth; 817 point->meth = group->meth;
818 point->nid = group->nid;
818 819
819 return point; 820 return point;
820 821
@@ -856,6 +857,8 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src)
856 if (dst == src) 857 if (dst == src)
857 return 1; 858 return 1;
858 859
860 dst->nid = src->nid;
861
859 if (!bn_copy(dst->X, src->X)) 862 if (!bn_copy(dst->X, src->X))
860 return 0; 863 return 0;
861 if (!bn_copy(dst->Y, src->Y)) 864 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 @@
1/* $OpenBSD: ec_local.h,v 1.71 2025/11/26 10:19:57 tb Exp $ */ 1/* $OpenBSD: ec_local.h,v 1.72 2025/12/26 18:41:05 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -170,6 +170,7 @@ struct ec_group_st {
170 170
171struct ec_point_st { 171struct ec_point_st {
172 const EC_METHOD *meth; 172 const EC_METHOD *meth;
173 int nid;
173 174
174 /* 175 /*
175 * Jacobian projective coordinates: (X, Y, Z) represents (X/Z^2, Y/Z^3) 176 * Jacobian projective coordinates: (X, Y, Z) represents (X/Z^2, Y/Z^3)