summaryrefslogtreecommitdiffhomepage
path: root/ecc.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-05-23 22:18:16 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-05-23 22:18:16 +0800
commitd9e790e7dc7737158c9affb7087035dd2c31c003 (patch)
tree0e610eace4bd5b3f25812e30b85b0c22063c28ef /ecc.c
parent51b5cdd4308f4236d4d1453d482d0086d11a851e (diff)
Add m_mp_alloc_init_multi() helper
--HG-- branch : ecc
Diffstat (limited to 'ecc.c')
-rw-r--r--ecc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ecc.c b/ecc.c
index 03f8864..3e0763c 100644
--- a/ecc.c
+++ b/ecc.c
@@ -72,11 +72,8 @@ struct dropbear_ecc_curve* curve_for_dp(const ltc_ecc_set_type *dp) {
ecc_key * new_ecc_key(void) {
ecc_key *key = m_malloc(sizeof(*key));
- key->pubkey.x = m_malloc(sizeof(mp_int));
- key->pubkey.y = m_malloc(sizeof(mp_int));
- key->pubkey.z = m_malloc(sizeof(mp_int));
- key->k = m_malloc(sizeof(mp_int));
- m_mp_init_multi(key->pubkey.x, key->pubkey.y, key->pubkey.z, key->k, NULL);
+ m_mp_alloc_init_multi(&key->pubkey.x, &key->pubkey.y,
+ &key->pubkey.z, &key->k, NULL);
return key;
}
@@ -92,7 +89,7 @@ static int ecc_is_point(ecc_key *key)
t1 = m_malloc(sizeof(mp_int));
t2 = m_malloc(sizeof(mp_int));
- m_mp_init_multi(prime, b, t1, t2, NULL);
+ m_mp_alloc_init_multi(&prime, &b, &t1, &t2, NULL);
/* load prime and b */
if ((err = mp_read_radix(prime, key->dp->prime, 16)) != CRYPT_OK) { goto error; }