Mercurial > dropbear
comparison signkey.h @ 844:68facbc41273
merge again
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 01 Nov 2013 00:19:25 +0800 |
parents | 75509065db53 |
children | d4ce5269a439 |
comparison
equal
deleted
inserted
replaced
834:e378da7eae5d | 844:68facbc41273 |
---|---|
27 | 27 |
28 #include "buffer.h" | 28 #include "buffer.h" |
29 #include "dss.h" | 29 #include "dss.h" |
30 #include "rsa.h" | 30 #include "rsa.h" |
31 | 31 |
32 enum signkey_type { | |
33 #ifdef DROPBEAR_RSA | |
34 DROPBEAR_SIGNKEY_RSA, | |
35 #endif | |
36 #ifdef DROPBEAR_DSS | |
37 DROPBEAR_SIGNKEY_DSS, | |
38 #endif | |
39 #ifdef DROPBEAR_ECDSA | |
40 DROPBEAR_SIGNKEY_ECDSA_NISTP256, | |
41 DROPBEAR_SIGNKEY_ECDSA_NISTP384, | |
42 DROPBEAR_SIGNKEY_ECDSA_NISTP521, | |
43 DROPBEAR_SIGNKEY_ECDSA_KEYGEN, // just "ecdsa" for keygen | |
44 #endif // DROPBEAR_ECDSA | |
45 DROPBEAR_SIGNKEY_NUM_NAMED, | |
46 DROPBEAR_SIGNKEY_ANY = 80, | |
47 DROPBEAR_SIGNKEY_NONE = 90, | |
48 }; | |
49 | |
32 | 50 |
33 /* Sources for signing keys */ | 51 /* Sources for signing keys */ |
34 typedef enum { | 52 typedef enum { |
35 SIGNKEY_SOURCE_RAW_FILE, | 53 SIGNKEY_SOURCE_RAW_FILE, |
36 SIGNKEY_SOURCE_AGENT, | 54 SIGNKEY_SOURCE_AGENT, |
37 SIGNKEY_SOURCE_INVALID, | 55 SIGNKEY_SOURCE_INVALID, |
38 } signkey_source; | 56 } signkey_source; |
39 | 57 |
40 struct SIGN_key { | 58 struct SIGN_key { |
41 | 59 |
42 int type; /* The type of key (dss or rsa) */ | 60 enum signkey_type type; |
43 signkey_source source; | 61 signkey_source source; |
44 char *filename; | 62 char *filename; |
45 /* the buffer? for encrypted keys, so we can later get | |
46 * the private key portion */ | |
47 | 63 |
48 #ifdef DROPBEAR_DSS | 64 #ifdef DROPBEAR_DSS |
49 dropbear_dss_key * dsskey; | 65 dropbear_dss_key * dsskey; |
50 #endif | 66 #endif |
51 #ifdef DROPBEAR_RSA | 67 #ifdef DROPBEAR_RSA |
52 dropbear_rsa_key * rsakey; | 68 dropbear_rsa_key * rsakey; |
53 #endif | 69 #endif |
70 #ifdef DROPBEAR_ECDSA | |
71 #ifdef DROPBEAR_ECC_256 | |
72 ecc_key * ecckey256; | |
73 #endif | |
74 #ifdef DROPBEAR_ECC_384 | |
75 ecc_key * ecckey384; | |
76 #endif | |
77 #ifdef DROPBEAR_ECC_521 | |
78 ecc_key * ecckey521; | |
79 #endif | |
80 #endif | |
54 }; | 81 }; |
55 | 82 |
56 typedef struct SIGN_key sign_key; | 83 typedef struct SIGN_key sign_key; |
57 | 84 |
58 sign_key * new_sign_key(); | 85 sign_key * new_sign_key(); |
59 const char* signkey_name_from_type(int type, int *namelen); | 86 const char* signkey_name_from_type(enum signkey_type type, unsigned int *namelen); |
60 int signkey_type_from_name(const char* name, int namelen); | 87 enum signkey_type signkey_type_from_name(const char* name, unsigned int namelen); |
61 int buf_get_pub_key(buffer *buf, sign_key *key, int *type); | 88 int buf_get_pub_key(buffer *buf, sign_key *key, int *type); |
62 int buf_get_priv_key(buffer* buf, sign_key *key, int *type); | 89 int buf_get_priv_key(buffer* buf, sign_key *key, int *type); |
63 void buf_put_pub_key(buffer* buf, sign_key *key, int type); | 90 void buf_put_pub_key(buffer* buf, sign_key *key, int type); |
64 void buf_put_priv_key(buffer* buf, sign_key *key, int type); | 91 void buf_put_priv_key(buffer* buf, sign_key *key, int type); |
65 void sign_key_free(sign_key *key); | 92 void sign_key_free(sign_key *key); |
66 void buf_put_sign(buffer* buf, sign_key *key, int type, | 93 void buf_put_sign(buffer* buf, sign_key *key, int type, buffer *data_buf); |
67 const unsigned char *data, unsigned int len); | |
68 #ifdef DROPBEAR_SIGNKEY_VERIFY | 94 #ifdef DROPBEAR_SIGNKEY_VERIFY |
69 int buf_verify(buffer * buf, sign_key *key, const unsigned char *data, | 95 int buf_verify(buffer * buf, sign_key *key, buffer *data_buf); |
70 unsigned int len); | |
71 char * sign_key_fingerprint(unsigned char* keyblob, unsigned int keybloblen); | 96 char * sign_key_fingerprint(unsigned char* keyblob, unsigned int keybloblen); |
72 #endif | 97 #endif |
73 int cmp_base64_key(const unsigned char* keyblob, unsigned int keybloblen, | 98 int cmp_base64_key(const unsigned char* keyblob, unsigned int keybloblen, |
74 const unsigned char* algoname, unsigned int algolen, | 99 const unsigned char* algoname, unsigned int algolen, |
75 buffer * line, char ** fingerprint); | 100 buffer * line, char ** fingerprint); |
76 | 101 |
102 #ifdef DROPBEAR_ECDSA | |
103 ecc_key ** signkey_ecc_key_ptr(sign_key *key, enum signkey_type ecc_type); | |
104 #endif | |
105 | |
77 #endif /* _SIGNKEY_H_ */ | 106 #endif /* _SIGNKEY_H_ */ |