diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-09-12 11:14:33 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-09-12 11:14:33 -0400 |
commit | 25a765b7f05cb8460fa01b54568894b20e184862 (patch) | |
tree | 0b56db57b4d9f912393ab303c269e0fe6cdf8635 /lib/mpi/mpiutil.c | |
parent | 9d2be9287107695708e6aae5105a8a518a6cb4d0 (diff) | |
parent | 64282278989d5b0398dcb3ba7904cb00c621dc35 (diff) |
Merge branch 'x86/platform' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into stable/for-linus-3.7
* 'x86/platform' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (9690 commits)
x86: Document x86_init.paging.pagetable_init()
x86: xen: Cleanup and remove x86_init.paging.pagetable_setup_done()
x86: Move paging_init() call to x86_init.paging.pagetable_init()
x86: Rename pagetable_setup_start() to pagetable_init()
x86: Remove base argument from x86_init.paging.pagetable_setup_start
Linux 3.6-rc5
HID: tpkbd: work even if the new Lenovo Keyboard driver is not configured
Remove user-triggerable BUG from mpol_to_str
xen/pciback: Fix proper FLR steps.
uml: fix compile error in deliver_alarm()
dj: memory scribble in logi_dj
Fix order of arguments to compat_put_time[spec|val]
xen: Use correct masking in xen_swiotlb_alloc_coherent.
xen: fix logical error in tlb flushing
xen/p2m: Fix one-off error in checking the P2M tree directory.
powerpc: Don't use __put_user() in patch_instruction
powerpc: Make sure IPI handlers see data written by IPI senders
powerpc: Restore correct DSCR in context switch
powerpc: Fix DSCR inheritance in copy_thread()
powerpc: Keep thread.dscr and thread.dscr_inherit in sync
...
Diffstat (limited to 'lib/mpi/mpiutil.c')
-rw-r--r-- | lib/mpi/mpiutil.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c index 26e4ed31e256..657979f71bef 100644 --- a/lib/mpi/mpiutil.c +++ b/lib/mpi/mpiutil.c | |||
@@ -106,13 +106,6 @@ int mpi_resize(MPI a, unsigned nlimbs) | |||
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | void mpi_clear(MPI a) | ||
110 | { | ||
111 | a->nlimbs = 0; | ||
112 | a->nbits = 0; | ||
113 | a->flags = 0; | ||
114 | } | ||
115 | |||
116 | void mpi_free(MPI a) | 109 | void mpi_free(MPI a) |
117 | { | 110 | { |
118 | if (!a) | 111 | if (!a) |
@@ -128,84 +121,3 @@ void mpi_free(MPI a) | |||
128 | kfree(a); | 121 | kfree(a); |
129 | } | 122 | } |
130 | EXPORT_SYMBOL_GPL(mpi_free); | 123 | EXPORT_SYMBOL_GPL(mpi_free); |
131 | |||
132 | /**************** | ||
133 | * Note: This copy function should not interpret the MPI | ||
134 | * but copy it transparently. | ||
135 | */ | ||
136 | int mpi_copy(MPI *copied, const MPI a) | ||
137 | { | ||
138 | size_t i; | ||
139 | MPI b; | ||
140 | |||
141 | *copied = NULL; | ||
142 | |||
143 | if (a) { | ||
144 | b = mpi_alloc(a->nlimbs); | ||
145 | if (!b) | ||
146 | return -ENOMEM; | ||
147 | |||
148 | b->nlimbs = a->nlimbs; | ||
149 | b->sign = a->sign; | ||
150 | b->flags = a->flags; | ||
151 | b->nbits = a->nbits; | ||
152 | |||
153 | for (i = 0; i < b->nlimbs; i++) | ||
154 | b->d[i] = a->d[i]; | ||
155 | |||
156 | *copied = b; | ||
157 | } | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | int mpi_set(MPI w, const MPI u) | ||
163 | { | ||
164 | mpi_ptr_t wp, up; | ||
165 | mpi_size_t usize = u->nlimbs; | ||
166 | int usign = u->sign; | ||
167 | |||
168 | if (RESIZE_IF_NEEDED(w, (size_t) usize) < 0) | ||
169 | return -ENOMEM; | ||
170 | |||
171 | wp = w->d; | ||
172 | up = u->d; | ||
173 | MPN_COPY(wp, up, usize); | ||
174 | w->nlimbs = usize; | ||
175 | w->nbits = u->nbits; | ||
176 | w->flags = u->flags; | ||
177 | w->sign = usign; | ||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | int mpi_set_ui(MPI w, unsigned long u) | ||
182 | { | ||
183 | if (RESIZE_IF_NEEDED(w, 1) < 0) | ||
184 | return -ENOMEM; | ||
185 | w->d[0] = u; | ||
186 | w->nlimbs = u ? 1 : 0; | ||
187 | w->sign = 0; | ||
188 | w->nbits = 0; | ||
189 | w->flags = 0; | ||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | MPI mpi_alloc_set_ui(unsigned long u) | ||
194 | { | ||
195 | MPI w = mpi_alloc(1); | ||
196 | if (!w) | ||
197 | return w; | ||
198 | w->d[0] = u; | ||
199 | w->nlimbs = u ? 1 : 0; | ||
200 | w->sign = 0; | ||
201 | return w; | ||
202 | } | ||
203 | |||
204 | void mpi_swap(MPI a, MPI b) | ||
205 | { | ||
206 | struct gcry_mpi tmp; | ||
207 | |||
208 | tmp = *a; | ||
209 | *a = *b; | ||
210 | *b = tmp; | ||
211 | } | ||