comparison libtommath/bn_mp_init_copy.c @ 608:4fbf9a7556ed

Use mp_init_size() to avoid some mp_grow()s
author Matt Johnston <matt@ucc.asn.au>
date Fri, 18 Mar 2011 14:31:07 +0000
parents 5ff8218bcee9
children 60fc6476e044
comparison
equal deleted inserted replaced
607:aa2f51a6b81d 608:4fbf9a7556ed
18 /* creates "a" then copies b into it */ 18 /* creates "a" then copies b into it */
19 int mp_init_copy (mp_int * a, mp_int * b) 19 int mp_init_copy (mp_int * a, mp_int * b)
20 { 20 {
21 int res; 21 int res;
22 22
23 if ((res = mp_init (a)) != MP_OKAY) { 23 if ((res = mp_init_size (a, b->used)) != MP_OKAY) {
24 return res; 24 return res;
25 } 25 }
26 return mp_copy (b, a); 26 return mp_copy (b, a);
27 } 27 }
28 #endif 28 #endif