summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-08-09 09:25:13 +0000
committertb <>2023-08-09 09:25:13 +0000
commit740758f21136fde8a6854e0cf1924236fcabd70b (patch)
tree620b78e8747bacdea94cac462a45229ffb4e1ba5
parentfb26e3d813e4ccd04c6d557d46d14abf011c4641 (diff)
downloadopenbsd-740758f21136fde8a6854e0cf1924236fcabd70b.tar.gz
openbsd-740758f21136fde8a6854e0cf1924236fcabd70b.tar.bz2
openbsd-740758f21136fde8a6854e0cf1924236fcabd70b.zip
Move RSA_blinding_{on,off}() to the bottom of the file
-rw-r--r--src/lib/libcrypto/rsa/rsa_crpt.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_crpt.c b/src/lib/libcrypto/rsa/rsa_crpt.c
index 4739b76240..fcf29f121e 100644
--- a/src/lib/libcrypto/rsa/rsa_crpt.c
+++ b/src/lib/libcrypto/rsa/rsa_crpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_crpt.c,v 1.26 2023/08/09 09:09:24 tb Exp $ */ 1/* $OpenBSD: rsa_crpt.c,v 1.27 2023/08/09 09:25:13 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 *
@@ -126,34 +126,6 @@ RSA_flags(const RSA *r)
126} 126}
127LCRYPTO_ALIAS(RSA_flags); 127LCRYPTO_ALIAS(RSA_flags);
128 128
129void
130RSA_blinding_off(RSA *rsa)
131{
132 BN_BLINDING_free(rsa->blinding);
133 rsa->blinding = NULL;
134 rsa->flags |= RSA_FLAG_NO_BLINDING;
135}
136LCRYPTO_ALIAS(RSA_blinding_off);
137
138int
139RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
140{
141 int ret = 0;
142
143 if (rsa->blinding != NULL)
144 RSA_blinding_off(rsa);
145
146 rsa->blinding = RSA_setup_blinding(rsa, ctx);
147 if (rsa->blinding == NULL)
148 goto err;
149
150 rsa->flags &= ~RSA_FLAG_NO_BLINDING;
151 ret = 1;
152err:
153 return (ret);
154}
155LCRYPTO_ALIAS(RSA_blinding_on);
156
157static BIGNUM * 129static BIGNUM *
158rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, const BIGNUM *q, 130rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, const BIGNUM *q,
159 BN_CTX *ctx) 131 BN_CTX *ctx)
@@ -225,3 +197,31 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
225 197
226 return ret; 198 return ret;
227} 199}
200
201void
202RSA_blinding_off(RSA *rsa)
203{
204 BN_BLINDING_free(rsa->blinding);
205 rsa->blinding = NULL;
206 rsa->flags |= RSA_FLAG_NO_BLINDING;
207}
208LCRYPTO_ALIAS(RSA_blinding_off);
209
210int
211RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
212{
213 int ret = 0;
214
215 if (rsa->blinding != NULL)
216 RSA_blinding_off(rsa);
217
218 rsa->blinding = RSA_setup_blinding(rsa, ctx);
219 if (rsa->blinding == NULL)
220 goto err;
221
222 rsa->flags &= ~RSA_FLAG_NO_BLINDING;
223 ret = 1;
224err:
225 return (ret);
226}
227LCRYPTO_ALIAS(RSA_blinding_on);