diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-11-02 15:50:51 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-11-02 15:50:51 +0000 |
commit | 7b0a860d5b35b666908f9e6339a7f756ebb774e4 (patch) | |
tree | ce9e1fed99b6a09b65a805c18eb1cafcc0fbc273 /lib/libcrypto/ec/ec_lib.c | |
parent | 8097f599842a37c5264574f29db81d66547c95b8 (diff) |
Merge compressed coordinate setting back into ecp_smpl and ec_lib
The reason these were in separate files was FIPS. Not our problem.
Diffstat (limited to 'lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | lib/libcrypto/ec/ec_lib.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c index 0dcee7b2783..423c5ac7e25 100644 --- a/lib/libcrypto/ec/ec_lib.c +++ b/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_lib.c,v 1.74 2024/10/25 00:37:51 tb Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.75 2024/11/02 15:50:50 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -1032,6 +1032,45 @@ EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point LCRYPTO_ALIAS(EC_POINT_get_affine_coordinates_GFp); int +EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point, + const BIGNUM *x, int y_bit, BN_CTX *ctx_in) +{ + BN_CTX *ctx; + int ret = 0; + + if ((ctx = ctx_in) == NULL) + ctx = BN_CTX_new(); + if (ctx == NULL) + goto err; + + if (group->meth->point_set_compressed_coordinates == NULL) { + ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); + goto err; + } + if (group->meth != point->meth) { + ECerror(EC_R_INCOMPATIBLE_OBJECTS); + goto err; + } + ret = group->meth->point_set_compressed_coordinates(group, point, + x, y_bit, ctx); + + err: + if (ctx != ctx_in) + BN_CTX_free(ctx); + + return ret; +} +LCRYPTO_ALIAS(EC_POINT_set_compressed_coordinates); + +int +EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *point, + const BIGNUM *x, int y_bit, BN_CTX *ctx) +{ + return EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx); +} +LCRYPTO_ALIAS(EC_POINT_set_compressed_coordinates_GFp); + +int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx_in) { |