diff options
author | tb <> | 2024-11-03 13:53:14 +0000 |
---|---|---|
committer | tb <> | 2024-11-03 13:53:14 +0000 |
commit | d14398e8250d525c82217dec47102cf942e39f8b (patch) | |
tree | 4b24cb9c25a80888fd4ca42553bba0ecd96d6f70 | |
parent | 43dc96128277a7f05032e54f8540ea0c163b0480 (diff) | |
download | openbsd-d14398e8250d525c82217dec47102cf942e39f8b.tar.gz openbsd-d14398e8250d525c82217dec47102cf942e39f8b.tar.bz2 openbsd-d14398e8250d525c82217dec47102cf942e39f8b.zip |
Move point at infinity check to API boundary
Since we only consider standard affine coordinates, the point at infinity
must be excluded. Check at the API boundary that the point isn't the point
at infinity rather than hiding this check somewhere in a method.
ok jsing
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index a16fe05c44..327cda900b 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.76 2024/11/02 15:58:49 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.77 2024/11/03 13:53:14 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 | */ |
@@ -1001,9 +1001,14 @@ int | |||
1001 | EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, | 1001 | EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, |
1002 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx_in) | 1002 | BIGNUM *x, BIGNUM *y, BN_CTX *ctx_in) |
1003 | { | 1003 | { |
1004 | BN_CTX *ctx; | 1004 | BN_CTX *ctx = NULL; |
1005 | int ret = 0; | 1005 | int ret = 0; |
1006 | 1006 | ||
1007 | if (EC_POINT_is_at_infinity(group, point) > 0) { | ||
1008 | ECerror(EC_R_POINT_AT_INFINITY); | ||
1009 | goto err; | ||
1010 | } | ||
1011 | |||
1007 | if ((ctx = ctx_in) == NULL) | 1012 | if ((ctx = ctx_in) == NULL) |
1008 | ctx = BN_CTX_new(); | 1013 | ctx = BN_CTX_new(); |
1009 | if (ctx == NULL) | 1014 | if (ctx == NULL) |