Lines Matching refs:MP_OKAY
23 { MP_OKAY, "Successful" },
87 if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { in fast_mp_invmod()
92 if ((res = mp_copy (b, &x)) != MP_OKAY) { in fast_mp_invmod()
97 if ((res = mp_mod (a, b, &y)) != MP_OKAY) { in fast_mp_invmod()
102 if ((res = mp_copy (&x, &u)) != MP_OKAY) { in fast_mp_invmod()
105 if ((res = mp_copy (&y, &v)) != MP_OKAY) { in fast_mp_invmod()
114 if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { in fast_mp_invmod()
119 if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { in fast_mp_invmod()
124 if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { in fast_mp_invmod()
132 if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { in fast_mp_invmod()
138 if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { in fast_mp_invmod()
143 if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { in fast_mp_invmod()
151 if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { in fast_mp_invmod()
155 if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { in fast_mp_invmod()
160 if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { in fast_mp_invmod()
164 if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { in fast_mp_invmod()
185 if ((res = mp_add (&D, b, &D)) != MP_OKAY) { in fast_mp_invmod()
191 res = MP_OKAY; in fast_mp_invmod()
240 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { in fast_mp_montgomery_reduce()
370 return MP_OKAY; in fast_mp_montgomery_reduce()
422 if ((res = mp_grow (c, digs)) != MP_OKAY) { in fast_s_mp_mul_digs()
481 return MP_OKAY; in fast_s_mp_mul_digs()
527 if ((res = mp_grow (c, pa)) != MP_OKAY) { in fast_s_mp_mul_high_digs()
583 return MP_OKAY; in fast_s_mp_mul_high_digs()
630 if ((res = mp_grow (b, pa)) != MP_OKAY) { in fast_s_mp_sqr()
701 return MP_OKAY; in fast_s_mp_sqr()
743 if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) { in mp_2expt()
753 return MP_OKAY; in mp_2expt()
792 if ((res = mp_copy (a, b)) != MP_OKAY) { in mp_abs()
800 return MP_OKAY; in mp_abs()
894 if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { in mp_add_d()
972 return MP_OKAY; in mp_add_d()
1008 if ((res = mp_init (&t)) != MP_OKAY) { in mp_addmod()
1012 if ((res = mp_add (a, b, &t)) != MP_OKAY) { in mp_addmod()
1054 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_and()
1060 if ((res = mp_init_copy (&t, b)) != MP_OKAY) { in mp_and()
1079 return MP_OKAY; in mp_and()
1460 return MP_OKAY; in mp_copy()
1465 if ((res = mp_grow (b, a->used)) != MP_OKAY) { in mp_copy()
1496 return MP_OKAY; in mp_copy()
1591 res = MP_OKAY; in mp_div()
1600 if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL) != MP_OKAY)) { in mp_div()
1607 if (((res = mp_abs(a, &ta)) != MP_OKAY) || in mp_div()
1608 ((res = mp_abs(b, &tb)) != MP_OKAY) || in mp_div()
1609 ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || in mp_div()
1610 ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { in mp_div()
1616 if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || in mp_div()
1617 ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { in mp_div()
1621 if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || in mp_div()
1622 ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { in mp_div()
1673 res = MP_OKAY; in mp_div()
1681 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { in mp_div()
1686 if ((res = mp_init (&t1)) != MP_OKAY) { in mp_div()
1690 if ((res = mp_init (&t2)) != MP_OKAY) { in mp_div()
1694 if ((res = mp_init_copy (&x, a)) != MP_OKAY) { in mp_div()
1698 if ((res = mp_init_copy (&y, b)) != MP_OKAY) { in mp_div()
1710 if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { in mp_div()
1713 if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) { in mp_div()
1725 if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ in mp_div()
1731 if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) { in mp_div()
1773 if ((res = mp_mul_d (&t1, q.dp[i - t - 1], &t1)) != MP_OKAY) { in mp_div()
1785 if ((res = mp_mul_d (&y, q.dp[i - t - 1], &t1)) != MP_OKAY) { in mp_div()
1789 if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) { in mp_div()
1793 if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) { in mp_div()
1799 if ((res = mp_copy (&y, &t1)) != MP_OKAY) { in mp_div()
1802 if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) { in mp_div()
1805 if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) { in mp_div()
1831 res = MP_OKAY; in mp_div()
1876 if ((res = mp_grow (b, a->used)) != MP_OKAY) { in mp_div_2()
1913 return MP_OKAY; in mp_div_2()
1958 if ((res = mp_init (&t)) != MP_OKAY) { in mp_div_2d()
1964 if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { in mp_div_2d()
1971 if ((res = mp_copy (a, c)) != MP_OKAY) { in mp_div_2d()
2014 return MP_OKAY; in mp_div_2d()
2054 if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { in mp_div_3()
2159 return MP_OKAY; in mp_div_d()
2170 return MP_OKAY; in mp_div_d()
2181 if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { in mp_div_d()
2312 if ((err = mp_grow (x, m + m)) != MP_OKAY) { in mp_dr_reduce()
2356 return MP_OKAY; in mp_dr_reduce()
2464 if ((res = mp_init_copy (&g, a)) != MP_OKAY) { in mp_expt_d()
2473 if ((res = mp_sqr (c, c)) != MP_OKAY) { in mp_expt_d()
2480 if ((res = mp_mul (c, &g, c)) != MP_OKAY) { in mp_expt_d()
2491 return MP_OKAY; in mp_expt_d()
2541 if ((err = mp_init(&tmpG)) != MP_OKAY) { in mp_exptmod()
2544 if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { in mp_exptmod()
2550 if ((err = mp_init(&tmpX)) != MP_OKAY) { in mp_exptmod()
2554 if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { in mp_exptmod()
2687 if ((err = mp_init(&M[1])) != MP_OKAY) { in mp_exptmod_fast()
2693 if ((err = mp_init(&M[x])) != MP_OKAY) { in mp_exptmod_fast()
2706 if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) { in mp_exptmod_fast()
2742 if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { in mp_exptmod_fast()
2753 if ((err = mp_init (&res)) != MP_OKAY) { in mp_exptmod_fast()
2767 if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { in mp_exptmod_fast()
2776 if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { in mp_exptmod_fast()
2781 if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { in mp_exptmod_fast()
2787 if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { in mp_exptmod_fast()
2792 if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { in mp_exptmod_fast()
2795 if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2802 if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { in mp_exptmod_fast()
2805 if ((err = redux (&M[x], P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2845 if ((err = mp_sqr (&res, &res)) != MP_OKAY) { in mp_exptmod_fast()
2848 if ((err = redux (&res, P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2862 if ((err = mp_sqr (&res, &res)) != MP_OKAY) { in mp_exptmod_fast()
2865 if ((err = redux (&res, P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2871 if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { in mp_exptmod_fast()
2874 if ((err = redux (&res, P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2889 if ((err = mp_sqr (&res, &res)) != MP_OKAY) { in mp_exptmod_fast()
2892 if ((err = redux (&res, P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2900 if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { in mp_exptmod_fast()
2903 if ((err = redux (&res, P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2917 if ((err = redux(&res, P, mp)) != MP_OKAY) { in mp_exptmod_fast()
2924 err = MP_OKAY; in mp_exptmod_fast()
2968 …f ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { in mp_exteuclid()
2974 if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2978 if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2983 if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2986 if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2987 if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2988 if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2989 if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2990 if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2991 if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2994 if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2995 if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2996 if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
2999 if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
3000 if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
3001 if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto _ERR; } in mp_exteuclid()
3016 err = MP_OKAY; in mp_exteuclid()
3075 if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) { in mp_fread()
3078 if ((err = mp_add_d(a, y, a)) != MP_OKAY) { in mp_fread()
3088 return MP_OKAY; in mp_fread()
3122 if ((err = mp_radix_size(a, radix, &len)) != MP_OKAY) { in mp_fwrite()
3131 if ((err = mp_toradix(a, buf, radix)) != MP_OKAY) { in mp_fwrite()
3144 return MP_OKAY; in mp_fwrite()
3188 if ((res = mp_init_copy (&u, a)) != MP_OKAY) { in mp_gcd()
3192 if ((res = mp_init_copy (&v, b)) != MP_OKAY) { in mp_gcd()
3206 if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { in mp_gcd()
3210 if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { in mp_gcd()
3217 if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { in mp_gcd()
3223 if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { in mp_gcd()
3236 if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { in mp_gcd()
3241 if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { in mp_gcd()
3247 if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) { in mp_gcd()
3251 res = MP_OKAY; in mp_gcd()
3364 return MP_OKAY; in mp_grow()
3414 return MP_OKAY; in mp_init()
3447 if ((res = mp_init (a)) != MP_OKAY) { in mp_init_copy()
3481 mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ in mp_init_multi()
3488 if (mp_init(cur_arg) != MP_OKAY) { in mp_init_multi()
3545 if ((err = mp_init(a)) != MP_OKAY) { in mp_init_set()
3581 if ((err = mp_init(a)) != MP_OKAY) { in mp_init_set_int()
3636 return MP_OKAY; in mp_init_size()
3724 &A, &B, &C, &D, NULL)) != MP_OKAY) { in mp_invmod_slow()
3729 if ((res = mp_mod(a, b, &x)) != MP_OKAY) { in mp_invmod_slow()
3732 if ((res = mp_copy (b, &y)) != MP_OKAY) { in mp_invmod_slow()
3743 if ((res = mp_copy (&x, &u)) != MP_OKAY) { in mp_invmod_slow()
3746 if ((res = mp_copy (&y, &v)) != MP_OKAY) { in mp_invmod_slow()
3756 if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { in mp_invmod_slow()
3762 if ((res = mp_add (&A, &y, &A)) != MP_OKAY) { in mp_invmod_slow()
3765 if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { in mp_invmod_slow()
3770 if ((res = mp_div_2 (&A, &A)) != MP_OKAY) { in mp_invmod_slow()
3773 if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { in mp_invmod_slow()
3781 if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { in mp_invmod_slow()
3787 if ((res = mp_add (&C, &y, &C)) != MP_OKAY) { in mp_invmod_slow()
3790 if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { in mp_invmod_slow()
3795 if ((res = mp_div_2 (&C, &C)) != MP_OKAY) { in mp_invmod_slow()
3798 if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { in mp_invmod_slow()
3806 if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { in mp_invmod_slow()
3810 if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) { in mp_invmod_slow()
3814 if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { in mp_invmod_slow()
3819 if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { in mp_invmod_slow()
3823 if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) { in mp_invmod_slow()
3827 if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { in mp_invmod_slow()
3846 if ((res = mp_add(&C, b, &C)) != MP_OKAY) { in mp_invmod_slow()
3853 if ((res = mp_sub(&C, b, &C)) != MP_OKAY) { in mp_invmod_slow()
3860 res = MP_OKAY; in mp_invmod_slow()
3929 return MP_OKAY; in mp_is_square()
3934 return MP_OKAY; in mp_is_square()
3938 if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { in mp_is_square()
3942 return MP_OKAY; in mp_is_square()
3946 if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { in mp_is_square()
3949 if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { in mp_is_square()
3966 if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { in mp_is_square()
3969 if ((res = mp_sqr(&t,&t)) != MP_OKAY) { in mp_is_square()
4020 return MP_OKAY; in mp_jacobi()
4026 return MP_OKAY; in mp_jacobi()
4033 if ((res = mp_init_copy (&a1, a)) != MP_OKAY) { in mp_jacobi()
4037 if ((res = mp_init (&p1)) != MP_OKAY) { in mp_jacobi()
4043 if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { in mp_jacobi()
4071 if ((res = mp_mod (p, &a1, &p1)) != MP_OKAY) { in mp_jacobi()
4074 if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) { in mp_jacobi()
4081 res = MP_OKAY; in mp_jacobi()
4156 if (mp_init_size (&x0, B) != MP_OKAY) in mp_karatsuba_mul()
4158 if (mp_init_size (&x1, a->used - B) != MP_OKAY) in mp_karatsuba_mul()
4160 if (mp_init_size (&y0, B) != MP_OKAY) in mp_karatsuba_mul()
4162 if (mp_init_size (&y1, b->used - B) != MP_OKAY) in mp_karatsuba_mul()
4166 if (mp_init_size (&t1, B * 2) != MP_OKAY) in mp_karatsuba_mul()
4168 if (mp_init_size (&x0y0, B * 2) != MP_OKAY) in mp_karatsuba_mul()
4170 if (mp_init_size (&x1y1, B * 2) != MP_OKAY) in mp_karatsuba_mul()
4214 if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) in mp_karatsuba_mul()
4216 if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) in mp_karatsuba_mul()
4220 if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) in mp_karatsuba_mul()
4222 if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) in mp_karatsuba_mul()
4224 if (mp_mul (&t1, &x0, &t1) != MP_OKAY) in mp_karatsuba_mul()
4228 if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) in mp_karatsuba_mul()
4230 if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) in mp_karatsuba_mul()
4234 if (mp_lshd (&t1, B) != MP_OKAY) in mp_karatsuba_mul()
4236 if (mp_lshd (&x1y1, B * 2) != MP_OKAY) in mp_karatsuba_mul()
4239 if (mp_add (&x0y0, &t1, &t1) != MP_OKAY) in mp_karatsuba_mul()
4241 if (mp_add (&t1, &x1y1, c) != MP_OKAY) in mp_karatsuba_mul()
4245 err = MP_OKAY; in mp_karatsuba_mul()
4304 if (mp_init_size (&x0, B) != MP_OKAY) in mp_karatsuba_sqr()
4306 if (mp_init_size (&x1, a->used - B) != MP_OKAY) in mp_karatsuba_sqr()
4310 if (mp_init_size (&t1, a->used * 2) != MP_OKAY) in mp_karatsuba_sqr()
4312 if (mp_init_size (&t2, a->used * 2) != MP_OKAY) in mp_karatsuba_sqr()
4314 if (mp_init_size (&x0x0, B * 2) != MP_OKAY) in mp_karatsuba_sqr()
4316 if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) in mp_karatsuba_sqr()
4343 if (mp_sqr (&x0, &x0x0) != MP_OKAY) in mp_karatsuba_sqr()
4345 if (mp_sqr (&x1, &x1x1) != MP_OKAY) in mp_karatsuba_sqr()
4349 if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) in mp_karatsuba_sqr()
4351 if (mp_sqr (&t1, &t1) != MP_OKAY) in mp_karatsuba_sqr()
4355 if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) in mp_karatsuba_sqr()
4357 if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) in mp_karatsuba_sqr()
4361 if (mp_lshd (&t1, B) != MP_OKAY) in mp_karatsuba_sqr()
4363 if (mp_lshd (&x1x1, B * 2) != MP_OKAY) in mp_karatsuba_sqr()
4366 if (mp_add (&x0x0, &t1, &t1) != MP_OKAY) in mp_karatsuba_sqr()
4368 if (mp_add (&t1, &x1x1, b) != MP_OKAY) in mp_karatsuba_sqr()
4371 err = MP_OKAY; in mp_karatsuba_sqr()
4415 if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) { in mp_lcm()
4420 if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) { in mp_lcm()
4427 if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) { in mp_lcm()
4433 if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) { in mp_lcm()
4479 return MP_OKAY; in mp_lshd()
4484 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { in mp_lshd()
4515 return MP_OKAY; in mp_lshd()
4550 if ((res = mp_init (&t)) != MP_OKAY) { in mp_mod()
4554 if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) { in mp_mod()
4562 res = MP_OKAY; in mp_mod()
4604 return MP_OKAY; in mp_mod_2d()
4614 if ((res = mp_copy (a, c)) != MP_OKAY) { in mp_mod_2d()
4626 return MP_OKAY; in mp_mod_2d()
4699 if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { in mp_montgomery_calc_normalization()
4710 if ((res = mp_mul_2 (a, a)) != MP_OKAY) { in mp_montgomery_calc_normalization()
4714 if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { in mp_montgomery_calc_normalization()
4720 return MP_OKAY; in mp_montgomery_calc_normalization()
4770 if ((res = mp_grow (x, digs)) != MP_OKAY) { in mp_montgomery_reduce()
4842 return MP_OKAY; in mp_montgomery_reduce()
4905 return MP_OKAY; in mp_montgomery_setup()
5010 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { in mp_mul_2()
5061 return MP_OKAY; in mp_mul_2()
5097 if ((res = mp_copy (a, c)) != MP_OKAY) { in mp_mul_2d()
5103 if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { in mp_mul_2d()
5110 if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { in mp_mul_2d()
5150 return MP_OKAY; in mp_mul_2d()
5188 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { in mp_mul_d()
5233 return MP_OKAY; in mp_mul_d()
5267 if ((res = mp_init (&t)) != MP_OKAY) { in mp_mulmod()
5271 if ((res = mp_mul (a, b, &t)) != MP_OKAY) { in mp_mulmod()
5325 if ((res = mp_init (&t1)) != MP_OKAY) { in mp_n_root()
5329 if ((res = mp_init (&t2)) != MP_OKAY) { in mp_n_root()
5333 if ((res = mp_init (&t3)) != MP_OKAY) { in mp_n_root()
5346 if ((res = mp_copy (&t2, &t1)) != MP_OKAY) { in mp_n_root()
5353 if ((res = mp_expt_d (&t1, b - 1, &t3)) != MP_OKAY) { in mp_n_root()
5359 if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) { in mp_n_root()
5364 if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) { in mp_n_root()
5370 if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) { in mp_n_root()
5375 if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) { in mp_n_root()
5379 if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) { in mp_n_root()
5386 if ((res = mp_expt_d (&t1, b, &t2)) != MP_OKAY) { in mp_n_root()
5391 if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) { in mp_n_root()
5408 res = MP_OKAY; in mp_n_root()
5446 if ((res = mp_copy (a, b)) != MP_OKAY) { in mp_neg()
5457 return MP_OKAY; in mp_neg()
5492 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_or()
5498 if ((res = mp_init_copy (&t, b)) != MP_OKAY) { in mp_or()
5511 return MP_OKAY; in mp_or()
5561 if ((err = mp_init (&t)) != MP_OKAY) { in mp_prime_fermat()
5566 if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { in mp_prime_fermat()
5575 err = MP_OKAY; in mp_prime_fermat()
5620 if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) { in mp_prime_is_divisible()
5627 return MP_OKAY; in mp_prime_is_divisible()
5631 return MP_OKAY; in mp_prime_is_divisible()
5683 return MP_OKAY; in mp_prime_is_prime()
5688 if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { in mp_prime_is_prime()
5694 return MP_OKAY; in mp_prime_is_prime()
5698 if ((err = mp_init (&b)) != MP_OKAY) { in mp_prime_is_prime()
5706 if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { in mp_prime_is_prime()
5767 if ((err = mp_init_copy (&n1, a)) != MP_OKAY) { in mp_prime_miller_rabin()
5770 if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) { in mp_prime_miller_rabin()
5775 if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) { in mp_prime_miller_rabin()
5785 if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) { in mp_prime_miller_rabin()
5790 if ((err = mp_init (&y)) != MP_OKAY) { in mp_prime_miller_rabin()
5793 if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) { in mp_prime_miller_rabin()
5802 if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) { in mp_prime_miller_rabin()
5889 return MP_OKAY; in mp_prime_next_prime()
5895 return MP_OKAY; in mp_prime_next_prime()
5902 return MP_OKAY; in mp_prime_next_prime()
5919 if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; }; in mp_prime_next_prime()
5924 if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { in mp_prime_next_prime()
5932 if ((err = mp_mod_d(a, ltm_prime_tab[x], res_tab + x)) != MP_OKAY) { in mp_prime_next_prime()
5938 if ((err = mp_init(&b)) != MP_OKAY) { in mp_prime_next_prime()
5970 if ((err = mp_add_d(a, step, a)) != MP_OKAY) { in mp_prime_next_prime()
5982 if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { in mp_prime_next_prime()
5995 err = MP_OKAY; in mp_prime_next_prime()
6155 if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6158 if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6165 if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6166 if ((err = mp_div_2(a, a)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6169 if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6175 if ((err = mp_mul_2(a, a)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6176 if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { goto error; } in mp_prime_random_ex()
6179 err = MP_OKAY; in mp_prime_random_ex()
6224 return MP_OKAY; in mp_radix_size()
6234 return MP_OKAY; in mp_radix_size()
6246 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_radix_size()
6255 if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { in mp_radix_size()
6265 return MP_OKAY; in mp_radix_size()
6331 return MP_OKAY; in mp_rand()
6339 if ((res = mp_add_d (a, d, a)) != MP_OKAY) { in mp_rand()
6344 if ((res = mp_lshd (a, 1)) != MP_OKAY) { in mp_rand()
6348 if ((res = mp_add_d (a, ((mp_digit) abs (rand ())), a)) != MP_OKAY) { in mp_rand()
6353 return MP_OKAY; in mp_rand()
6426 if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) { in mp_read_radix()
6429 if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) { in mp_read_radix()
6442 return MP_OKAY; in mp_read_radix()
6476 if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) { in mp_read_signed_bin()
6487 return MP_OKAY; in mp_read_signed_bin()
6522 if ((res = mp_grow(a, 2)) != MP_OKAY) { in mp_read_unsigned_bin()
6532 if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) { in mp_read_unsigned_bin()
6546 return MP_OKAY; in mp_read_unsigned_bin()
6584 if ((res = mp_init_copy (&q, x)) != MP_OKAY) { in mp_reduce()
6593 if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) { in mp_reduce()
6598 if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { in mp_reduce()
6602 if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { in mp_reduce()
6617 if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { in mp_reduce()
6622 if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) { in mp_reduce()
6627 if ((res = mp_sub (x, &q, x)) != MP_OKAY) { in mp_reduce()
6634 if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) in mp_reduce()
6636 if ((res = mp_add (x, &q, x)) != MP_OKAY) in mp_reduce()
6642 if ((res = s_mp_sub (x, m, x)) != MP_OKAY) { in mp_reduce()
6684 if ((res = mp_init(&q)) != MP_OKAY) { in mp_reduce_2k()
6691 if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { in mp_reduce_2k()
6697 if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) { in mp_reduce_2k()
6703 if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { in mp_reduce_2k()
6752 if ((res = mp_init(&q)) != MP_OKAY) { in mp_reduce_2k_l()
6759 if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { in mp_reduce_2k_l()
6764 if ((res = mp_mul(&q, d, &q)) != MP_OKAY) { in mp_reduce_2k_l()
6769 if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { in mp_reduce_2k_l()
6815 if ((res = mp_init(&tmp)) != MP_OKAY) { in mp_reduce_2k_setup()
6820 if ((res = mp_2expt(&tmp, p)) != MP_OKAY) { in mp_reduce_2k_setup()
6825 if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) { in mp_reduce_2k_setup()
6832 return MP_OKAY; in mp_reduce_2k_setup()
6866 if ((res = mp_init(&tmp)) != MP_OKAY) { in mp_reduce_2k_setup_l()
6870 if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) { in mp_reduce_2k_setup_l()
6874 if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) { in mp_reduce_2k_setup_l()
7019 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { in mp_reduce_setup()
7169 if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) { in mp_set_int()
7183 return MP_OKAY; in mp_set_int()
7222 return MP_OKAY; in mp_shrink()
7350 if ((res = mp_init (&t)) != MP_OKAY) { in mp_sqrmod()
7354 if ((res = mp_sqr (a, &t)) != MP_OKAY) { in mp_sqrmod()
7402 return MP_OKAY; in mp_sqrt()
7405 if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { in mp_sqrt()
7409 if ((res = mp_init(&t2)) != MP_OKAY) { in mp_sqrt()
7417 if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { in mp_sqrt()
7420 if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { in mp_sqrt()
7423 if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { in mp_sqrt()
7428 if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { in mp_sqrt()
7431 if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { in mp_sqrt()
7434 if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { in mp_sqrt()
7545 if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { in mp_sub_d()
7604 return MP_OKAY; in mp_sub_d()
7641 if ((res = mp_init (&t)) != MP_OKAY) { in mp_submod()
7645 if ((res = mp_sub (a, b, &t)) != MP_OKAY) { in mp_submod()
7684 if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) { in mp_to_signed_bin()
7688 return MP_OKAY; in mp_to_signed_bin()
7757 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_to_unsigned_bin()
7768 if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) { in mp_to_unsigned_bin()
7775 return MP_OKAY; in mp_to_unsigned_bin()
7853 &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { in mp_toom_mul()
7861 if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { in mp_toom_mul()
7865 if ((res = mp_copy(a, &a1)) != MP_OKAY) { in mp_toom_mul()
7871 if ((res = mp_copy(a, &a2)) != MP_OKAY) { in mp_toom_mul()
7877 if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { in mp_toom_mul()
7881 if ((res = mp_copy(b, &b1)) != MP_OKAY) { in mp_toom_mul()
7887 if ((res = mp_copy(b, &b2)) != MP_OKAY) { in mp_toom_mul()
7893 if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { in mp_toom_mul()
7898 if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { in mp_toom_mul()
7903 if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7906 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7909 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7912 if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7916 if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7919 if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7922 if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7925 if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7929 if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { in mp_toom_mul()
7934 if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7937 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7940 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7943 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7947 if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7950 if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7953 if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7956 if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7960 if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { in mp_toom_mul()
7966 if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7969 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { in mp_toom_mul()
7972 if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7975 if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { in mp_toom_mul()
7978 if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { in mp_toom_mul()
7995 if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { in mp_toom_mul()
7999 if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { in mp_toom_mul()
8003 if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { in mp_toom_mul()
8007 if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { in mp_toom_mul()
8011 if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { in mp_toom_mul()
8014 if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { in mp_toom_mul()
8018 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { in mp_toom_mul()
8022 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { in mp_toom_mul()
8026 if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { in mp_toom_mul()
8029 if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { in mp_toom_mul()
8033 if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { in mp_toom_mul()
8036 if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { in mp_toom_mul()
8040 if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { in mp_toom_mul()
8043 if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { in mp_toom_mul()
8046 if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { in mp_toom_mul()
8050 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { in mp_toom_mul()
8054 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { in mp_toom_mul()
8058 if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { in mp_toom_mul()
8062 if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { in mp_toom_mul()
8067 if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { in mp_toom_mul()
8070 if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { in mp_toom_mul()
8073 if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { in mp_toom_mul()
8076 if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { in mp_toom_mul()
8080 if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { in mp_toom_mul()
8083 if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { in mp_toom_mul()
8086 if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { in mp_toom_mul()
8089 if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { in mp_toom_mul()
8134 if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { in mp_toom_sqr()
8142 if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { in mp_toom_sqr()
8146 if ((res = mp_copy(a, &a1)) != MP_OKAY) { in mp_toom_sqr()
8152 if ((res = mp_copy(a, &a2)) != MP_OKAY) { in mp_toom_sqr()
8158 if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { in mp_toom_sqr()
8163 if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { in mp_toom_sqr()
8168 if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8171 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8174 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8177 if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8181 if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { in mp_toom_sqr()
8186 if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8189 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8192 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8195 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8199 if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { in mp_toom_sqr()
8205 if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8208 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8211 if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { in mp_toom_sqr()
8227 if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { in mp_toom_sqr()
8231 if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { in mp_toom_sqr()
8235 if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { in mp_toom_sqr()
8239 if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { in mp_toom_sqr()
8243 if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { in mp_toom_sqr()
8246 if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { in mp_toom_sqr()
8250 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { in mp_toom_sqr()
8254 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { in mp_toom_sqr()
8258 if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8261 if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { in mp_toom_sqr()
8265 if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8268 if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { in mp_toom_sqr()
8272 if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { in mp_toom_sqr()
8275 if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { in mp_toom_sqr()
8278 if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { in mp_toom_sqr()
8282 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { in mp_toom_sqr()
8286 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { in mp_toom_sqr()
8290 if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { in mp_toom_sqr()
8294 if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { in mp_toom_sqr()
8299 if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { in mp_toom_sqr()
8302 if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { in mp_toom_sqr()
8305 if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { in mp_toom_sqr()
8308 if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { in mp_toom_sqr()
8312 if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { in mp_toom_sqr()
8315 if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8318 if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { in mp_toom_sqr()
8321 if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { in mp_toom_sqr()
8373 return MP_OKAY; in mp_toradix()
8376 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_toradix()
8389 if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { in mp_toradix()
8406 return MP_OKAY; in mp_toradix()
8455 return MP_OKAY; in mp_toradix_n()
8458 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_toradix_n()
8481 if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { in mp_toradix_n()
8498 return MP_OKAY; in mp_toradix_n()
8567 if ((res = mp_init_copy (&t, a)) != MP_OKAY) { in mp_xor()
8573 if ((res = mp_init_copy (&t, b)) != MP_OKAY) { in mp_xor()
8586 return MP_OKAY; in mp_xor()
8784 if ((res = mp_grow (c, max + 1)) != MP_OKAY) { in s_mp_add()
8847 return MP_OKAY; in s_mp_add()
8913 if ((err = mp_init(&M[1])) != MP_OKAY) { in s_mp_exptmod()
8919 if ((err = mp_init(&M[x])) != MP_OKAY) { in s_mp_exptmod()
8929 if ((err = mp_init (&mu)) != MP_OKAY) { in s_mp_exptmod()
8934 if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) { in s_mp_exptmod()
8939 if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) { in s_mp_exptmod()
8953 if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) { in s_mp_exptmod()
8960 if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { in s_mp_exptmod()
8967 &M[1 << (winsize - 1)])) != MP_OKAY) { in s_mp_exptmod()
8972 if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { in s_mp_exptmod()
8981 if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { in s_mp_exptmod()
8984 if ((err = redux (&M[x], P, &mu)) != MP_OKAY) { in s_mp_exptmod()
8990 if ((err = mp_init (&res)) != MP_OKAY) { in s_mp_exptmod()
9030 if ((err = mp_sqr (&res, &res)) != MP_OKAY) { in s_mp_exptmod()
9033 if ((err = redux (&res, P, &mu)) != MP_OKAY) { in s_mp_exptmod()
9047 if ((err = mp_sqr (&res, &res)) != MP_OKAY) { in s_mp_exptmod()
9050 if ((err = redux (&res, P, &mu)) != MP_OKAY) { in s_mp_exptmod()
9056 if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { in s_mp_exptmod()
9059 if ((err = redux (&res, P, &mu)) != MP_OKAY) { in s_mp_exptmod()
9074 if ((err = mp_sqr (&res, &res)) != MP_OKAY) { in s_mp_exptmod()
9077 if ((err = redux (&res, P, &mu)) != MP_OKAY) { in s_mp_exptmod()
9084 if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { in s_mp_exptmod()
9087 if ((err = redux (&res, P, &mu)) != MP_OKAY) { in s_mp_exptmod()
9095 err = MP_OKAY; in s_mp_exptmod()
9150 if ((res = mp_init_size (&t, digs)) != MP_OKAY) { in s_mp_mul_digs()
9197 return MP_OKAY; in s_mp_mul_digs()
9245 if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { in s_mp_mul_high_digs()
9282 return MP_OKAY; in s_mp_mul_high_digs()
9319 if ((res = mp_init_size (&t, 2*pa + 1)) != MP_OKAY) { in s_mp_sqr()
9370 return MP_OKAY; in s_mp_sqr()
9410 if ((res = mp_grow (c, max)) != MP_OKAY) { in s_mp_sub()
9462 return MP_OKAY; in s_mp_sub()