diff options
author | tb <> | 2023-08-09 09:25:13 +0000 |
---|---|---|
committer | tb <> | 2023-08-09 09:25:13 +0000 |
commit | 740758f21136fde8a6854e0cf1924236fcabd70b (patch) | |
tree | 620b78e8747bacdea94cac462a45229ffb4e1ba5 | |
parent | fb26e3d813e4ccd04c6d557d46d14abf011c4641 (diff) | |
download | openbsd-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.c | 58 |
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 | } |
127 | LCRYPTO_ALIAS(RSA_flags); | 127 | LCRYPTO_ALIAS(RSA_flags); |
128 | 128 | ||
129 | void | ||
130 | RSA_blinding_off(RSA *rsa) | ||
131 | { | ||
132 | BN_BLINDING_free(rsa->blinding); | ||
133 | rsa->blinding = NULL; | ||
134 | rsa->flags |= RSA_FLAG_NO_BLINDING; | ||
135 | } | ||
136 | LCRYPTO_ALIAS(RSA_blinding_off); | ||
137 | |||
138 | int | ||
139 | RSA_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; | ||
152 | err: | ||
153 | return (ret); | ||
154 | } | ||
155 | LCRYPTO_ALIAS(RSA_blinding_on); | ||
156 | |||
157 | static BIGNUM * | 129 | static BIGNUM * |
158 | rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, const BIGNUM *q, | 130 | rsa_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 | |||
201 | void | ||
202 | RSA_blinding_off(RSA *rsa) | ||
203 | { | ||
204 | BN_BLINDING_free(rsa->blinding); | ||
205 | rsa->blinding = NULL; | ||
206 | rsa->flags |= RSA_FLAG_NO_BLINDING; | ||
207 | } | ||
208 | LCRYPTO_ALIAS(RSA_blinding_off); | ||
209 | |||
210 | int | ||
211 | RSA_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; | ||
224 | err: | ||
225 | return (ret); | ||
226 | } | ||
227 | LCRYPTO_ALIAS(RSA_blinding_on); | ||