diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_local.h | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mont.c | 20 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h index 4b42ae95ee..067ffab3d9 100644 --- a/src/lib/libcrypto/bn/bn_local.h +++ b/src/lib/libcrypto/bn/bn_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_local.h,v 1.49 2025/02/12 21:21:34 tb Exp $ */ | 1 | /* $OpenBSD: bn_local.h,v 1.50 2025/02/13 11:04:20 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -271,6 +271,8 @@ int bn_rand_interval(BIGNUM *rnd, BN_ULONG lower_word, const BIGNUM *upper_exc); | |||
| 271 | 271 | ||
| 272 | void BN_init(BIGNUM *); | 272 | void BN_init(BIGNUM *); |
| 273 | 273 | ||
| 274 | BN_MONT_CTX *BN_MONT_CTX_create(const BIGNUM *bn, BN_CTX *ctx); | ||
| 275 | |||
| 274 | BN_RECP_CTX *BN_RECP_CTX_create(const BIGNUM *N); | 276 | BN_RECP_CTX *BN_RECP_CTX_create(const BIGNUM *N); |
| 275 | void BN_RECP_CTX_free(BN_RECP_CTX *recp); | 277 | void BN_RECP_CTX_free(BN_RECP_CTX *recp); |
| 276 | int BN_div_reciprocal(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, | 278 | int BN_div_reciprocal(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index c7e2eefb58..cfdc7e510f 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mont.c,v 1.63 2024/03/26 04:23:04 jsing Exp $ */ | 1 | /* $OpenBSD: bn_mont.c,v 1.64 2025/02/13 11:04:20 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -154,6 +154,24 @@ BN_MONT_CTX_free(BN_MONT_CTX *mctx) | |||
| 154 | LCRYPTO_ALIAS(BN_MONT_CTX_free); | 154 | LCRYPTO_ALIAS(BN_MONT_CTX_free); |
| 155 | 155 | ||
| 156 | BN_MONT_CTX * | 156 | BN_MONT_CTX * |
| 157 | BN_MONT_CTX_create(const BIGNUM *bn, BN_CTX *bn_ctx) | ||
| 158 | { | ||
| 159 | BN_MONT_CTX *mctx; | ||
| 160 | |||
| 161 | if ((mctx = BN_MONT_CTX_new()) == NULL) | ||
| 162 | goto err; | ||
| 163 | if (!BN_MONT_CTX_set(mctx, bn, bn_ctx)) | ||
| 164 | goto err; | ||
| 165 | |||
| 166 | return mctx; | ||
| 167 | |||
| 168 | err: | ||
| 169 | BN_MONT_CTX_free(mctx); | ||
| 170 | |||
| 171 | return NULL; | ||
| 172 | } | ||
| 173 | |||
| 174 | BN_MONT_CTX * | ||
| 157 | BN_MONT_CTX_copy(BN_MONT_CTX *dst, BN_MONT_CTX *src) | 175 | BN_MONT_CTX_copy(BN_MONT_CTX *dst, BN_MONT_CTX *src) |
| 158 | { | 176 | { |
| 159 | if (dst == src) | 177 | if (dst == src) |
