Mercurial > dropbear
comparison common-algo.c @ 641:2b1bb792cd4d dropbear-tfm
- Update tfm changes to current default tip
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 21 Nov 2011 19:52:28 +0800 |
parents | 2895626d864f |
children | 03073a27abb3 4edea9f363d0 |
comparison
equal
deleted
inserted
replaced
640:76097ec1a29a | 641:2b1bb792cd4d |
---|---|
29 /* This file (algo.c) organises the ciphers which can be used, and is used to | 29 /* This file (algo.c) organises the ciphers which can be used, and is used to |
30 * decide which ciphers/hashes/compression/signing to use during key exchange*/ | 30 * decide which ciphers/hashes/compression/signing to use during key exchange*/ |
31 | 31 |
32 static int void_cipher(const unsigned char* in, unsigned char* out, | 32 static int void_cipher(const unsigned char* in, unsigned char* out, |
33 unsigned long len, void *cipher_state) { | 33 unsigned long len, void *cipher_state) { |
34 memcpy(out, in, len); | 34 if (in != out) { |
35 memmove(out, in, len); | |
36 } | |
35 return CRYPT_OK; | 37 return CRYPT_OK; |
36 } | 38 } |
37 | 39 |
38 static int void_start(int cipher, const unsigned char *IV, | 40 static int void_start(int cipher, const unsigned char *IV, |
39 const unsigned char *key, | 41 const unsigned char *key, |
164 {"hmac-md5", 0, &dropbear_md5, 1, NULL}, | 166 {"hmac-md5", 0, &dropbear_md5, 1, NULL}, |
165 #endif | 167 #endif |
166 {NULL, 0, NULL, 0, NULL} | 168 {NULL, 0, NULL, 0, NULL} |
167 }; | 169 }; |
168 | 170 |
169 algo_type sshcompress[] = { | |
170 #ifndef DISABLE_ZLIB | 171 #ifndef DISABLE_ZLIB |
172 algo_type ssh_compress[] = { | |
171 {"zlib", DROPBEAR_COMP_ZLIB, NULL, 1, NULL}, | 173 {"zlib", DROPBEAR_COMP_ZLIB, NULL, 1, NULL}, |
172 {"[email protected]", DROPBEAR_COMP_ZLIB_DELAY, NULL, 1, NULL}, | 174 {"[email protected]", DROPBEAR_COMP_ZLIB_DELAY, NULL, 1, NULL}, |
173 #endif | 175 {"none", DROPBEAR_COMP_NONE, NULL, 1, NULL}, |
176 {NULL, 0, NULL, 0, NULL} | |
177 }; | |
178 #endif | |
179 | |
180 algo_type ssh_nocompress[] = { | |
174 {"none", DROPBEAR_COMP_NONE, NULL, 1, NULL}, | 181 {"none", DROPBEAR_COMP_NONE, NULL, 1, NULL}, |
175 {NULL, 0, NULL, 0, NULL} | 182 {NULL, 0, NULL, 0, NULL} |
176 }; | 183 }; |
177 | 184 |
178 algo_type sshhostkey[] = { | 185 algo_type sshhostkey[] = { |
185 {NULL, 0, NULL, 0, NULL} | 192 {NULL, 0, NULL, 0, NULL} |
186 }; | 193 }; |
187 | 194 |
188 algo_type sshkex[] = { | 195 algo_type sshkex[] = { |
189 {"diffie-hellman-group1-sha1", DROPBEAR_KEX_DH_GROUP1, NULL, 1, NULL}, | 196 {"diffie-hellman-group1-sha1", DROPBEAR_KEX_DH_GROUP1, NULL, 1, NULL}, |
197 {"diffie-hellman-group14-sha1", DROPBEAR_KEX_DH_GROUP14, NULL, 1, NULL}, | |
190 {NULL, 0, NULL, 0, NULL} | 198 {NULL, 0, NULL, 0, NULL} |
191 }; | 199 }; |
192 | 200 |
193 | 201 |
194 /* Register the compiled in ciphers. | 202 /* Register the compiled in ciphers. |
221 }; | 229 }; |
222 int i; | 230 int i; |
223 | 231 |
224 for (i = 0; regciphers[i] != NULL; i++) { | 232 for (i = 0; regciphers[i] != NULL; i++) { |
225 if (register_cipher(regciphers[i]) == -1) { | 233 if (register_cipher(regciphers[i]) == -1) { |
226 dropbear_exit("error registering crypto"); | 234 dropbear_exit("Error registering crypto"); |
227 } | 235 } |
228 } | 236 } |
229 | 237 |
230 for (i = 0; reghashes[i] != NULL; i++) { | 238 for (i = 0; reghashes[i] != NULL; i++) { |
231 if (register_hash(reghashes[i]) == -1) { | 239 if (register_hash(reghashes[i]) == -1) { |
232 dropbear_exit("error registering crypto"); | 240 dropbear_exit("Error registering crypto"); |
233 } | 241 } |
234 } | 242 } |
235 } | 243 } |
236 | 244 |
237 /* algolen specifies the length of algo, algos is our local list to match | 245 /* algolen specifies the length of algo, algos is our local list to match |