diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-05-23 22:18:16 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-05-23 22:18:16 +0800 |
commit | d9e790e7dc7737158c9affb7087035dd2c31c003 (patch) | |
tree | 0e610eace4bd5b3f25812e30b85b0c22063c28ef /genrsa.c | |
parent | 51b5cdd4308f4236d4d1453d482d0086d11a851e (diff) |
Add m_mp_alloc_init_multi() helper
--HG--
branch : ecc
Diffstat (limited to 'genrsa.c')
-rw-r--r-- | genrsa.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -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"); |