Lines Matching full:a
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * You should have received a copy of the GNU General Public License
26 * Note: It was a bad idea to use the number of limbs to allocate
27 * because on a alpha the limbs are large but we normally need
30 * But mpi_alloc is used in a lot of places :-)
34 MPI a; in mpi_alloc() local
36 a = kmalloc(sizeof *a, GFP_KERNEL); in mpi_alloc()
37 if (!a) in mpi_alloc()
38 return a; in mpi_alloc()
41 a->d = mpi_alloc_limb_space(nlimbs); in mpi_alloc()
42 if (!a->d) { in mpi_alloc()
43 kfree(a); in mpi_alloc()
47 a->d = NULL; in mpi_alloc()
50 a->alloced = nlimbs; in mpi_alloc()
51 a->nlimbs = 0; in mpi_alloc()
52 a->sign = 0; in mpi_alloc()
53 a->flags = 0; in mpi_alloc()
54 a->nbits = 0; in mpi_alloc()
55 return a; in mpi_alloc()
69 void mpi_free_limb_space(mpi_ptr_t a) in mpi_free_limb_space() argument
71 if (!a) in mpi_free_limb_space()
74 kfree_sensitive(a); in mpi_free_limb_space()
77 void mpi_assign_limb_space(MPI a, mpi_ptr_t ap, unsigned nlimbs) in mpi_assign_limb_space() argument
79 mpi_free_limb_space(a->d); in mpi_assign_limb_space()
80 a->d = ap; in mpi_assign_limb_space()
81 a->alloced = nlimbs; in mpi_assign_limb_space()
85 * Resize the array of A to NLIMBS. the additional space is cleared
88 int mpi_resize(MPI a, unsigned nlimbs) in mpi_resize() argument
92 if (nlimbs <= a->alloced) in mpi_resize()
95 if (a->d) { in mpi_resize()
99 memcpy(p, a->d, a->alloced * sizeof(mpi_limb_t)); in mpi_resize()
100 kfree_sensitive(a->d); in mpi_resize()
101 a->d = p; in mpi_resize()
103 a->d = kcalloc(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL); in mpi_resize()
104 if (!a->d) in mpi_resize()
107 a->alloced = nlimbs; in mpi_resize()
111 void mpi_free(MPI a) in mpi_free() argument
113 if (!a) in mpi_free()
116 if (a->flags & 4) in mpi_free()
117 kfree_sensitive(a->d); in mpi_free()
119 mpi_free_limb_space(a->d); in mpi_free()
121 if (a->flags & ~7) in mpi_free()
123 kfree(a); in mpi_free()
131 MPI mpi_copy(MPI a) in mpi_copy() argument
136 if (a) { in mpi_copy()
137 b = mpi_alloc(a->nlimbs); in mpi_copy()
140 b->nlimbs = a->nlimbs; in mpi_copy()
141 b->sign = a->sign; in mpi_copy()
142 b->flags = a->flags; in mpi_copy()
145 b->d[i] = a->d[i]; in mpi_copy()