comparison gendss.c @ 839:33207ed1174b

Merge in ECC
author Matt Johnston <matt@ucc.asn.au>
date Mon, 21 Oct 2013 22:57:21 +0800
parents 724c3e0c8734
children 220f55d540ae
comparison
equal deleted inserted replaced
834:e378da7eae5d 839:33207ed1174b
45 45
46 dropbear_dss_key * gen_dss_priv_key(unsigned int size) { 46 dropbear_dss_key * gen_dss_priv_key(unsigned int size) {
47 47
48 dropbear_dss_key *key; 48 dropbear_dss_key *key;
49 49
50 if (size != 1024) {
51 dropbear_exit("DSS keys have a fixed size of 1024 bits");
52 }
53
50 key = m_malloc(sizeof(*key)); 54 key = m_malloc(sizeof(*key));
51 55
52 key->p = (mp_int*)m_malloc(sizeof(mp_int)); 56 m_mp_alloc_init_multi(&key->p, &key->q, &key->g, &key->y, &key->x, NULL);
53 key->q = (mp_int*)m_malloc(sizeof(mp_int));
54 key->g = (mp_int*)m_malloc(sizeof(mp_int));
55 key->y = (mp_int*)m_malloc(sizeof(mp_int));
56 key->x = (mp_int*)m_malloc(sizeof(mp_int));
57 m_mp_init_multi(key->p, key->q, key->g, key->y, key->x, NULL);
58
59 seedrandom();
60 57
61 getq(key); 58 getq(key);
62 getp(key, size); 59 getp(key, size/8);
63 getg(key); 60 getg(key);
64 getx(key); 61 getx(key);
65 gety(key); 62 gety(key);
66 63
67 return key; 64 return key;