aboutsummaryrefslogtreecommitdiff
path: root/crypto/bn/bn_blind.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2008-08-06 15:54:15 +0000
committerGeoff Thorpe <geoff@openssl.org>2008-08-06 15:54:15 +0000
commit4c3296960de32e5abfbb8f4703a2ce624d82669f (patch)
treef603740bcbf0e3cde6008cead9586e5b4edbdc5b /crypto/bn/bn_blind.c
parent96826bfc84c63207b720543443626029946a0fc7 (diff)
downloadopenssl-4c3296960de32e5abfbb8f4703a2ce624d82669f.zip
openssl-4c3296960de32e5abfbb8f4703a2ce624d82669f.tar.gz
openssl-4c3296960de32e5abfbb8f4703a2ce624d82669f.tar.bz2
Remove the dual-callback scheme for numeric and pointer thread IDs,
deprecate the original (numeric-only) scheme, and replace with the CRYPTO_THREADID object. This hides the platform-specifics and should reduce the possibility for programming errors (where failing to explicitly check both thread ID forms could create subtle, platform-specific bugs). Thanks to Bodo, for invaluable review and feedback.
Diffstat (limited to 'crypto/bn/bn_blind.c')
-rw-r--r--crypto/bn/bn_blind.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c
index e9b6173..e060592 100644
--- a/crypto/bn/bn_blind.c
+++ b/crypto/bn/bn_blind.c
@@ -121,10 +121,11 @@ struct bn_blinding_st
BIGNUM *Ai;
BIGNUM *e;
BIGNUM *mod; /* just a reference */
+#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;
@@ -160,6 +161,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
BN_set_flags(ret->mod, BN_FLG_CONSTTIME);
ret->counter = BN_BLINDING_COUNTER;
+ CRYPTO_THREADID_current(&ret->tid);
return(ret);
err:
if (ret != NULL) BN_BLINDING_free(ret);
@@ -265,6 +267,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 +277,11 @@ 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)
+CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *b)
{
- return b->thread_idptr;
- }
-
-void BN_BLINDING_set_thread_idptr(BN_BLINDING *b, void *p)
- {
- b->thread_idptr = p;
+ return &b->tid;
}
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b)