diff options
author | tb <> | 2025-01-06 18:43:27 +0000 |
---|---|---|
committer | tb <> | 2025-01-06 18:43:27 +0000 |
commit | 71a205f7722db3374e3f8c6bec356373081f5961 (patch) | |
tree | 291061547b85e68d4f706e0a91841e1be1857574 | |
parent | 78183ca54d855ead05b8fd18a997bc865042039f (diff) | |
download | openbsd-71a205f7722db3374e3f8c6bec356373081f5961.tar.gz openbsd-71a205f7722db3374e3f8c6bec356373081f5961.tar.bz2 openbsd-71a205f7722db3374e3f8c6bec356373081f5961.zip |
Inline the last two uses of ec_mont_group_clear()
-rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index d68022f5e6..8623131ffa 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.24 2025/01/06 14:29:33 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.25 2025/01/06 18:43:27 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. |
@@ -1430,13 +1430,6 @@ ec_mul_double_nonct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, | |||
1430 | return ec_wnaf_mul(group, r, g_scalar, point, p_scalar, ctx); | 1430 | return ec_wnaf_mul(group, r, g_scalar, point, p_scalar, ctx); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | static void | ||
1434 | ec_mont_group_clear(EC_GROUP *group) | ||
1435 | { | ||
1436 | BN_MONT_CTX_free(group->mont_ctx); | ||
1437 | group->mont_ctx = NULL; | ||
1438 | } | ||
1439 | |||
1440 | static int | 1433 | static int |
1441 | ec_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | 1434 | ec_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, |
1442 | const BIGNUM *b, BN_CTX *ctx) | 1435 | const BIGNUM *b, BN_CTX *ctx) |
@@ -1444,10 +1437,10 @@ ec_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | |||
1444 | BN_MONT_CTX *mont = NULL; | 1437 | BN_MONT_CTX *mont = NULL; |
1445 | int ret = 0; | 1438 | int ret = 0; |
1446 | 1439 | ||
1447 | ec_mont_group_clear(group); | 1440 | BN_MONT_CTX_free(group->mont_ctx); |
1441 | group->mont_ctx = NULL; | ||
1448 | 1442 | ||
1449 | mont = BN_MONT_CTX_new(); | 1443 | if ((mont = BN_MONT_CTX_new()) == NULL) |
1450 | if (mont == NULL) | ||
1451 | goto err; | 1444 | goto err; |
1452 | if (!BN_MONT_CTX_set(mont, p, ctx)) { | 1445 | if (!BN_MONT_CTX_set(mont, p, ctx)) { |
1453 | ECerror(ERR_R_BN_LIB); | 1446 | ECerror(ERR_R_BN_LIB); |
@@ -1456,9 +1449,13 @@ ec_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, | |||
1456 | group->mont_ctx = mont; | 1449 | group->mont_ctx = mont; |
1457 | mont = NULL; | 1450 | mont = NULL; |
1458 | 1451 | ||
1459 | ret = ec_group_set_curve(group, p, a, b, ctx); | 1452 | if (!ec_group_set_curve(group, p, a, b, ctx)) { |
1460 | if (!ret) | 1453 | BN_MONT_CTX_free(group->mont_ctx); |
1461 | ec_mont_group_clear(group); | 1454 | group->mont_ctx = NULL; |
1455 | goto err; | ||
1456 | } | ||
1457 | |||
1458 | ret = 1; | ||
1462 | 1459 | ||
1463 | err: | 1460 | err: |
1464 | BN_MONT_CTX_free(mont); | 1461 | BN_MONT_CTX_free(mont); |