Lines Matching refs:res

223   int     olduse, res, min, max;
240 if ((res = mp_grow (c, max + 1)) != MP_OKAY) {
241 return res;
310 int olduse, res, min, max;
318 if ((res = mp_grow (c, max)) != MP_OKAY) {
319 return res;
426 int sa, sb, res;
437 res = s_mp_add (a, b, c);
445 res = s_mp_sub (b, a, c);
448 res = s_mp_sub (a, b, c);
451 return res;
458 int sa, sb, res;
469 res = s_mp_add (a, b, c);
479 res = s_mp_sub (a, b, c);
485 res = s_mp_sub (b, a, c);
488 return res;
495 int res, neg;
501 res = mp_toom_mul(a, b, c);
507 res = mp_karatsuba_mul (a, b, c);
523 res = fast_s_mp_mul_digs (a, b, c, digs);
527 res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */
530 res = MP_VAL;
535 return res;
542 int res;
545 if ((res = mp_init (&t)) != MP_OKAY) {
546 return res;
549 if ((res = mp_mul (a, b, &t)) != MP_OKAY) {
551 return res;
553 res = mp_mod (&t, c, d);
555 return res;
563 int res;
565 if ((res = mp_init (&t)) != MP_OKAY) {
566 return res;
569 if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) {
571 return res;
575 res = mp_add (b, &t, c);
577 res = MP_OKAY;
582 return res;
774 int res;
782 if ((res = mp_init_multi(&x, &y, &u, &v,
784 return res;
788 if ((res = mp_mod(a, b, &x)) != MP_OKAY) {
791 if ((res = mp_copy (b, &y)) != MP_OKAY) {
797 res = MP_VAL;
802 if ((res = mp_copy (&x, &u)) != MP_OKAY) {
805 if ((res = mp_copy (&y, &v)) != MP_OKAY) {
815 if ((res = mp_div_2 (&u, &u)) != MP_OKAY) {
821 if ((res = mp_add (&A, &y, &A)) != MP_OKAY) {
824 if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) {
829 if ((res = mp_div_2 (&A, &A)) != MP_OKAY) {
832 if ((res = mp_div_2 (&B, &B)) != MP_OKAY) {
840 if ((res = mp_div_2 (&v, &v)) != MP_OKAY) {
846 if ((res = mp_add (&C, &y, &C)) != MP_OKAY) {
849 if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) {
854 if ((res = mp_div_2 (&C, &C)) != MP_OKAY) {
857 if ((res = mp_div_2 (&D, &D)) != MP_OKAY) {
865 if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) {
869 if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) {
873 if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) {
878 if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) {
882 if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) {
886 if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) {
899 res = MP_VAL;
905 if ((res = mp_add(&C, b, &C)) != MP_OKAY) {
912 if ((res = mp_sub(&C, b, &C)) != MP_OKAY) {
919 res = MP_OKAY;
921 return res;
964 int res;
968 if ((res = mp_grow(a, 2)) != MP_OKAY) {
969 return res;
978 if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) {
979 return res;
999 int x, res;
1002 if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
1003 return res;
1013 if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
1015 return res;
1028 int x, res;
1034 res = mp_copy (a, c);
1038 return res;
1041 if ((res = mp_init (&t)) != MP_OKAY) {
1042 return res;
1047 if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) {
1049 return res;
1054 if ((res = mp_copy (a, c)) != MP_OKAY) {
1056 return res;
1103 int res;
1105 if ((res = mp_init (a)) != MP_OKAY) {
1106 return res;
1131 int res, n;
1140 if ((res = mp_grow (b, a->used)) != MP_OKAY) {
1141 return res;
1307 int res;
1311 if ((res = mp_copy (a, b)) != MP_OKAY) {
1312 return res;
1337 int x, res, oldused;
1341 if ((res = mp_grow (b, a->used)) != MP_OKAY) {
1342 return res;
1387 int res;
1391 if ((res = mp_copy (a, c)) != MP_OKAY) {
1392 return res;
1397 if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) {
1398 return res;
1404 if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) {
1405 return res;
1451 mp_err res = MP_OKAY; /* Assume ok until proven otherwise */
1481 return res; /* Assumed ok, if error flagged above. */
1504 int x, res;
1513 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) {
1514 return res;
1575 int x, res;
1585 res = mp_copy (a, c);
1586 return res;
1590 if ((res = mp_copy (a, c)) != MP_OKAY) {
1591 return res;
1612 int res, n, n2;
1622 res = mp_copy (a, d);
1624 res = MP_OKAY;
1629 return res;
1633 if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) {
1634 return res;
1640 if (((res = mp_abs(a, &ta)) != MP_OKAY) ||
1641 ((res = mp_abs(b, &tb)) != MP_OKAY) ||
1642 ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) ||
1643 ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) {
1649 if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) ||
1650 ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) {
1654 if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) ||
1655 ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) {
1673 return res;
1694 int res, n, t, i, norm, neg;
1704 res = mp_copy (a, d);
1706 res = MP_OKAY;
1711 return res;
1714 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) {
1715 return res;
1719 if ((res = mp_init (&t1)) != MP_OKAY) {
1723 if ((res = mp_init (&t2)) != MP_OKAY) {
1727 if ((res = mp_init_copy (&x, a)) != MP_OKAY) {
1731 if ((res = mp_init_copy (&y, b)) != MP_OKAY) {
1743 if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) {
1746 if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) {
1758 if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */
1764 if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) {
1806 if ((res = mp_mul_d (&t1, q.dp[i - t - 1], &t1)) != MP_OKAY) {
1818 if ((res = mp_mul_d (&y, q.dp[i - t - 1], &t1)) != MP_OKAY) {
1822 if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) {
1826 if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) {
1832 if ((res = mp_copy (&y, &t1)) != MP_OKAY) {
1835 if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) {
1838 if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) {
1864 res = MP_OKAY;
1871 return res;
1885 mp_int M[TAB_SIZE], res, mu;
1993 if ((err = mp_init (&res)) != MP_OKAY) {
1996 mp_set (&res, 1);
2033 if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
2036 if ((err = redux (&res, P, &mu)) != MP_OKAY) {
2050 if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
2053 if ((err = redux (&res, P, &mu)) != MP_OKAY) {
2059 if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) {
2062 if ((err = redux (&res, P, &mu)) != MP_OKAY) {
2077 if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
2080 if ((err = redux (&res, P, &mu)) != MP_OKAY) {
2087 if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) {
2090 if ((err = redux (&res, P, &mu)) != MP_OKAY) {
2097 mp_exch (&res, Y);
2099 LBL_RES:mp_clear (&res);
2113 int res;
2118 res = mp_toom_sqr(a, b);
2124 res = mp_karatsuba_sqr (a, b);
2133 res = fast_s_mp_sqr (a, b);
2137 res = s_mp_sqr (a, b);
2140 res = MP_VAL;
2144 return res;
2155 int p, res;
2157 if ((res = mp_init(&q)) != MP_OKAY) {
2158 return res;
2164 if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) {
2169 if ((res = mp_mul(&q, d, &q)) != MP_OKAY) {
2174 if ((res = s_mp_add(a, &q, a)) != MP_OKAY) {
2185 return res;
2192 int res;
2195 if ((res = mp_init(&tmp)) != MP_OKAY) {
2196 return res;
2199 if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) {
2203 if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) {
2209 return res;
2220 int res;
2226 if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) {
2227 return res;
2245 int res;
2247 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) {
2248 return res;
2261 int res, um = m->used;
2264 if ((res = mp_init_copy (&q, x)) != MP_OKAY) {
2265 return res;
2273 if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) {
2278 if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {
2282 if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {
2288 res = MP_VAL;
2298 if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) {
2303 if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) {
2308 if ((res = mp_sub (x, &q, x)) != MP_OKAY) {
2315 if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) {
2318 if ((res = mp_add (x, &q, x)) != MP_OKAY) {
2325 if ((res = s_mp_sub (x, m, x)) != MP_OKAY) {
2333 return res;
2344 int res, pa, pb, ix, iy;
2358 if ((res = mp_init_size (&t, digs)) != MP_OKAY) {
2359 return res;
2428 int olduse, res, pa, ix, iz;
2434 if ((res = mp_grow (c, digs)) != MP_OKAY) {
2435 return res;
2531 int res, ix, iy, pa;
2536 if ((res = mp_init_size (&t, 2*pa + 1)) != MP_OKAY) {
2537 return res;
2597 int res, pa, pb, ix, iy;
2610 if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) {
2611 return res;
2703 int ix, res, olduse;
2711 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) {
2712 return res;
2850 int x, res, oldused;
2854 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) {
2855 return res;
2919 int x, bits, res;
2925 if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) {
2926 return res;
2936 if ((res = mp_mul_2 (a, a)) != MP_OKAY) {
2937 return res;
2940 if ((res = s_mp_sub (a, b, a)) != MP_OKAY) {
2941 return res;
2962 mp_int M[TAB_SIZE], res;
3064 if ((err = mp_init (&res)) != MP_OKAY) {
3078 if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) {
3087 if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) {
3091 mp_set(&res, 1);
3156 if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
3159 if ((err = redux (&res, P, mp)) != MP_OKAY) {
3173 if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
3176 if ((err = redux (&res, P, mp)) != MP_OKAY) {
3182 if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) {
3185 if ((err = redux (&res, P, mp)) != MP_OKAY) {
3200 if ((err = mp_sqr (&res, &res)) != MP_OKAY) {
3203 if ((err = redux (&res, P, mp)) != MP_OKAY) {
3211 if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) {
3214 if ((err = redux (&res, P, mp)) != MP_OKAY) {
3228 if ((err = redux(&res, P, mp)) != MP_OKAY) {
3233 /* swap res with Y */
3234 mp_exch (&res, Y);
3236 LBL_RES:mp_clear (&res);
3260 int olduse, res, pa, ix, iz;
3267 if ((res = mp_grow (b, pa)) != MP_OKAY) {
3268 return res;
3350 int ix, res, olduse;
3354 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) {
3355 return res;