diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2016-03-08 22:37:01 +0000 |
---|---|---|
committer | Alessandro Ghedini <alessandro@ghedini.me> | 2016-03-08 23:52:48 +0000 |
commit | 0b1a07c8a70486534526d8967f03e32806da5661 (patch) | |
tree | 973c6ac96312d6e14adfeaecfd053f7f1fd76a04 /crypto/rsa | |
parent | 16203f7b71bd343550f89f266eaf9fb9693f6148 (diff) |
Convert RSA blinding to new multi-threading API
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/rsa')
-rw-r--r-- | crypto/rsa/rsa_crpt.c | 4 | ||||
-rw-r--r-- | crypto/rsa/rsa_ossl.c | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/crypto/rsa/rsa_crpt.c b/crypto/rsa/rsa_crpt.c index 466eefc658..cec4a7c2bd 100644 --- a/crypto/rsa/rsa_crpt.c +++ b/crypto/rsa/rsa_crpt.c @@ -217,7 +217,9 @@ BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB); goto err; } - CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret)); + + BN_BLINDING_set_current_thread(ret); + err: BN_CTX_end(ctx); if (ctx != in_ctx) diff --git a/crypto/rsa/rsa_ossl.c b/crypto/rsa/rsa_ossl.c index 925cf65333..8d3383bfb0 100644 --- a/crypto/rsa/rsa_ossl.c +++ b/crypto/rsa/rsa_ossl.c @@ -248,7 +248,6 @@ static int rsa_ossl_public_encrypt(int flen, const unsigned char *from, static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) { BN_BLINDING *ret; - CRYPTO_THREADID cur; CRYPTO_THREAD_write_lock(rsa->lock); @@ -260,8 +259,7 @@ static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) if (ret == NULL) goto err; - CRYPTO_THREADID_current(&cur); - if (!CRYPTO_THREADID_cmp(&cur, BN_BLINDING_thread_id(ret))) { + if (BN_BLINDING_is_current_thread(ret)) { /* rsa->blinding is ours! */ *local = 1; @@ -299,9 +297,11 @@ static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, * Shared blinding: store the unblinding factor outside BN_BLINDING. */ int ret; - CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING); + + BN_BLINDING_lock(b); ret = BN_BLINDING_convert_ex(f, unblind, b, ctx); - CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING); + BN_BLINDING_unlock(b); + return ret; } } |