Lines Matching refs:mont

417     BN_MONT_CTX *mont = NULL;
457 mont = in_mont;
459 if ((mont = BN_MONT_CTX_new()) == NULL)
461 if (!BN_MONT_CTX_set(mont, m, ctx))
476 if (!bn_to_mont_fixed_top(val[0], aa, mont, ctx))
481 if (!bn_mul_mont_fixed_top(d, val[0], val[0], mont, ctx))
486 !bn_mul_mont_fixed_top(val[i], val[i - 1], d, mont, ctx))
511 if (!bn_to_mont_fixed_top(r, BN_value_one(), mont, ctx))
516 if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
547 if (!bn_mul_mont_fixed_top(r, r, r, mont, ctx))
552 if (!bn_mul_mont_fixed_top(r, r, val[wvalue >> 1], mont, ctx))
569 j = mont->N.top; /* borrow j */
574 if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx))
578 if (!BN_from_montgomery(rr, r, mont, ctx))
582 if ((in_mont == NULL) && (mont != NULL))
583 BN_MONT_CTX_free(mont);
709 BN_MONT_CTX *mont = NULL;
754 mont = in_mont;
756 if ((mont = BN_MONT_CTX_new()) == NULL)
758 if (!BN_MONT_CTX_set(mont, m, ctx))
772 RSAZ_1024_mod_exp_avx2(rr->d, a->d, p->d, m->d, mont->RR.d,
773 mont->n0[0]);
782 RSAZ_512_mod_exp(rr->d, a->d, p->d, m->d, mont->n0[0], mont->RR.d);
804 /* reserve space for mont->N.d[] copy */
805 powerbufLen += top * sizeof(mont->N.d[0]);
856 if (!bn_to_mont_fixed_top(&tmp, BN_value_one(), mont, ctx))
863 if (!bn_to_mont_fixed_top(&am, &am, mont, ctx))
865 } else if (!bn_to_mont_fixed_top(&am, a, mont, ctx))
926 BN_ULONG *np = mont->N.d, *n0 = mont->n0;
957 bn_flip_t4(np, mont->N.d, top);
1026 BN_ULONG *n0 = mont->n0, *np;
1038 * copy mont->N.d[] to improve cache locality
1041 np[i] = mont->N.d[i];
1132 if (!bn_mul_mont_fixed_top(&tmp, &am, &am, mont, ctx))
1139 if (!bn_mul_mont_fixed_top(&tmp, &am, &tmp, mont, ctx))
1163 if (!bn_mul_mont_fixed_top(&tmp, &tmp, &tmp, mont, ctx))
1176 if (!bn_mul_mont_fixed_top(&tmp, &tmp, &am, mont, ctx))
1191 if (!BN_mod_mul_montgomery(rr, &tmp, &am, mont, ctx))
1195 if (!BN_from_montgomery(rr, &tmp, mont, ctx))
1199 if ((in_mont == NULL) && (mont != NULL))
1200 BN_MONT_CTX_free(mont);
1213 BN_MONT_CTX *mont = NULL;
1233 #define BN_TO_MONTGOMERY_WORD(r, w, mont) \
1234 (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
1278 mont = in_mont;
1280 if ((mont = BN_MONT_CTX_new()) == NULL)
1282 if (!BN_MONT_CTX_set(mont, m, ctx))
1297 if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
1308 if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))
1317 if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
1333 if (!BN_TO_MONTGOMERY_WORD(r, w, mont))
1346 if (!BN_from_montgomery(rr, r, mont, ctx))
1351 if ((in_mont == NULL) && (mont != NULL))
1352 BN_MONT_CTX_free(mont);