Skip to content

Commit 740758f

Browse files
author
tb
committed
Move RSA_blinding_{on,off}() to the bottom of the file
1 parent fb26e3d commit 740758f

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/lib/libcrypto/rsa/rsa_crpt.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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 $ */
22
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
33
* All rights reserved.
44
*
@@ -126,34 +126,6 @@ RSA_flags(const RSA *r)
126126
}
127127
LCRYPTO_ALIAS(RSA_flags);
128128

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-
157129
static BIGNUM *
158130
rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, const BIGNUM *q,
159131
BN_CTX *ctx)
@@ -225,3 +197,31 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
225197

226198
return ret;
227199
}
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);

0 commit comments

Comments
 (0)