comparison genrsa.c @ 84:29a5c7c62350

default initialisers for mp_ints
author Matt Johnston <matt@ucc.asn.au>
date Tue, 17 Aug 2004 10:20:20 +0000
parents fe6bca95afa7
children c9483550701b
comparison
equal deleted inserted replaced
83:6539c9480b23 84:29a5c7c62350
38 38
39 /* mostly taken from libtomcrypt's rsa key generation routine */ 39 /* mostly taken from libtomcrypt's rsa key generation routine */
40 rsa_key * gen_rsa_priv_key(unsigned int size) { 40 rsa_key * gen_rsa_priv_key(unsigned int size) {
41 41
42 rsa_key * key; 42 rsa_key * key;
43 mp_int pminus, qminus, lcm; 43 DEF_MP_INT(pminus);
44 DEF_MP_INT(qminus);
45 DEF_MP_INT(lcm);
44 46
45 key = (rsa_key*)m_malloc(sizeof(rsa_key)); 47 key = (rsa_key*)m_malloc(sizeof(rsa_key));
46 48
47 key->e = (mp_int*)m_malloc(sizeof(mp_int)); 49 key->e = (mp_int*)m_malloc(sizeof(mp_int));
48 key->n = (mp_int*)m_malloc(sizeof(mp_int)); 50 key->n = (mp_int*)m_malloc(sizeof(mp_int));
93 /* return a prime suitable for p or q */ 95 /* return a prime suitable for p or q */
94 static void getrsaprime(mp_int* prime, mp_int *primeminus, 96 static void getrsaprime(mp_int* prime, mp_int *primeminus,
95 mp_int* rsa_e, unsigned int size) { 97 mp_int* rsa_e, unsigned int size) {
96 98
97 unsigned char *buf; 99 unsigned char *buf;
98 mp_int temp_gcd; 100 DEF_MP_INT(temp_gcd);
99 101
100 buf = (unsigned char*)m_malloc(size+1); 102 buf = (unsigned char*)m_malloc(size+1);
101 103
102 m_mp_init(&temp_gcd); 104 m_mp_init(&temp_gcd);
103 do { 105 do {