comparison common-algo.c @ 759:76fba0856749 ecc

More changes for KEX and ECDH. Set up hash descriptors, make ECC code work, ses.hash and ses.session_id are now buffers (doesn't compile)
author Matt Johnston <matt@ucc.asn.au>
date Fri, 29 Mar 2013 00:28:09 +0800
parents bf9dc2d9c2b1
children ac2158e3e403
comparison
equal deleted inserted replaced
758:1c607a62d235 759:76fba0856749
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE. */ 24 * SOFTWARE. */
25 25
26 #include "algo.h" 26 #include "algo.h"
27 #include "dbutil.h" 27 #include "dbutil.h"
28 #include "kex.h"
28 29
29 /* This file (algo.c) organises the ciphers which can be used, and is used to 30 /* 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*/ 31 * decide which ciphers/hashes/compression/signing to use during key exchange*/
31 32
32 static int void_cipher(const unsigned char* in, unsigned char* out, 33 static int void_cipher(const unsigned char* in, unsigned char* out,
210 {"ssh-dss", DROPBEAR_SIGNKEY_DSS, NULL, 1, NULL}, 211 {"ssh-dss", DROPBEAR_SIGNKEY_DSS, NULL, 1, NULL},
211 #endif 212 #endif
212 {NULL, 0, NULL, 0, NULL} 213 {NULL, 0, NULL, 0, NULL}
213 }; 214 };
214 215
215 static struct dropbear_kex kex_dh_group1 {dh_p_1, DH_P_1_LEN, NULL, sha1_desc }; 216 static struct dropbear_kex kex_dh_group1 = {dh_p_1, DH_P_1_LEN, NULL, &sha1_desc };
216 static struct dropbear_kex kex_dh_group14 {dh_p_14, DH_P_14_LEN, NULL, sha1_desc }; 217 static struct dropbear_kex kex_dh_group14 = {dh_p_14, DH_P_14_LEN, NULL, &sha1_desc };
217 218
218 #ifdef DROPBEAR_ECC_DH 219 #ifdef DROPBEAR_ECC_DH
219 #ifdef DROPBEAR_ECC_256 220 #ifdef DROPBEAR_ECC_256
220 static struct dropbear_kex kex_ecdh_secp256r1 {NULL, 0, &ecc_curve_secp256r1, sha256_desc }; 221 static struct dropbear_kex kex_ecdh_secp256r1 = {NULL, 0, &ecc_curve_secp256r1, &sha256_desc };
221 #endif 222 #endif
222 #ifdef DROPBEAR_ECC_384 223 #ifdef DROPBEAR_ECC_384
223 static struct dropbear_kex kex_ecdh_secp384r1 {NULL, 0, &ecc_curve_secp384r1, sha384_desc }; 224 static struct dropbear_kex kex_ecdh_secp384r1 = {NULL, 0, &ecc_curve_secp384r1, &sha384_desc };
224 #endif 225 #endif
225 #ifdef DROPBEAR_ECC_521 226 #ifdef DROPBEAR_ECC_521
226 static struct dropbear_kex kex_ecdh_secp521r1 {NULL, 0, &ecc_curve_secp521r1, sha512_desc }; 227 static struct dropbear_kex kex_ecdh_secp521r1 = {NULL, 0, &ecc_curve_secp521r1, &sha512_desc };
227 #endif 228 #endif
228 #endif // DROPBEAR_ECC_DH 229 #endif // DROPBEAR_ECC_DH
229 230
230 231
231 algo_type sshkex[] = { 232 algo_type sshkex[] = {
270 /* we need sha1 for hostkey stuff regardless */ 271 /* we need sha1 for hostkey stuff regardless */
271 &sha1_desc, 272 &sha1_desc,
272 #ifdef DROPBEAR_MD5_HMAC 273 #ifdef DROPBEAR_MD5_HMAC
273 &md5_desc, 274 &md5_desc,
274 #endif 275 #endif
275 #ifdef DROPBEAR_SHA2_256_HMAC 276 #ifdef DROPBEAR_SHA256
276 &sha256_desc, 277 &sha256_desc,
277 #endif 278 #endif
278 #ifdef DROPBEAR_SHA2_512_HMAC 279 #ifdef DROPBEAR_SHA384
280 &sha384_desc,
281 #endif
282 #ifdef DROPBEAR_SHA512
279 &sha512_desc, 283 &sha512_desc,
280 #endif 284 #endif
281 NULL 285 NULL
282 }; 286 };
283 int i; 287 int i;