diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_blinding.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_blinding.c b/src/lib/libcrypto/rsa/rsa_blinding.c index e6fd67242d..cac5bd91d2 100644 --- a/src/lib/libcrypto/rsa/rsa_blinding.c +++ b/src/lib/libcrypto/rsa/rsa_blinding.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_blinding.c,v 1.2 2023/08/09 09:26:43 tb Exp $ */ | 1 | /* $OpenBSD: rsa_blinding.c,v 1.3 2023/08/09 12:09:06 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -109,6 +109,7 @@ | |||
109 | * [including the GNU Public Licence.] | 109 | * [including the GNU Public Licence.] |
110 | */ | 110 | */ |
111 | 111 | ||
112 | #include <pthread.h> | ||
112 | #include <stdio.h> | 113 | #include <stdio.h> |
113 | 114 | ||
114 | #include <openssl/opensslconf.h> | 115 | #include <openssl/opensslconf.h> |
@@ -126,7 +127,7 @@ struct bn_blinding_st { | |||
126 | BIGNUM *Ai; | 127 | BIGNUM *Ai; |
127 | BIGNUM *e; | 128 | BIGNUM *e; |
128 | BIGNUM *mod; | 129 | BIGNUM *mod; |
129 | CRYPTO_THREADID tid; | 130 | pthread_t tid; |
130 | int counter; | 131 | int counter; |
131 | BN_MONT_CTX *m_ctx; | 132 | BN_MONT_CTX *m_ctx; |
132 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 133 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
@@ -157,7 +158,7 @@ BN_BLINDING_new(const BIGNUM *e, const BIGNUM *mod, BN_CTX *ctx, | |||
157 | 158 | ||
158 | /* Update on first use. */ | 159 | /* Update on first use. */ |
159 | ret->counter = BN_BLINDING_COUNTER - 1; | 160 | ret->counter = BN_BLINDING_COUNTER - 1; |
160 | CRYPTO_THREADID_current(&ret->tid); | 161 | ret->tid = pthread_self(); |
161 | 162 | ||
162 | if (bn_mod_exp != NULL) | 163 | if (bn_mod_exp != NULL) |
163 | ret->bn_mod_exp = bn_mod_exp; | 164 | ret->bn_mod_exp = bn_mod_exp; |
@@ -254,10 +255,10 @@ BN_BLINDING_invert(BIGNUM *n, const BIGNUM *inv, BN_BLINDING *b, BN_CTX *ctx) | |||
254 | return BN_mod_mul(n, n, inv, b->mod, ctx); | 255 | return BN_mod_mul(n, n, inv, b->mod, ctx); |
255 | } | 256 | } |
256 | 257 | ||
257 | CRYPTO_THREADID * | 258 | int |
258 | BN_BLINDING_thread_id(BN_BLINDING *b) | 259 | BN_BLINDING_is_local(BN_BLINDING *b) |
259 | { | 260 | { |
260 | return &b->tid; | 261 | return pthread_equal(pthread_self(), b->tid) != 0; |
261 | } | 262 | } |
262 | 263 | ||
263 | static BIGNUM * | 264 | static BIGNUM * |
@@ -320,7 +321,6 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) | |||
320 | RSAerror(ERR_R_BN_LIB); | 321 | RSAerror(ERR_R_BN_LIB); |
321 | goto err; | 322 | goto err; |
322 | } | 323 | } |
323 | CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret)); | ||
324 | 324 | ||
325 | err: | 325 | err: |
326 | BN_CTX_end(ctx); | 326 | BN_CTX_end(ctx); |