summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa.h11
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c2
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c8
3 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index e26a68b482..62fa745f79 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -158,11 +158,6 @@ struct rsa_st
158#define RSA_FLAG_CACHE_PUBLIC 0x02 158#define RSA_FLAG_CACHE_PUBLIC 0x02
159#define RSA_FLAG_CACHE_PRIVATE 0x04 159#define RSA_FLAG_CACHE_PRIVATE 0x04
160#define RSA_FLAG_BLINDING 0x08 160#define RSA_FLAG_BLINDING 0x08
161#define RSA_FLAG_NO_BLINDING 0x80 /* new with 0.9.6j and 0.9.7b; the built-in
162 * RSA implementation now uses blinding by
163 * default (ignoring RSA_FLAG_BLINDING),
164 * but other engines might not need it
165 */
166#define RSA_FLAG_THREAD_SAFE 0x10 161#define RSA_FLAG_THREAD_SAFE 0x10
167/* This flag means the private key operations will be handled by rsa_mod_exp 162/* This flag means the private key operations will be handled by rsa_mod_exp
168 * and that they do not depend on the private key components being present: 163 * and that they do not depend on the private key components being present:
@@ -175,7 +170,11 @@ struct rsa_st
175 */ 170 */
176#define RSA_FLAG_SIGN_VER 0x40 171#define RSA_FLAG_SIGN_VER 0x40
177 172
178#define RSA_FLAG_NO_BLINDING 0x80 173#define RSA_FLAG_NO_BLINDING 0x80 /* new with 0.9.6j and 0.9.7b; the built-in
174 * RSA implementation now uses blinding by
175 * default (ignoring RSA_FLAG_BLINDING),
176 * but other engines might not need it
177 */
179 178
180#define RSA_PKCS1_PADDING 1 179#define RSA_PKCS1_PADDING 1
181#define RSA_SSLV23_PADDING 2 180#define RSA_SSLV23_PADDING 2
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index 027b4dc754..e0d286266e 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -484,6 +484,8 @@ err:
484 if (ctx != NULL) BN_CTX_free(ctx); 484 if (ctx != NULL) BN_CTX_free(ctx);
485 BN_clear_free(&f); 485 BN_clear_free(&f);
486 BN_clear_free(&ret); 486 BN_clear_free(&ret);
487 if (local_blinding)
488 BN_BLINDING_free(blinding);
487 if (buf != NULL) 489 if (buf != NULL)
488 { 490 {
489 OPENSSL_cleanse(buf,num); 491 OPENSSL_cleanse(buf,num);
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);