summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ecp_methods.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_methods.c')
-rw-r--r--src/lib/libcrypto/ec/ecp_methods.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c
index 44322f27f2..042db054a8 100644
--- a/src/lib/libcrypto/ec/ecp_methods.c
+++ b/src/lib/libcrypto/ec/ecp_methods.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_methods.c,v 1.22 2025/01/06 12:36:41 jsing Exp $ */ 1/* $OpenBSD: ecp_methods.c,v 1.23 2025/01/06 14:22:55 tb Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. 3 * for the OpenSSL project.
4 * Includes code written by Bodo Moeller for the OpenSSL project. 4 * Includes code written by Bodo Moeller for the OpenSSL project.
@@ -85,21 +85,6 @@
85 */ 85 */
86 86
87static int 87static int
88ec_group_copy(EC_GROUP *dest, const EC_GROUP *src)
89{
90 if (!bn_copy(dest->p, src->p))
91 return 0;
92 if (!bn_copy(dest->a, src->a))
93 return 0;
94 if (!bn_copy(dest->b, src->b))
95 return 0;
96
97 dest->a_is_minus3 = src->a_is_minus3;
98
99 return 1;
100}
101
102static int
103ec_decode_scalar(const EC_GROUP *group, BIGNUM *bn, const BIGNUM *x, BN_CTX *ctx) 88ec_decode_scalar(const EC_GROUP *group, BIGNUM *bn, const BIGNUM *x, BN_CTX *ctx)
104{ 89{
105 if (bn == NULL) 90 if (bn == NULL)
@@ -1459,32 +1444,6 @@ ec_mont_group_clear(EC_GROUP *group)
1459} 1444}
1460 1445
1461static int 1446static int
1462ec_mont_group_copy(EC_GROUP *dest, const EC_GROUP *src)
1463{
1464 ec_mont_group_clear(dest);
1465
1466 if (!ec_group_copy(dest, src))
1467 return 0;
1468
1469 if (src->mont_ctx != NULL) {
1470 dest->mont_ctx = BN_MONT_CTX_new();
1471 if (dest->mont_ctx == NULL)
1472 return 0;
1473 if (!BN_MONT_CTX_copy(dest->mont_ctx, src->mont_ctx))
1474 goto err;
1475 }
1476
1477 return 1;
1478
1479 err:
1480 if (dest->mont_ctx != NULL) {
1481 BN_MONT_CTX_free(dest->mont_ctx);
1482 dest->mont_ctx = NULL;
1483 }
1484 return 0;
1485}
1486
1487static int
1488ec_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, 1447ec_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,
1489 const BIGNUM *b, BN_CTX *ctx) 1448 const BIGNUM *b, BN_CTX *ctx)
1490{ 1449{
@@ -1559,7 +1518,6 @@ ec_mont_field_decode(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a,
1559 1518
1560static const EC_METHOD ec_GFp_simple_method = { 1519static const EC_METHOD ec_GFp_simple_method = {
1561 .field_type = NID_X9_62_prime_field, 1520 .field_type = NID_X9_62_prime_field,
1562 .group_copy = ec_group_copy,
1563 .group_set_curve = ec_group_set_curve, 1521 .group_set_curve = ec_group_set_curve,
1564 .group_get_curve = ec_group_get_curve, 1522 .group_get_curve = ec_group_get_curve,
1565 .group_get_degree = ec_group_get_degree, 1523 .group_get_degree = ec_group_get_degree,
@@ -1591,7 +1549,6 @@ LCRYPTO_ALIAS(EC_GFp_simple_method);
1591 1549
1592static const EC_METHOD ec_GFp_mont_method = { 1550static const EC_METHOD ec_GFp_mont_method = {
1593 .field_type = NID_X9_62_prime_field, 1551 .field_type = NID_X9_62_prime_field,
1594 .group_copy = ec_mont_group_copy,
1595 .group_set_curve = ec_mont_group_set_curve, 1552 .group_set_curve = ec_mont_group_set_curve,
1596 .group_get_curve = ec_group_get_curve, 1553 .group_get_curve = ec_group_get_curve,
1597 .group_get_degree = ec_group_get_degree, 1554 .group_get_degree = ec_group_get_degree,