diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec2_mult.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec2_mult.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/libcrypto/ec/ec2_mult.c b/src/lib/libcrypto/ec/ec2_mult.c index d32b7442c4..d7cbd933f2 100644 --- a/src/lib/libcrypto/ec/ec2_mult.c +++ b/src/lib/libcrypto/ec/ec2_mult.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_mult.c,v 1.16 2023/03/27 10:25:02 tb Exp $ */ | 1 | /* $OpenBSD: ec2_mult.c,v 1.17 2023/04/11 18:58:20 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -375,17 +375,11 @@ int | |||
375 | ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | 375 | ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, |
376 | size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx) | 376 | size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx) |
377 | { | 377 | { |
378 | BN_CTX *new_ctx = NULL; | ||
379 | int ret = 0; | ||
380 | size_t i; | ||
381 | EC_POINT *p = NULL; | 378 | EC_POINT *p = NULL; |
382 | EC_POINT *acc = NULL; | 379 | EC_POINT *acc = NULL; |
380 | size_t i; | ||
381 | int ret = 0; | ||
383 | 382 | ||
384 | if (ctx == NULL) { | ||
385 | ctx = new_ctx = BN_CTX_new(); | ||
386 | if (ctx == NULL) | ||
387 | return 0; | ||
388 | } | ||
389 | /* | 383 | /* |
390 | * This implementation is more efficient than the wNAF implementation | 384 | * This implementation is more efficient than the wNAF implementation |
391 | * for 2 or fewer points. Use the ec_wNAF_mul implementation for 3 | 385 | * for 2 or fewer points. Use the ec_wNAF_mul implementation for 3 |
@@ -432,7 +426,7 @@ ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
432 | err: | 426 | err: |
433 | EC_POINT_free(p); | 427 | EC_POINT_free(p); |
434 | EC_POINT_free(acc); | 428 | EC_POINT_free(acc); |
435 | BN_CTX_free(new_ctx); | 429 | |
436 | return ret; | 430 | return ret; |
437 | } | 431 | } |
438 | 432 | ||