Mercurial > dropbear
comparison ecc.c @ 762:a78a38e402d1 ecc
- Fix various hardcoded uses of SHA1
- rename curves to nistp256 etc
- fix svr-auth.c TRACE problem
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 08 Apr 2013 00:10:57 +0800 |
parents | ac2158e3e403 |
children | f744321ac048 |
comparison
equal
deleted
inserted
replaced
761:ac2158e3e403 | 762:a78a38e402d1 |
---|---|
7 #ifdef DROPBEAR_ECC | 7 #ifdef DROPBEAR_ECC |
8 | 8 |
9 // TODO: use raw bytes for the dp rather than the hex strings in libtomcrypt's ecc.c | 9 // TODO: use raw bytes for the dp rather than the hex strings in libtomcrypt's ecc.c |
10 | 10 |
11 #ifdef DROPBEAR_ECC_256 | 11 #ifdef DROPBEAR_ECC_256 |
12 const struct dropbear_ecc_curve ecc_curve_secp256r1 = { | 12 const struct dropbear_ecc_curve ecc_curve_nistp256 = { |
13 .dp = <c_ecc_sets[0], | 13 .dp = <c_ecc_sets[0], |
14 .hash_desc = &sha256_desc, | 14 .hash_desc = &sha256_desc, |
15 .name = "secp256r1" | 15 .name = "nistp256" |
16 }; | 16 }; |
17 #endif | 17 #endif |
18 #ifdef DROPBEAR_ECC_384 | 18 #ifdef DROPBEAR_ECC_384 |
19 const struct dropbear_ecc_curve ecc_curve_secp384r1 = { | 19 const struct dropbear_ecc_curve ecc_curve_nistp384 = { |
20 .dp = <c_ecc_sets[1], | 20 .dp = <c_ecc_sets[1], |
21 .hash_desc = &sha384_desc, | 21 .hash_desc = &sha384_desc, |
22 .name = "secp384r1" | 22 .name = "nistp384" |
23 }; | 23 }; |
24 #endif | 24 #endif |
25 #ifdef DROPBEAR_ECC_521 | 25 #ifdef DROPBEAR_ECC_521 |
26 const struct dropbear_ecc_curve ecc_curve_secp521r1 = { | 26 const struct dropbear_ecc_curve ecc_curve_nistp521 = { |
27 .dp = <c_ecc_sets[2], | 27 .dp = <c_ecc_sets[2], |
28 .hash_desc = &sha512_desc, | 28 .hash_desc = &sha512_desc, |
29 .name = "secp521r1" | 29 .name = "nistp521" |
30 }; | 30 }; |
31 #endif | 31 #endif |
32 | 32 |
33 static ecc_key * new_ecc_key(void) { | 33 static ecc_key * new_ecc_key(void) { |
34 ecc_key *key = m_malloc(sizeof(*key)); | 34 ecc_key *key = m_malloc(sizeof(*key)); |
35 key->pubkey.x = m_malloc(sizeof(mp_int)); | 35 key->pubkey.x = m_malloc(sizeof(mp_int)); |
36 key->pubkey.y = m_malloc(sizeof(mp_int)); | 36 key->pubkey.y = m_malloc(sizeof(mp_int)); |
37 key->pubkey.z = m_malloc(sizeof(mp_int)); | 37 key->pubkey.z = m_malloc(sizeof(mp_int)); |
38 key->k = m_malloc(sizeof(mp_init)); | 38 key->k = m_malloc(sizeof(mp_int)); |
39 m_mp_init_multi(key->pubkey.x, key->pubkey.y, key->pubkey.z, key->k, NULL); | 39 m_mp_init_multi(key->pubkey.x, key->pubkey.y, key->pubkey.z, key->k, NULL); |
40 return key; | 40 return key; |
41 } | 41 } |
42 | 42 |
43 void buf_put_ecc_pubkey_string(buffer *buf, ecc_key *key) { | 43 void buf_put_ecc_pubkey_string(buffer *buf, ecc_key *key) { |