Lines Matching refs:x
64 #define MIN(x,y) ((x)<(y)?(x):(y)) argument
68 #define MAX(x,y) ((x)>(y)?(x):(y)) argument
71 #define OPT_CAST(x) (x *) argument
175 static int mp_reduce(mp_int * x, mp_int * m, mp_int * mu);
215 mp_int *x; in s_mp_add() local
224 x = a; in s_mp_add()
228 x = b; in s_mp_add()
276 *tmpc = x->dp[i] + u; in s_mp_add()
778 mp_int x, y, u, v, A, B, C, D; in mp_invmod_slow() local
787 if ((res = mp_init_multi(&x, &y, &u, &v, in mp_invmod_slow()
793 if ((res = mp_mod(a, b, &x)) != MP_OKAY) { in mp_invmod_slow()
801 if (mp_iseven (&x) == 1 && mp_iseven (&y) == 1) { in mp_invmod_slow()
807 if ((res = mp_copy (&x, &u)) != MP_OKAY) { in mp_invmod_slow()
829 if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { in mp_invmod_slow()
854 if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { in mp_invmod_slow()
925 LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); in mp_invmod_slow()
1007 int x, res; in mp_to_unsigned_bin() local
1014 x = 0; in mp_to_unsigned_bin()
1017 b[x++] = (unsigned char) (t.dp[0] & 255); in mp_to_unsigned_bin()
1019 b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7)); in mp_to_unsigned_bin()
1026 bn_reverse (b, x); in mp_to_unsigned_bin()
1037 int x, res; in mp_div_2d() local
1089 for (x = c->used - 1; x >= 0; x--) { in mp_div_2d()
1191 int x; in mp_rshd() local
1225 for (x = 0; x < (a->used - b); x++) { in mp_rshd()
1230 for (; x < a->used; x++) { in mp_rshd()
1356 int x, res, oldused; in mp_div_2() local
1378 for (x = b->used - 1; x >= 0; x--) { in mp_div_2()
1391 for (x = b->used; x < oldused; x++) { in mp_div_2()
1433 register int x; in mp_mul_2d() local
1446 for (x = 0; x < c->used; x++) { in mp_mul_2d()
1528 int x, res; in mp_lshd() local
1558 for (x = a->used - 1; x >= b; x--) { in mp_lshd()
1564 for (x = 0; x < b; x++) { in mp_lshd()
1601 int x, res; in mp_mod_2d() local
1621 for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { in mp_mod_2d()
1622 c->dp[x] = 0; in mp_mod_2d()
1721 mp_int q, x, y, t1, t2; in mp_div() local
1755 if ((res = mp_init_copy (&x, a)) != MP_OKAY) { in mp_div()
1765 x.sign = y.sign = MP_ZPOS; in mp_div()
1771 if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { in mp_div()
1782 n = x.used - 1; in mp_div()
1790 while (mp_cmp (&x, &y) != MP_LT) { in mp_div()
1792 if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) { in mp_div()
1802 if (i > x.used) { in mp_div()
1808 if (x.dp[i] == y.dp[t]) { in mp_div()
1812 tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); in mp_div()
1813 tmp |= ((mp_word) x.dp[i - 1]); in mp_div()
1839 t2.dp[0] = (i - 2 < 0) ? 0 : x.dp[i - 2]; in mp_div()
1840 t2.dp[1] = (i - 1 < 0) ? 0 : x.dp[i - 1]; in mp_div()
1841 t2.dp[2] = x.dp[i]; in mp_div()
1854 if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) { in mp_div()
1859 if (x.sign == MP_NEG) { in mp_div()
1866 if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) { in mp_div()
1879 x.sign = x.used == 0 ? MP_ZPOS : a->sign; in mp_div()
1888 mp_div_2d (&x, norm, &x, NULL); in mp_div()
1889 mp_exch (&x, d); in mp_div()
1895 LBL_X:mp_clear (&x); in mp_div()
1916 int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; in s_mp_exptmod() local
1920 x = mp_count_bits (X); in s_mp_exptmod()
1921 if (x <= 7) { in s_mp_exptmod()
1923 } else if (x <= 36) { in s_mp_exptmod()
1925 } else if (x <= 140) { in s_mp_exptmod()
1927 } else if (x <= 450) { in s_mp_exptmod()
1929 } else if (x <= 1303) { in s_mp_exptmod()
1931 } else if (x <= 3529) { in s_mp_exptmod()
1950 for (x = 1<<(winsize-1); x < (1 << winsize); x++) { in s_mp_exptmod()
1951 if ((err = mp_init(&M[x])) != MP_OKAY) { in s_mp_exptmod()
1952 for (y = 1<<(winsize-1); y < x; y++) { in s_mp_exptmod()
1996 for (x = 0; x < (winsize - 1); x++) { in s_mp_exptmod()
2012 for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { in s_mp_exptmod()
2013 if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { in s_mp_exptmod()
2016 if ((err = redux (&M[x], P, &mu)) != MP_OKAY) { in s_mp_exptmod()
2078 for (x = 0; x < winsize; x++) { in s_mp_exptmod()
2105 for (x = 0; x < bitcpy; x++) { in s_mp_exptmod()
2132 for (x = 1<<(winsize-1); x < (1 << winsize); x++) { in s_mp_exptmod()
2133 mp_clear (&M[x]); in s_mp_exptmod()
2293 mp_reduce (mp_int * x, mp_int * m, mp_int * mu) in mp_reduce() argument
2299 if ((res = mp_init_copy (&q, x)) != MP_OKAY) { in mp_reduce()
2333 if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { in mp_reduce()
2343 if ((res = mp_sub (x, &q, x)) != MP_OKAY) { in mp_reduce()
2348 if (mp_cmp_d (x, 0) == MP_LT) { in mp_reduce()
2353 if ((res = mp_add (x, &q, x)) != MP_OKAY) { in mp_reduce()
2359 while (mp_cmp (x, m) != MP_LT) { in mp_reduce()
2360 if ((res = s_mp_sub (x, m, x)) != MP_OKAY) { in mp_reduce()
2535 int x; in mp_init_size() local
2552 for (x = 0; x < size; x++) { in mp_init_size()
2553 a->dp[x] = 0; in mp_init_size()
2691 mp_digit x, b; in mp_montgomery_setup() local
2707 x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ in mp_montgomery_setup()
2708 x *= 2 - b * x; /* here x*a==1 mod 2**8 */ in mp_montgomery_setup()
2710 x *= 2 - b * x; /* here x*a==1 mod 2**16 */ in mp_montgomery_setup()
2713 x *= 2 - b * x; /* here x*a==1 mod 2**32 */ in mp_montgomery_setup()
2716 x *= 2 - b * x; /* here x*a==1 mod 2**64 */ in mp_montgomery_setup()
2720 *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; in mp_montgomery_setup()
2737 fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) in fast_mp_montgomery_reduce() argument
2743 olduse = x->used; in fast_mp_montgomery_reduce()
2746 if (x->alloc < n->used + 1) { in fast_mp_montgomery_reduce()
2747 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { in fast_mp_montgomery_reduce()
2763 tmpx = x->dp; in fast_mp_montgomery_reduce()
2766 for (ix = 0; ix < x->used; ix++) { in fast_mp_montgomery_reduce()
2852 tmpx = x->dp; in fast_mp_montgomery_reduce()
2870 x->used = n->used + 1; in fast_mp_montgomery_reduce()
2871 mp_clamp (x); in fast_mp_montgomery_reduce()
2874 if (mp_cmp_mag (x, n) != MP_LT) { in fast_mp_montgomery_reduce()
2875 return s_mp_sub (x, n, x); in fast_mp_montgomery_reduce()
2887 int x, res, oldused; in mp_mul_2() local
2910 for (x = 0; x < a->used; x++) { in mp_mul_2()
2937 for (x = b->used; x < oldused; x++) { in mp_mul_2()
2957 int x, bits, res; in mp_montgomery_calc_normalization() local
2973 for (x = bits - 1; x < (int)DIGIT_BIT; x++) { in mp_montgomery_calc_normalization()
3003 int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; in mp_exptmod_fast() local
3012 x = mp_count_bits (X); in mp_exptmod_fast()
3013 if (x <= 7) { in mp_exptmod_fast()
3015 } else if (x <= 36) { in mp_exptmod_fast()
3017 } else if (x <= 140) { in mp_exptmod_fast()
3019 } else if (x <= 450) { in mp_exptmod_fast()
3021 } else if (x <= 1303) { in mp_exptmod_fast()
3023 } else if (x <= 3529) { in mp_exptmod_fast()
3042 for (x = 1<<(winsize-1); x < (1 << winsize); x++) { in mp_exptmod_fast()
3043 if ((err = mp_init(&M[x])) != MP_OKAY) { in mp_exptmod_fast()
3044 for (y = 1<<(winsize-1); y < x; y++) { in mp_exptmod_fast()
3141 for (x = 0; x < (winsize - 1); x++) { in mp_exptmod_fast()
3151 for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { in mp_exptmod_fast()
3152 if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { in mp_exptmod_fast()
3155 if ((err = redux (&M[x], P, mp)) != MP_OKAY) { in mp_exptmod_fast()
3211 for (x = 0; x < winsize; x++) { in mp_exptmod_fast()
3238 for (x = 0; x < bitcpy; x++) { in mp_exptmod_fast()
3278 for (x = 1<<(winsize-1); x < (1 << winsize); x++) { in mp_exptmod_fast()
3279 mp_clear (&M[x]); in mp_exptmod_fast()