Mercurial > dropbear
comparison ecdsa.c @ 795:7f604f9b3756 ecc
ecdsa is working
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 03 May 2013 23:07:48 +0800 |
parents | d386defb5376 |
children | 069b875031f5 |
comparison
equal
deleted
inserted
replaced
794:d386defb5376 | 795:7f604f9b3756 |
---|---|
2 #include "includes.h" | 2 #include "includes.h" |
3 #include "dbutil.h" | 3 #include "dbutil.h" |
4 #include "crypto_desc.h" | 4 #include "crypto_desc.h" |
5 #include "ecc.h" | 5 #include "ecc.h" |
6 #include "ecdsa.h" | 6 #include "ecdsa.h" |
7 #include "signkey.h" | |
7 | 8 |
8 #ifdef DROPBEAR_ECDSA | 9 #ifdef DROPBEAR_ECDSA |
10 | |
11 enum signkey_type ecdsa_signkey_type(ecc_key * key) { | |
12 #ifdef DROPBEAR_ECC_256 | |
13 if (key->dp == ecc_curve_nistp256.dp) { | |
14 return DROPBEAR_SIGNKEY_ECDSA_NISTP256; | |
15 } | |
16 #endif | |
17 #ifdef DROPBEAR_ECC_384 | |
18 if (key->dp == ecc_curve_nistp384.dp) { | |
19 return DROPBEAR_SIGNKEY_ECDSA_NISTP384; | |
20 } | |
21 #endif | |
22 #ifdef DROPBEAR_ECC_521 | |
23 if (key->dp == ecc_curve_nistp521.dp) { | |
24 return DROPBEAR_SIGNKEY_ECDSA_NISTP521; | |
25 } | |
26 #endif | |
27 return DROPBEAR_SIGNKEY_NONE; | |
28 } | |
9 | 29 |
10 ecc_key *gen_ecdsa_priv_key(unsigned int bit_size) { | 30 ecc_key *gen_ecdsa_priv_key(unsigned int bit_size) { |
11 const ltc_ecc_set_type *dp = NULL; // curve domain parameters | 31 const ltc_ecc_set_type *dp = NULL; // curve domain parameters |
12 switch (bit_size) { | 32 switch (bit_size) { |
13 #ifdef DROPBEAR_ECC_256 | 33 #ifdef DROPBEAR_ECC_256 |