Lines Matching refs:b

91 int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)  in BN_BLINDING_update()  argument
95 if ((b->A == NULL) || (b->Ai == NULL)) { in BN_BLINDING_update()
100 if (b->counter == -1) in BN_BLINDING_update()
101 b->counter = 0; in BN_BLINDING_update()
103 if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL && in BN_BLINDING_update()
104 !(b->flags & BN_BLINDING_NO_RECREATE)) { in BN_BLINDING_update()
106 if (!BN_BLINDING_create_param(b, NULL, NULL, ctx, NULL, NULL)) in BN_BLINDING_update()
108 } else if (!(b->flags & BN_BLINDING_NO_UPDATE)) { in BN_BLINDING_update()
109 if (b->m_ctx != NULL) { in BN_BLINDING_update()
110 if (!bn_mul_mont_fixed_top(b->Ai, b->Ai, b->Ai, b->m_ctx, ctx) in BN_BLINDING_update()
111 || !bn_mul_mont_fixed_top(b->A, b->A, b->A, b->m_ctx, ctx)) in BN_BLINDING_update()
114 if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx) in BN_BLINDING_update()
115 || !BN_mod_mul(b->A, b->A, b->A, b->mod, ctx)) in BN_BLINDING_update()
122 if (b->counter == BN_BLINDING_COUNTER) in BN_BLINDING_update()
123 b->counter = 0; in BN_BLINDING_update()
127 int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) in BN_BLINDING_convert() argument
129 return BN_BLINDING_convert_ex(n, NULL, b, ctx); in BN_BLINDING_convert()
132 int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) in BN_BLINDING_convert_ex() argument
138 if ((b->A == NULL) || (b->Ai == NULL)) { in BN_BLINDING_convert_ex()
143 if (b->counter == -1) in BN_BLINDING_convert_ex()
145 b->counter = 0; in BN_BLINDING_convert_ex()
146 else if (!BN_BLINDING_update(b, ctx)) in BN_BLINDING_convert_ex()
149 if (r != NULL && (BN_copy(r, b->Ai) == NULL)) in BN_BLINDING_convert_ex()
152 if (b->m_ctx != NULL) in BN_BLINDING_convert_ex()
153 ret = BN_mod_mul_montgomery(n, n, b->A, b->m_ctx, ctx); in BN_BLINDING_convert_ex()
155 ret = BN_mod_mul(n, n, b->A, b->mod, ctx); in BN_BLINDING_convert_ex()
160 int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx) in BN_BLINDING_invert() argument
162 return BN_BLINDING_invert_ex(n, NULL, b, ctx); in BN_BLINDING_invert()
165 int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, in BN_BLINDING_invert_ex() argument
172 if (r == NULL && (r = b->Ai) == NULL) { in BN_BLINDING_invert_ex()
177 if (b->m_ctx != NULL) { in BN_BLINDING_invert_ex()
192 ret = bn_mul_mont_fixed_top(n, n, r, b->m_ctx, ctx); in BN_BLINDING_invert_ex()
195 ret = BN_mod_mul(n, n, r, b->mod, ctx); in BN_BLINDING_invert_ex()
202 int BN_BLINDING_is_current_thread(BN_BLINDING *b) in BN_BLINDING_is_current_thread() argument
204 return CRYPTO_THREAD_compare_id(CRYPTO_THREAD_get_current_id(), b->tid); in BN_BLINDING_is_current_thread()
207 void BN_BLINDING_set_current_thread(BN_BLINDING *b) in BN_BLINDING_set_current_thread() argument
209 b->tid = CRYPTO_THREAD_get_current_id(); in BN_BLINDING_set_current_thread()
212 int BN_BLINDING_lock(BN_BLINDING *b) in BN_BLINDING_lock() argument
214 return CRYPTO_THREAD_write_lock(b->lock); in BN_BLINDING_lock()
217 int BN_BLINDING_unlock(BN_BLINDING *b) in BN_BLINDING_unlock() argument
219 return CRYPTO_THREAD_unlock(b->lock); in BN_BLINDING_unlock()
222 unsigned long BN_BLINDING_get_flags(const BN_BLINDING *b) in BN_BLINDING_get_flags() argument
224 return b->flags; in BN_BLINDING_get_flags()
227 void BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags) in BN_BLINDING_set_flags() argument
229 b->flags = flags; in BN_BLINDING_set_flags()
232 BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, in BN_BLINDING_create_param() argument
245 if (b == NULL) in BN_BLINDING_create_param()
248 ret = b; in BN_BLINDING_create_param()
305 if (b == NULL) { in BN_BLINDING_create_param()