• Home
  • Raw
  • Download

Lines Matching refs:recp

183 static void BN_RECP_CTX_init(BN_RECP_CTX *recp) {  in BN_RECP_CTX_init()  argument
184 BN_init(&recp->N); in BN_RECP_CTX_init()
185 BN_init(&recp->Nr); in BN_RECP_CTX_init()
186 recp->num_bits = 0; in BN_RECP_CTX_init()
187 recp->shift = 0; in BN_RECP_CTX_init()
188 recp->flags = 0; in BN_RECP_CTX_init()
191 static void BN_RECP_CTX_free(BN_RECP_CTX *recp) { in BN_RECP_CTX_free() argument
192 if (recp == NULL) { in BN_RECP_CTX_free()
196 BN_free(&recp->N); in BN_RECP_CTX_free()
197 BN_free(&recp->Nr); in BN_RECP_CTX_free()
200 static int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) { in BN_RECP_CTX_set() argument
201 if (!BN_copy(&(recp->N), d)) { in BN_RECP_CTX_set()
204 BN_zero(&recp->Nr); in BN_RECP_CTX_set()
205 recp->num_bits = BN_num_bits(d); in BN_RECP_CTX_set()
206 recp->shift = 0; in BN_RECP_CTX_set()
241 BN_RECP_CTX *recp, BN_CTX *ctx) { in BN_div_recp() argument
264 if (BN_ucmp(m, &recp->N) < 0) { in BN_div_recp()
279 j = recp->num_bits << 1; in BN_div_recp()
285 if (i != recp->shift) { in BN_div_recp()
286 recp->shift = in BN_div_recp()
287 BN_reciprocal(&(recp->Nr), &(recp->N), i, in BN_div_recp()
291 if (recp->shift == -1) { in BN_div_recp()
301 if (!BN_rshift(a, m, recp->num_bits)) { in BN_div_recp()
304 if (!BN_mul(b, a, &(recp->Nr), ctx)) { in BN_div_recp()
307 if (!BN_rshift(d, b, i - recp->num_bits)) { in BN_div_recp()
312 if (!BN_mul(b, &(recp->N), d, ctx)) { in BN_div_recp()
321 while (BN_ucmp(r, &(recp->N)) >= 0) { in BN_div_recp()
326 if (!BN_usub(r, r, &(recp->N))) { in BN_div_recp()
335 d->neg = m->neg ^ recp->N.neg; in BN_div_recp()
344 BN_RECP_CTX *recp, BN_CTX *ctx) { in BN_mod_mul_reciprocal() argument
370 ret = BN_div_recp(NULL, r, ca, recp, ctx); in BN_mod_mul_reciprocal()
437 BN_RECP_CTX recp; in mod_exp_recp() local
454 BN_RECP_CTX_init(&recp); in mod_exp_recp()
461 if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0) { in mod_exp_recp()
465 if (BN_RECP_CTX_set(&recp, m, ctx) <= 0) { in mod_exp_recp()
481 if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx)) { in mod_exp_recp()
487 !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx)) { in mod_exp_recp()
508 if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx)) { in mod_exp_recp()
541 if (!BN_mod_mul_reciprocal(r, r, r, &recp, ctx)) { in mod_exp_recp()
548 if (!BN_mod_mul_reciprocal(r, r, val[wvalue >> 1], &recp, ctx)) { in mod_exp_recp()
563 BN_RECP_CTX_free(&recp); in mod_exp_recp()