Lines Matching refs:recp
13 void BN_RECP_CTX_init(BN_RECP_CTX *recp) in BN_RECP_CTX_init() argument
15 memset(recp, 0, sizeof(*recp)); in BN_RECP_CTX_init()
16 bn_init(&(recp->N)); in BN_RECP_CTX_init()
17 bn_init(&(recp->Nr)); in BN_RECP_CTX_init()
33 void BN_RECP_CTX_free(BN_RECP_CTX *recp) in BN_RECP_CTX_free() argument
35 if (recp == NULL) in BN_RECP_CTX_free()
37 BN_free(&recp->N); in BN_RECP_CTX_free()
38 BN_free(&recp->Nr); in BN_RECP_CTX_free()
39 if (recp->flags & BN_FLG_MALLOCED) in BN_RECP_CTX_free()
40 OPENSSL_free(recp); in BN_RECP_CTX_free()
43 int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) in BN_RECP_CTX_set() argument
45 if (BN_is_zero(d) || !BN_copy(&(recp->N), d)) in BN_RECP_CTX_set()
47 BN_zero(&(recp->Nr)); in BN_RECP_CTX_set()
48 recp->num_bits = BN_num_bits(d); in BN_RECP_CTX_set()
49 recp->shift = 0; in BN_RECP_CTX_set()
54 BN_RECP_CTX *recp, BN_CTX *ctx) in BN_mod_mul_reciprocal() argument
75 ret = BN_div_recp(NULL, r, ca, recp, ctx); in BN_mod_mul_reciprocal()
83 BN_RECP_CTX *recp, BN_CTX *ctx) in BN_div_recp() argument
96 if (BN_ucmp(m, &(recp->N)) < 0) { in BN_div_recp()
113 j = recp->num_bits << 1; in BN_div_recp()
118 if (i != recp->shift) in BN_div_recp()
119 recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx); in BN_div_recp()
121 if (recp->shift == -1) in BN_div_recp()
130 if (!BN_rshift(a, m, recp->num_bits)) in BN_div_recp()
132 if (!BN_mul(b, a, &(recp->Nr), ctx)) in BN_div_recp()
134 if (!BN_rshift(d, b, i - recp->num_bits)) in BN_div_recp()
138 if (!BN_mul(b, &(recp->N), d, ctx)) in BN_div_recp()
145 while (BN_ucmp(r, &(recp->N)) >= 0) { in BN_div_recp()
150 if (!BN_usub(r, r, &(recp->N))) in BN_div_recp()
157 d->neg = m->neg ^ recp->N.neg; in BN_div_recp()