Mercurial > dropbear
comparison gensignkey.c @ 1342:8747c2b19152
merge 2017.75
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 18 May 2017 22:59:38 +0800 |
parents | efad433418c4 750ec4ec4cbe |
children | bbc0a0ee3843 |
comparison
equal
deleted
inserted
replaced
1341:ab35a9ccc2eb | 1342:8747c2b19152 |
---|---|
51 | 51 |
52 /* returns 0 on failure */ | 52 /* returns 0 on failure */ |
53 static int get_default_bits(enum signkey_type keytype) | 53 static int get_default_bits(enum signkey_type keytype) |
54 { | 54 { |
55 switch (keytype) { | 55 switch (keytype) { |
56 #ifdef DROPBEAR_RSA | 56 #if DROPBEAR_RSA |
57 case DROPBEAR_SIGNKEY_RSA: | 57 case DROPBEAR_SIGNKEY_RSA: |
58 return RSA_DEFAULT_SIZE; | 58 return RSA_DEFAULT_SIZE; |
59 #endif | 59 #endif |
60 #ifdef DROPBEAR_DSS | 60 #if DROPBEAR_DSS |
61 case DROPBEAR_SIGNKEY_DSS: | 61 case DROPBEAR_SIGNKEY_DSS: |
62 return DSS_DEFAULT_SIZE; | 62 return DSS_DEFAULT_SIZE; |
63 #endif | 63 #endif |
64 #ifdef DROPBEAR_ECDSA | 64 #if DROPBEAR_ECDSA |
65 case DROPBEAR_SIGNKEY_ECDSA_KEYGEN: | 65 case DROPBEAR_SIGNKEY_ECDSA_KEYGEN: |
66 return ECDSA_DEFAULT_SIZE; | 66 return ECDSA_DEFAULT_SIZE; |
67 case DROPBEAR_SIGNKEY_ECDSA_NISTP521: | 67 case DROPBEAR_SIGNKEY_ECDSA_NISTP521: |
68 return 521; | 68 return 521; |
69 case DROPBEAR_SIGNKEY_ECDSA_NISTP384: | 69 case DROPBEAR_SIGNKEY_ECDSA_NISTP384: |
92 key = new_sign_key(); | 92 key = new_sign_key(); |
93 | 93 |
94 seedrandom(); | 94 seedrandom(); |
95 | 95 |
96 switch(keytype) { | 96 switch(keytype) { |
97 #ifdef DROPBEAR_RSA | 97 #if DROPBEAR_RSA |
98 case DROPBEAR_SIGNKEY_RSA: | 98 case DROPBEAR_SIGNKEY_RSA: |
99 key->rsakey = gen_rsa_priv_key(bits); | 99 key->rsakey = gen_rsa_priv_key(bits); |
100 break; | 100 break; |
101 #endif | 101 #endif |
102 #ifdef DROPBEAR_DSS | 102 #if DROPBEAR_DSS |
103 case DROPBEAR_SIGNKEY_DSS: | 103 case DROPBEAR_SIGNKEY_DSS: |
104 key->dsskey = gen_dss_priv_key(bits); | 104 key->dsskey = gen_dss_priv_key(bits); |
105 break; | 105 break; |
106 #endif | 106 #endif |
107 #ifdef DROPBEAR_ECDSA | 107 #if DROPBEAR_ECDSA |
108 case DROPBEAR_SIGNKEY_ECDSA_KEYGEN: | 108 case DROPBEAR_SIGNKEY_ECDSA_KEYGEN: |
109 case DROPBEAR_SIGNKEY_ECDSA_NISTP521: | 109 case DROPBEAR_SIGNKEY_ECDSA_NISTP521: |
110 case DROPBEAR_SIGNKEY_ECDSA_NISTP384: | 110 case DROPBEAR_SIGNKEY_ECDSA_NISTP384: |
111 case DROPBEAR_SIGNKEY_ECDSA_NISTP256: | 111 case DROPBEAR_SIGNKEY_ECDSA_NISTP256: |
112 { | 112 { |