Lines Matching +full:1 +full:k
16 int k; member
42 ctx = kcalloc(1, sizeof(*ctx), GFP_KERNEL); in mpi_barrett_init()
48 ctx->m_copied = 1; in mpi_barrett_init()
52 ctx->k = mpi_get_nlimbs(m); in mpi_barrett_init()
53 tmp = mpi_alloc(ctx->k + 1); in mpi_barrett_init()
55 /* Barrett precalculation: y = floor(b^(2k) / m). */ in mpi_barrett_init()
56 mpi_set_ui(tmp, 1); in mpi_barrett_init()
57 mpi_lshift_limbs(tmp, 2 * ctx->k); in mpi_barrett_init()
61 ctx->r1 = mpi_alloc(2 * ctx->k + 1); in mpi_barrett_init()
62 ctx->r2 = mpi_alloc(2 * ctx->k + 1); in mpi_barrett_init()
91 * Input: x =(x_2k-1 ...x_0)_b
92 * m =(m_k-1 ....m_0)_b with m_k-1 != 0
98 int k = ctx->k; in mpi_mod_barrett() local
105 if (mpi_get_nlimbs(x) > 2*k) { in mpi_mod_barrett()
113 /* 1. q1 = floor( x / b^k-1) in mpi_mod_barrett()
115 * q3 = floor( q2 / b^k+1 ) in mpi_mod_barrett()
119 mpi_rshift_limbs(r2, k-1); in mpi_mod_barrett()
121 mpi_rshift_limbs(r2, k+1); in mpi_mod_barrett()
123 /* 2. r1 = x mod b^k+1 in mpi_mod_barrett()
124 * r2 = q3 * m mod b^k+1 in mpi_mod_barrett()
126 * 3. if r < 0 then r = r + b^k+1 in mpi_mod_barrett()
129 if (r1->nlimbs > k+1) /* Quick modulo operation. */ in mpi_mod_barrett()
130 r1->nlimbs = k+1; in mpi_mod_barrett()
132 if (r2->nlimbs > k+1) /* Quick modulo operation. */ in mpi_mod_barrett()
133 r2->nlimbs = k+1; in mpi_mod_barrett()
138 ctx->r3 = mpi_alloc(k + 2); in mpi_mod_barrett()
139 mpi_set_ui(ctx->r3, 1); in mpi_mod_barrett()
140 mpi_lshift_limbs(ctx->r3, k + 1); in mpi_mod_barrett()