aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_eay.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2008-03-28 02:49:43 +0000
committerGeoff Thorpe <geoff@openssl.org>2008-03-28 02:49:43 +0000
commitf7ccba3edf9f1f02d7bd3b019d7bc96f25a95718 (patch)
tree734b39872b1b8c3cee1db78ed5eb7e3214d6a0a7 /crypto/rsa/rsa_eay.c
parenteb77ebe26c5228a9a9688b33901e79968789b980 (diff)
downloadopenssl-f7ccba3edf9f1f02d7bd3b019d7bc96f25a95718.tar.gz
There was a need to support thread ID types that couldn't be reliably cast
to 'unsigned long' (ie. odd platforms/compilers), so a pointer-typed version was added but it required portable code to check *both* modes to determine equality. This commit maintains the availability of both thread ID types, but deprecates the type-specific accessor APIs that invoke the callbacks - instead a single type-independent API is used. This simplifies software that calls into this interface, and should also make it less error-prone - as forgetting to call and compare *both* thread ID accessors could have led to hard-to-debug/infrequent bugs (that might only affect certain platforms or thread implementations). As the CHANGES note says, there were corresponding deprecations and replacements in the thread-related functions for BN_BLINDING and ERR too.
Diffstat (limited to 'crypto/rsa/rsa_eay.c')
-rw-r--r--crypto/rsa/rsa_eay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c
index a1ecd6d478..7f58a89891 100644
--- a/crypto/rsa/rsa_eay.c
+++ b/crypto/rsa/rsa_eay.c
@@ -263,8 +263,10 @@ err:
static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx)
{
BN_BLINDING *ret;
+ CRYPTO_THREADID tid;
int got_write_lock = 0;
+ CRYPTO_THREADID_set(&tid);
CRYPTO_r_lock(CRYPTO_LOCK_RSA);
if (rsa->blinding == NULL)
@@ -281,7 +283,7 @@ static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx)
if (ret == NULL)
goto err;
- if ((BN_BLINDING_get_thread_id(ret) == CRYPTO_thread_id()) && (BN_BLINDING_get_thread_idptr(ret) == CRYPTO_thread_idptr()))
+ if (!BN_BLINDING_cmp_thread(ret, &tid))
{
/* rsa->blinding is ours! */