summaryrefslogtreecommitdiffhomepage
path: root/genrsa.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 /genrsa.c
parent51b5cdd4308f4236d4d1453d482d0086d11a851e (diff)
Add m_mp_alloc_init_multi() helper
--HG-- branch : ecc
Diffstat (limited to 'genrsa.c')
-rw-r--r--genrsa.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/genrsa.c b/genrsa.c
index 465502b..5df191e 100644
--- a/genrsa.c
+++ b/genrsa.c
@@ -50,15 +50,8 @@ dropbear_rsa_key * gen_rsa_priv_key(unsigned int size) {
}
key = m_malloc(sizeof(*key));
-
- key->e = (mp_int*)m_malloc(sizeof(mp_int));
- key->n = (mp_int*)m_malloc(sizeof(mp_int));
- key->d = (mp_int*)m_malloc(sizeof(mp_int));
- key->p = (mp_int*)m_malloc(sizeof(mp_int));
- key->q = (mp_int*)m_malloc(sizeof(mp_int));
-
- m_mp_init_multi(key->e, key->n, key->d, key->p, key->q,
- &pminus, &lcm, &qminus, NULL);
+ m_mp_alloc_init_multi(&key->e, &key->n, &key->d, &key->p, &key->q, NULL);
+ m_mp_init_multi(&pminus, &lcm, &qminus, NULL);
if (mp_set_int(key->e, RSA_E) != MP_OKAY) {
fprintf(stderr, "RSA generation failed\n");