Lines Matching defs:ctx
134 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
138 BN_BLINDING_new(const BIGNUM *e, const BIGNUM *mod, BN_CTX *ctx,
140 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx)
190 BN_BLINDING_setup(BN_BLINDING *b, BN_CTX *ctx)
194 if (BN_mod_inverse_ct(b->Ai, b->A, b->mod, ctx) == NULL)
198 if (!b->bn_mod_exp(b->A, b->A, b->e, b->mod, ctx, b->m_ctx))
201 if (!BN_mod_exp_ct(b->A, b->A, b->e, b->mod, ctx))
209 BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
214 if (!BN_BLINDING_setup(b, ctx))
218 if (!BN_mod_sqr(b->A, b->A, b->mod, ctx))
220 if (!BN_mod_sqr(b->Ai, b->Ai, b->mod, ctx))
231 BN_BLINDING_convert(BIGNUM *n, BIGNUM *inv, BN_BLINDING *b, BN_CTX *ctx)
235 if (!BN_BLINDING_update(b, ctx))
243 ret = BN_mod_mul(n, n, b->A, b->mod, ctx);
250 BN_BLINDING_invert(BIGNUM *n, const BIGNUM *inv, BN_BLINDING *b, BN_CTX *ctx)
255 return BN_mod_mul(n, n, inv, b->mod, ctx);
266 BN_CTX *ctx)
273 BN_CTX_start(ctx);
274 if ((r0 = BN_CTX_get(ctx)) == NULL)
276 if ((r1 = BN_CTX_get(ctx)) == NULL)
278 if ((r2 = BN_CTX_get(ctx)) == NULL)
285 if (!BN_mul(r0, r1, r2, ctx))
288 ret = BN_mod_inverse_ct(NULL, d, r0, ctx);
290 BN_CTX_end(ctx);
299 BN_CTX *ctx = NULL;
302 if ((ctx = in_ctx) == NULL)
303 ctx = BN_CTX_new();
304 if (ctx == NULL)
307 BN_CTX_start(ctx);
310 e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
319 if ((ret = BN_BLINDING_new(e, &n, ctx, rsa->meth->bn_mod_exp,
326 BN_CTX_end(ctx);
327 if (ctx != in_ctx)
328 BN_CTX_free(ctx);
345 RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
352 rsa->blinding = RSA_setup_blinding(rsa, ctx);