diff options
| author | tb <> | 2023-02-07 09:00:48 +0000 |
|---|---|---|
| committer | tb <> | 2023-02-07 09:00:48 +0000 |
| commit | a254bfc2812044c2392c879efa93c46e87ac5266 (patch) | |
| tree | 247a83dd5ea7e0e467b032d9a261c853da1aefe4 | |
| parent | aaf5516f11bba33217f3fa07b497d5b1dc0158d1 (diff) | |
| download | openbsd-a254bfc2812044c2392c879efa93c46e87ac5266.tar.gz openbsd-a254bfc2812044c2392c879efa93c46e87ac5266.tar.bz2 openbsd-a254bfc2812044c2392c879efa93c46e87ac5266.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.c | 12 |
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 | ||
| 956 | int | 962 | int |
