Lines Matching refs:mont
141 void BN_MONT_CTX_free(BN_MONT_CTX *mont) { in BN_MONT_CTX_free() argument
142 if (mont == NULL) { in BN_MONT_CTX_free()
146 BN_free(&mont->RR); in BN_MONT_CTX_free()
147 BN_free(&mont->N); in BN_MONT_CTX_free()
148 OPENSSL_free(mont); in BN_MONT_CTX_free()
165 int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) { in BN_MONT_CTX_set() argument
181 R = &mont->RR; /* grab RR as a temp */ in BN_MONT_CTX_set()
182 if (!BN_copy(&mont->N, mod)) { in BN_MONT_CTX_set()
185 mont->N.neg = 0; in BN_MONT_CTX_set()
238 mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; in BN_MONT_CTX_set()
239 mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0; in BN_MONT_CTX_set()
271 mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0; in BN_MONT_CTX_set()
272 mont->n0[1] = 0; in BN_MONT_CTX_set()
277 BN_zero(&(mont->RR)); in BN_MONT_CTX_set()
278 if (!BN_set_bit(&(mont->RR), ri * 2)) { in BN_MONT_CTX_set()
281 if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx)) { in BN_MONT_CTX_set()
324 int BN_to_montgomery(BIGNUM *ret, const BIGNUM *a, const BN_MONT_CTX *mont, in BN_to_montgomery() argument
326 return BN_mod_mul_montgomery(ret, a, &mont->RR, mont, ctx); in BN_to_montgomery()
331 const BN_MONT_CTX *mont) {
336 n = &mont->N;
358 n0 = mont->n0[0];
418 static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, const BN_MONT_CTX *mont) in BN_from_montgomery_word() argument
424 n= (BIGNUM*) &(mont->N); in BN_from_montgomery_word()
444 n0=mont->n0[0]; in BN_from_montgomery_word()
495 int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, const BN_MONT_CTX *mont, in BN_from_montgomery() argument
507 retn = BN_from_montgomery_word(ret, t, mont); in BN_from_montgomery()
515 const BN_MONT_CTX *mont, BN_CTX *ctx) { in BN_mod_mul_montgomery() argument
520 int num = mont->N.top; in BN_mod_mul_montgomery()
526 if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) { in BN_mod_mul_montgomery()
552 if (!BN_from_montgomery_word(r, tmp, mont)) { in BN_mod_mul_montgomery()