summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c66
1 files changed, 5 insertions, 61 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index de6fe20083..f1ff11a087 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.107 2025/01/11 13:41:17 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.108 2025/01/11 13:58:31 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 */
@@ -1265,32 +1265,8 @@ int
1265EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], 1265EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[],
1266 BN_CTX *ctx_in) 1266 BN_CTX *ctx_in)
1267{ 1267{
1268 BN_CTX *ctx; 1268 ECerror(ERR_R_DISABLED);
1269 size_t i; 1269 return 0;
1270 int ret = 0;
1271
1272 if ((ctx = ctx_in) == NULL)
1273 ctx = BN_CTX_new();
1274 if (ctx == NULL)
1275 goto err;
1276
1277 if (group->meth->points_make_affine == NULL) {
1278 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
1279 goto err;
1280 }
1281 for (i = 0; i < num; i++) {
1282 if (group->meth != points[i]->meth) {
1283 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
1284 goto err;
1285 }
1286 }
1287 ret = group->meth->points_make_affine(group, num, points, ctx);
1288
1289 err:
1290 if (ctx != ctx_in)
1291 BN_CTX_free(ctx);
1292
1293 return ret;
1294} 1270}
1295LCRYPTO_ALIAS(EC_POINTs_make_affine); 1271LCRYPTO_ALIAS(EC_POINTs_make_affine);
1296 1272
@@ -1299,40 +1275,8 @@ EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
1299 size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 1275 size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
1300 BN_CTX *ctx_in) 1276 BN_CTX *ctx_in)
1301{ 1277{
1302 BN_CTX *ctx; 1278 ECerror(ERR_R_DISABLED);
1303 int ret = 0; 1279 return 0;
1304
1305 if ((ctx = ctx_in) == NULL)
1306 ctx = BN_CTX_new();
1307 if (ctx == NULL)
1308 goto err;
1309
1310 /* Only num == 0 and num == 1 is supported. */
1311 if (group->meth->mul_generator_ct == NULL ||
1312 group->meth->mul_single_ct == NULL ||
1313 group->meth->mul_double_nonct == NULL ||
1314 num > 1) {
1315 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
1316 goto err;
1317 }
1318
1319 if (num == 1 && points != NULL && scalars != NULL) {
1320 /* Either bP or aG + bP, this is sane. */
1321 ret = EC_POINT_mul(group, r, scalar, points[0], scalars[0], ctx);
1322 } else if (scalar != NULL && points == NULL && scalars == NULL) {
1323 /* aG, this is sane */
1324 ret = EC_POINT_mul(group, r, scalar, NULL, NULL, ctx);
1325 } else {
1326 /* anything else is an error */
1327 ECerror(ERR_R_EC_LIB);
1328 goto err;
1329 }
1330
1331 err:
1332 if (ctx != ctx_in)
1333 BN_CTX_free(ctx);
1334
1335 return ret;
1336} 1280}
1337LCRYPTO_ALIAS(EC_POINTs_mul); 1281LCRYPTO_ALIAS(EC_POINTs_mul);
1338 1282