aboutsummaryrefslogtreecommitdiff
path: root/crypto/bn/bn_blind.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/bn/bn_blind.c
parenteb77ebe26c5228a9a9688b33901e79968789b980 (diff)
downloadopenssl-f7ccba3edf9f1f02d7bd3b019d7bc96f25a95718.zip
openssl-f7ccba3edf9f1f02d7bd3b019d7bc96f25a95718.tar.gz
openssl-f7ccba3edf9f1f02d7bd3b019d7bc96f25a95718.tar.bz2
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/bn/bn_blind.c')
-rw-r--r--crypto/bn/bn_blind.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c
index e9b6173..fa48470 100644
--- a/crypto/bn/bn_blind.c
+++ b/crypto/bn/bn_blind.c
@@ -121,10 +121,13 @@ struct bn_blinding_st
BIGNUM *Ai;
BIGNUM *e;
BIGNUM *mod; /* just a reference */
+/* FIXME: should really try to remove these, but the deprecated APIs that are
+ * using them would need to be fudged somehow. */
+#ifndef OPENSSL_NO_DEPRECATED
unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
* used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
- void *thread_idptr; /* added in OpenSSL 0.9.9;
- * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
+#endif
+ CRYPTO_THREADID tid;
unsigned int counter;
unsigned long flags;
BN_MONT_CTX *m_ctx;
@@ -265,6 +268,7 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct
return(ret);
}
+#ifndef OPENSSL_NO_DEPRECATED
unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b)
{
return b->thread_id;
@@ -274,15 +278,16 @@ void BN_BLINDING_set_thread_id(BN_BLINDING *b, unsigned long n)
{
b->thread_id = n;
}
+#endif
-void *BN_BLINDING_get_thread_idptr(const BN_BLINDING *b)
+void BN_BLINDING_set_thread(BN_BLINDING *b)
{
- return b->thread_idptr;
+ CRYPTO_THREADID_set(&b->tid);
}
-void BN_BLINDING_set_thread_idptr(BN_BLINDING *b, void *p)
+int BN_BLINDING_cmp_thread(const BN_BLINDING *b, const CRYPTO_THREADID *tid)
{
- b->thread_idptr = p;
+ return CRYPTO_THREADID_cmp(&b->tid, tid);
}
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b)