summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-02-07 09:00:48 +0000
committertb <>2023-02-07 09:00:48 +0000
commit5701ad0e385dd88700fb100c0ea01cabe49716bb (patch)
tree247a83dd5ea7e0e467b032d9a261c853da1aefe4
parentd00cad41b7d89e460a24f1758127775119a2be6d (diff)
downloadopenbsd-5701ad0e385dd88700fb100c0ea01cabe49716bb.tar.gz
openbsd-5701ad0e385dd88700fb100c0ea01cabe49716bb.tar.bz2
openbsd-5701ad0e385dd88700fb100c0ea01cabe49716bb.zip
libcrypto/ec: another missing point-on-curve check
Unlike in the affine/compressed/... cases, when setting projective coordinates of an elliptic curve point, there is no check whether the point is actually on the curve. Pointed out by Guido Vranken ok beck miod
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 5ad535f7ec..2a99f8d490 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.47 2022/11/26 16:08:52 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.48 2023/02/07 09:00:48 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 */
@@ -949,8 +949,14 @@ EC_POINT_set_Jprojective_coordinates(const EC_GROUP *group, EC_POINT *point,
949 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 949 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
950 return 0; 950 return 0;
951 } 951 }
952 return group->meth->point_set_Jprojective_coordinates(group, point, 952 if (!group->meth->point_set_Jprojective_coordinates(group, point,
953 x, y, z, ctx); 953 x, y, z, ctx))
954 return 0;
955 if (EC_POINT_is_on_curve(group, point, ctx) <= 0) {
956 ECerror(EC_R_POINT_IS_NOT_ON_CURVE);
957 return 0;
958 }
959 return 1;
954} 960}
955 961
956int 962int