summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_lib.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c
index 53c5092014..e4d622851e 100644
--- a/src/lib/libcrypto/rsa/rsa_lib.c
+++ b/src/lib/libcrypto/rsa/rsa_lib.c
@@ -316,7 +316,7 @@ void RSA_blinding_off(RSA *rsa)
316 316
317int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx) 317int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
318 { 318 {
319 BIGNUM *A,*Ai; 319 BIGNUM *A,*Ai = NULL;
320 BN_CTX *ctx; 320 BN_CTX *ctx;
321 int ret=0; 321 int ret=0;
322 322
@@ -327,8 +327,12 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
327 else 327 else
328 ctx=p_ctx; 328 ctx=p_ctx;
329 329
330 /* XXXXX: Shouldn't this be RSA_blinding_off(rsa)? */
330 if (rsa->blinding != NULL) 331 if (rsa->blinding != NULL)
332 {
331 BN_BLINDING_free(rsa->blinding); 333 BN_BLINDING_free(rsa->blinding);
334 rsa->blinding = NULL;
335 }
332 336
333 /* NB: similar code appears in setup_blinding (rsa_eay.c); 337 /* NB: similar code appears in setup_blinding (rsa_eay.c);
334 * this should be placed in a new function of its own, but for reasons 338 * this should be placed in a new function of its own, but for reasons
@@ -356,9 +360,9 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
356 rsa->blinding->thread_id = CRYPTO_thread_id(); 360 rsa->blinding->thread_id = CRYPTO_thread_id();
357 rsa->flags |= RSA_FLAG_BLINDING; 361 rsa->flags |= RSA_FLAG_BLINDING;
358 rsa->flags &= ~RSA_FLAG_NO_BLINDING; 362 rsa->flags &= ~RSA_FLAG_NO_BLINDING;
359 BN_free(Ai);
360 ret=1; 363 ret=1;
361err: 364err:
365 if (Ai != NULL) BN_free(Ai);
362 BN_CTX_end(ctx); 366 BN_CTX_end(ctx);
363 if (ctx != p_ctx) BN_CTX_free(ctx); 367 if (ctx != p_ctx) BN_CTX_free(ctx);
364 return(ret); 368 return(ret);