diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_blind.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_blind.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c index c11fb4ccc2..e060592fdc 100644 --- a/src/lib/libcrypto/bn/bn_blind.c +++ b/src/lib/libcrypto/bn/bn_blind.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/bn/bn_blind.c */ | 1 | /* crypto/bn/bn_blind.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -121,8 +121,11 @@ struct bn_blinding_st | |||
121 | BIGNUM *Ai; | 121 | BIGNUM *Ai; |
122 | BIGNUM *e; | 122 | BIGNUM *e; |
123 | BIGNUM *mod; /* just a reference */ | 123 | BIGNUM *mod; /* just a reference */ |
124 | #ifndef OPENSSL_NO_DEPRECATED | ||
124 | unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b; | 125 | unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b; |
125 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ | 126 | * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */ |
127 | #endif | ||
128 | CRYPTO_THREADID tid; | ||
126 | unsigned int counter; | 129 | unsigned int counter; |
127 | unsigned long flags; | 130 | unsigned long flags; |
128 | BN_MONT_CTX *m_ctx; | 131 | BN_MONT_CTX *m_ctx; |
@@ -131,7 +134,7 @@ struct bn_blinding_st | |||
131 | BN_MONT_CTX *m_ctx); | 134 | BN_MONT_CTX *m_ctx); |
132 | }; | 135 | }; |
133 | 136 | ||
134 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod) | 137 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) |
135 | { | 138 | { |
136 | BN_BLINDING *ret=NULL; | 139 | BN_BLINDING *ret=NULL; |
137 | 140 | ||
@@ -158,6 +161,7 @@ BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGN | |||
158 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); | 161 | BN_set_flags(ret->mod, BN_FLG_CONSTTIME); |
159 | 162 | ||
160 | ret->counter = BN_BLINDING_COUNTER; | 163 | ret->counter = BN_BLINDING_COUNTER; |
164 | CRYPTO_THREADID_current(&ret->tid); | ||
161 | return(ret); | 165 | return(ret); |
162 | err: | 166 | err: |
163 | if (ret != NULL) BN_BLINDING_free(ret); | 167 | if (ret != NULL) BN_BLINDING_free(ret); |
@@ -263,6 +267,7 @@ int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ct | |||
263 | return(ret); | 267 | return(ret); |
264 | } | 268 | } |
265 | 269 | ||
270 | #ifndef OPENSSL_NO_DEPRECATED | ||
266 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b) | 271 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *b) |
267 | { | 272 | { |
268 | return b->thread_id; | 273 | return b->thread_id; |
@@ -272,6 +277,12 @@ void BN_BLINDING_set_thread_id(BN_BLINDING *b, unsigned long n) | |||
272 | { | 277 | { |
273 | b->thread_id = n; | 278 | b->thread_id = n; |
274 | } | 279 | } |
280 | #endif | ||
281 | |||
282 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *b) | ||
283 | { | ||
284 | return &b->tid; | ||
285 | } | ||
275 | 286 | ||
276 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) | 287 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) |
277 | { | 288 | { |
@@ -284,7 +295,7 @@ void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) | |||
284 | } | 295 | } |
285 | 296 | ||
286 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | 297 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, |
287 | const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx, | 298 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, |
288 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 299 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
289 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), | 300 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), |
290 | BN_MONT_CTX *m_ctx) | 301 | BN_MONT_CTX *m_ctx) |