diff options
| author | tb <> | 2025-12-26 18:45:42 +0000 |
|---|---|---|
| committer | tb <> | 2025-12-26 18:45:42 +0000 |
| commit | 0e28e8b910443b64c021ba44af8042b9ae325e5c (patch) | |
| tree | 67b82633c7b5ebf145231992903885f953dc23ec /src | |
| parent | e568a255270032a6a88715db4e3609b6129702ed (diff) | |
| download | openbsd-0e28e8b910443b64c021ba44af8042b9ae325e5c.tar.gz openbsd-0e28e8b910443b64c021ba44af8042b9ae325e5c.tar.bz2 openbsd-0e28e8b910443b64c021ba44af8042b9ae325e5c.zip | |
Add compatibility check to EC_POINT_mul()
This is the only public API that doesn't check for compatibility between
group and point. Add the missing check.
ok jsing kenjiro
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index c140249f0e..dc8800dff2 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.129 2025/12/26 18:44:19 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.130 2025/12/26 18:45:42 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 | */ |
| @@ -1343,6 +1343,12 @@ EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, | |||
| 1343 | goto err; | 1343 | goto err; |
| 1344 | } | 1344 | } |
| 1345 | 1345 | ||
| 1346 | if (!ec_group_and_point_compatible(group, r) || | ||
| 1347 | (point != NULL && !ec_group_and_point_compatible(group, point))) { | ||
| 1348 | ECerror(EC_R_INCOMPATIBLE_OBJECTS); | ||
| 1349 | goto err; | ||
| 1350 | } | ||
| 1351 | |||
| 1346 | if (g_scalar != NULL && point == NULL && p_scalar == NULL) { | 1352 | if (g_scalar != NULL && point == NULL && p_scalar == NULL) { |
| 1347 | /* | 1353 | /* |
| 1348 | * In this case we want to compute g_scalar * GeneratorPoint: | 1354 | * In this case we want to compute g_scalar * GeneratorPoint: |
