Home
last modified time | relevance | path

Searched refs:nlimbs (Results 1 – 13 of 13) sorted by relevance

/Linux-v6.1/lib/mpi/
Dmpi-bit.c32 for (; a->nlimbs && !a->d[a->nlimbs - 1]; a->nlimbs--) in mpi_normalize()
46 if (a->nlimbs) { in mpi_get_nbits()
47 mpi_limb_t alimb = a->d[a->nlimbs - 1]; in mpi_get_nbits()
52 n = BITS_PER_MPI_LIMB - n + (a->nlimbs - 1) * BITS_PER_MPI_LIMB; in mpi_get_nbits()
70 if (limbno >= a->nlimbs) in mpi_test_bit()
87 if (limbno >= a->nlimbs) { in mpi_set_bit()
88 for (i = a->nlimbs; i < a->alloced; i++) in mpi_set_bit()
91 a->nlimbs = limbno+1; in mpi_set_bit()
106 if (limbno >= a->nlimbs) { in mpi_set_highbit()
107 for (i = a->nlimbs; i < a->alloced; i++) in mpi_set_highbit()
[all …]
Dmpiutil.c87 MPI mpi_alloc(unsigned nlimbs) in mpi_alloc() argument
95 if (nlimbs) { in mpi_alloc()
96 a->d = mpi_alloc_limb_space(nlimbs); in mpi_alloc()
105 a->alloced = nlimbs; in mpi_alloc()
106 a->nlimbs = 0; in mpi_alloc()
114 mpi_ptr_t mpi_alloc_limb_space(unsigned nlimbs) in mpi_alloc_limb_space() argument
116 size_t len = nlimbs * sizeof(mpi_limb_t); in mpi_alloc_limb_space()
132 void mpi_assign_limb_space(MPI a, mpi_ptr_t ap, unsigned nlimbs) in mpi_assign_limb_space() argument
136 a->alloced = nlimbs; in mpi_assign_limb_space()
143 int mpi_resize(MPI a, unsigned nlimbs) in mpi_resize() argument
[all …]
Dmpi-sub-ui.c39 if (u->nlimbs == 0) { in mpi_sub_ui()
43 w->nlimbs = (vval != 0); in mpi_sub_ui()
49 if (mpi_resize(w, u->nlimbs + 1)) in mpi_sub_ui()
55 cy = mpihelp_add_1(w->d, u->d, u->nlimbs, (mpi_limb_t) vval); in mpi_sub_ui()
56 w->d[u->nlimbs] = cy; in mpi_sub_ui()
57 w->nlimbs = u->nlimbs + cy; in mpi_sub_ui()
63 if (u->nlimbs == 1 && u->d[0] < vval) { in mpi_sub_ui()
65 w->nlimbs = 1; in mpi_sub_ui()
68 mpihelp_sub_1(w->d, u->d, u->nlimbs, (mpi_limb_t) vval); in mpi_sub_ui()
70 w->nlimbs = (u->nlimbs - (w->d[u->nlimbs - 1] == 0)); in mpi_sub_ui()
Dmpi-mul.c25 if (u->nlimbs < v->nlimbs) { in mpi_mul()
27 usize = v->nlimbs; in mpi_mul()
30 vsize = u->nlimbs; in mpi_mul()
34 usize = u->nlimbs; in mpi_mul()
37 vsize = v->nlimbs; in mpi_mul()
80 w->nlimbs = wsize; in mpi_mul()
Dmpi-div.c36 if (((divisor_sign?1:0) ^ (dividend->sign?1:0)) && rem->nlimbs) in mpi_fdiv_r()
62 if ((divisor_sign ^ dividend->sign) && rem->nlimbs) { in mpi_fdiv_qr()
87 mpi_size_t nsize = num->nlimbs; in mpi_tdiv_qr()
88 mpi_size_t dsize = den->nlimbs; in mpi_tdiv_qr()
107 rem->nlimbs = num->nlimbs; in mpi_tdiv_qr()
115 quot->nlimbs = 0; in mpi_tdiv_qr()
136 quot->nlimbs = qsize; in mpi_tdiv_qr()
142 rem->nlimbs = rsize; in mpi_tdiv_qr()
216 quot->nlimbs = qsize; in mpi_tdiv_qr()
228 rem->nlimbs = rsize; in mpi_tdiv_qr()
Dmpi-add.c26 usize = u->nlimbs; in mpi_add_ui()
62 w->nlimbs = wsize; in mpi_add_ui()
73 if (u->nlimbs < v->nlimbs) { /* Swap U and V. */ in mpi_add()
74 usize = v->nlimbs; in mpi_add()
76 vsize = u->nlimbs; in mpi_add()
84 usize = u->nlimbs; in mpi_add()
86 vsize = v->nlimbs; in mpi_add()
129 w->nlimbs = wsize; in mpi_add()
Dmpicoder.c40 unsigned nbits, nlimbs; in mpi_read_raw_data() local
57 nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB); in mpi_read_raw_data()
58 val = mpi_alloc(nlimbs); in mpi_read_raw_data()
63 val->nlimbs = nlimbs; in mpi_read_raw_data()
68 for (j = nlimbs; j > 0; j--) { in mpi_read_raw_data()
121 unsigned int nbits, nbytes, nlimbs; in mpi_fromstr() local
143 nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB; in mpi_fromstr()
145 if (val->alloced < nlimbs) in mpi_fromstr()
146 mpi_resize(val, nlimbs); in mpi_fromstr()
150 j = val->nlimbs = nlimbs; in mpi_fromstr()
[all …]
Dec.c90 size_t nlimbs = ctx->p->nlimbs; in point_resize() local
92 mpi_resize(p->x, nlimbs); in point_resize()
93 p->x->nlimbs = nlimbs; in point_resize()
94 mpi_resize(p->z, nlimbs); in point_resize()
95 p->z->nlimbs = nlimbs; in point_resize()
98 mpi_resize(p->y, nlimbs); in point_resize()
99 p->y->nlimbs = nlimbs; in point_resize()
206 if (w->nlimbs != wsize || u->nlimbs != wsize || v->nlimbs != wsize) in ec_addm_25519()
228 if (w->nlimbs != wsize || u->nlimbs != wsize || v->nlimbs != wsize) in ec_subm_25519()
252 if (w->nlimbs != wsize || u->nlimbs != wsize || v->nlimbs != wsize) in ec_mulm_25519()
[all …]
Dmpi-cmp.c28 if (!u->nlimbs && !limb) in mpi_cmp_ui()
32 if (u->nlimbs > 1) in mpi_cmp_ui()
55 usize = u->nlimbs; in do_mpi_cmp()
56 vsize = v->nlimbs; in do_mpi_cmp()
Dmpi-pow.c41 esize = exp->nlimbs; in mpi_powm()
42 msize = mod->nlimbs; in mpi_powm()
55 res->nlimbs = (msize == 1 && mod->d[0] == 1) ? 0 : 1; in mpi_powm()
56 if (res->nlimbs) { in mpi_powm()
79 bsize = base->nlimbs; in mpi_powm()
99 res->nlimbs = 0; in mpi_powm()
293 res->nlimbs = rsize; in mpi_powm()
Dmpi-mod.c129 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()
Dmpi-internal.h142 mpi_ptr_t mpi_alloc_limb_space(unsigned nlimbs);
144 void mpi_assign_limb_space(MPI a, mpi_ptr_t ap, unsigned nlimbs);
/Linux-v6.1/include/linux/
Dmpi.h31 int nlimbs; /* number of valid limbs */ member
42 #define mpi_get_nlimbs(a) ((a)->nlimbs)
46 MPI mpi_alloc(unsigned nlimbs);
49 int mpi_resize(MPI a, unsigned nlimbs);
276 return a->nlimbs * BYTES_PER_MPI_LIMB; in mpi_get_size()