diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_eay.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 089b8782d5..b307a8bd88 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_eay.c,v 1.57 2023/04/05 11:30:12 tb Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.58 2023/04/05 11:31:38 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 | * |
@@ -226,10 +226,11 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
226 | goto err; | 226 | goto err; |
227 | } | 227 | } |
228 | 228 | ||
229 | if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) | 229 | if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) { |
230 | if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, | 230 | if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, |
231 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 231 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
232 | goto err; | 232 | goto err; |
233 | } | ||
233 | 234 | ||
234 | if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, | 235 | if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, |
235 | rsa->_method_mod_n)) | 236 | rsa->_method_mod_n)) |
@@ -656,10 +657,11 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
656 | goto err; | 657 | goto err; |
657 | } | 658 | } |
658 | 659 | ||
659 | if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) | 660 | if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) { |
660 | if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, | 661 | if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, |
661 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 662 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
662 | goto err; | 663 | goto err; |
664 | } | ||
663 | 665 | ||
664 | if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, | 666 | if (!rsa->meth->bn_mod_exp(ret, f, rsa->e, rsa->n, ctx, |
665 | rsa->_method_mod_n)) | 667 | rsa->_method_mod_n)) |
@@ -736,10 +738,11 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
736 | } | 738 | } |
737 | } | 739 | } |
738 | 740 | ||
739 | if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) | 741 | if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) { |
740 | if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, | 742 | if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, |
741 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 743 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
742 | goto err; | 744 | goto err; |
745 | } | ||
743 | 746 | ||
744 | /* compute I mod q */ | 747 | /* compute I mod q */ |
745 | BN_init(&c); | 748 | BN_init(&c); |