Mercurial > dropbear
comparison libtommath/bn_mp_mulmod.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 |
---|---|
19 int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) | 19 int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) |
20 { | 20 { |
21 int res; | 21 int res; |
22 mp_int t; | 22 mp_int t; |
23 | 23 |
24 if ((res = mp_init (&t)) != MP_OKAY) { | 24 if ((res = mp_init_size (&t, c->used)) != MP_OKAY) { |
25 return res; | 25 return res; |
26 } | 26 } |
27 | 27 |
28 if ((res = mp_mul (a, b, &t)) != MP_OKAY) { | 28 if ((res = mp_mul (a, b, &t)) != MP_OKAY) { |
29 mp_clear (&t); | 29 mp_clear (&t); |