summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
authortb <>2024-11-02 15:50:50 +0000
committertb <>2024-11-02 15:50:50 +0000
commit04277a8a70494b7b35dc16881dea60c36382073c (patch)
treeafddf8953e07c4b922c56d9d930051ace171ebfe /src/lib/libcrypto/ec/ec_lib.c
parent7ac9d79f59c8680854d47ab54d8cb8d38183a391 (diff)
downloadopenbsd-04277a8a70494b7b35dc16881dea60c36382073c.tar.gz
openbsd-04277a8a70494b7b35dc16881dea60c36382073c.tar.bz2
openbsd-04277a8a70494b7b35dc16881dea60c36382073c.zip
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 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 0dcee7b278..423c5ac7e2 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.74 2024/10/25 00:37:51 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.75 2024/11/02 15:50:50 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 */
@@ -1032,6 +1032,45 @@ EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, const EC_POINT *point
1032LCRYPTO_ALIAS(EC_POINT_get_affine_coordinates_GFp); 1032LCRYPTO_ALIAS(EC_POINT_get_affine_coordinates_GFp);
1033 1033
1034int 1034int
1035EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *point,
1036 const BIGNUM *x, int y_bit, BN_CTX *ctx_in)
1037{
1038 BN_CTX *ctx;
1039 int ret = 0;
1040
1041 if ((ctx = ctx_in) == NULL)
1042 ctx = BN_CTX_new();
1043 if (ctx == NULL)
1044 goto err;
1045
1046 if (group->meth->point_set_compressed_coordinates == NULL) {
1047 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
1048 goto err;
1049 }
1050 if (group->meth != point->meth) {
1051 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
1052 goto err;
1053 }
1054 ret = group->meth->point_set_compressed_coordinates(group, point,
1055 x, y_bit, ctx);
1056
1057 err:
1058 if (ctx != ctx_in)
1059 BN_CTX_free(ctx);
1060
1061 return ret;
1062}
1063LCRYPTO_ALIAS(EC_POINT_set_compressed_coordinates);
1064
1065int
1066EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
1067 const BIGNUM *x, int y_bit, BN_CTX *ctx)
1068{
1069 return EC_POINT_set_compressed_coordinates(group, point, x, y_bit, ctx);
1070}
1071LCRYPTO_ALIAS(EC_POINT_set_compressed_coordinates_GFp);
1072
1073int
1035EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, 1074EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
1036 const EC_POINT *b, BN_CTX *ctx_in) 1075 const EC_POINT *b, BN_CTX *ctx_in)
1037{ 1076{