Mercurial > dropbear
comparison signkey.h @ 1674:ba6fc7afe1c5
use sigtype where appropriate
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 06 Apr 2020 23:18:26 +0800 |
parents | d32bcb5c557d |
children | ae41624c2198 |
comparison
equal
deleted
inserted
replaced
1668:49cb3cf4bd6f | 1674:ba6fc7afe1c5 |
---|---|
24 | 24 |
25 #ifndef DROPBEAR_SIGNKEY_H_ | 25 #ifndef DROPBEAR_SIGNKEY_H_ |
26 #define DROPBEAR_SIGNKEY_H_ | 26 #define DROPBEAR_SIGNKEY_H_ |
27 | 27 |
28 #include "buffer.h" | 28 #include "buffer.h" |
29 #include "dss.h" | 29 |
30 #include "rsa.h" | 30 /* Forward declarations */ |
31 #include "ed25519.h" | 31 struct dropbear_DSS_Key; |
32 struct dropbear_RSA_Key; | |
33 struct dropbear_ED25519_Key; | |
32 | 34 |
33 enum signkey_type { | 35 enum signkey_type { |
34 #if DROPBEAR_RSA | 36 #if DROPBEAR_RSA |
35 DROPBEAR_SIGNKEY_RSA, | 37 DROPBEAR_SIGNKEY_RSA, |
36 #endif | 38 #endif |
45 #if DROPBEAR_ED25519 | 47 #if DROPBEAR_ED25519 |
46 DROPBEAR_SIGNKEY_ED25519, | 48 DROPBEAR_SIGNKEY_ED25519, |
47 #endif | 49 #endif |
48 DROPBEAR_SIGNKEY_NUM_NAMED, | 50 DROPBEAR_SIGNKEY_NUM_NAMED, |
49 DROPBEAR_SIGNKEY_ECDSA_KEYGEN = 70, /* just "ecdsa" for keygen */ | 51 DROPBEAR_SIGNKEY_ECDSA_KEYGEN = 70, /* just "ecdsa" for keygen */ |
52 #if DROPBEAR_RSA_SHA256 | |
53 DROPBEAR_SIGNKEY_RSA_SHA256, /* rsa-sha2-256 signature. has a ssh-rsa key */ | |
54 #endif | |
50 DROPBEAR_SIGNKEY_ANY = 80, | 55 DROPBEAR_SIGNKEY_ANY = 80, |
51 DROPBEAR_SIGNKEY_NONE = 90, | 56 DROPBEAR_SIGNKEY_NONE = 90, |
52 }; | 57 }; |
53 | 58 |
54 | 59 |
64 enum signkey_type type; | 69 enum signkey_type type; |
65 signkey_source source; | 70 signkey_source source; |
66 char *filename; | 71 char *filename; |
67 | 72 |
68 #if DROPBEAR_DSS | 73 #if DROPBEAR_DSS |
69 dropbear_dss_key * dsskey; | 74 struct dropbear_DSS_Key * dsskey; |
70 #endif | 75 #endif |
71 #if DROPBEAR_RSA | 76 #if DROPBEAR_RSA |
72 dropbear_rsa_key * rsakey; | 77 struct dropbear_RSA_Key * rsakey; |
73 #endif | 78 #endif |
74 #if DROPBEAR_ECDSA | 79 #if DROPBEAR_ECDSA |
75 #if DROPBEAR_ECC_256 | 80 #if DROPBEAR_ECC_256 |
76 ecc_key * ecckey256; | 81 ecc_key * ecckey256; |
77 #endif | 82 #endif |
81 #if DROPBEAR_ECC_521 | 86 #if DROPBEAR_ECC_521 |
82 ecc_key * ecckey521; | 87 ecc_key * ecckey521; |
83 #endif | 88 #endif |
84 #endif | 89 #endif |
85 #if DROPBEAR_ED25519 | 90 #if DROPBEAR_ED25519 |
86 dropbear_ed25519_key * ed25519key; | 91 struct dropbear_ED25519_Key * ed25519key; |
87 #endif | 92 #endif |
88 }; | 93 }; |
89 | 94 |
90 typedef struct SIGN_key sign_key; | 95 typedef struct SIGN_key sign_key; |
91 | 96 |
92 sign_key * new_sign_key(void); | 97 sign_key * new_sign_key(void); |
93 const char* signkey_name_from_type(enum signkey_type type, unsigned int *namelen); | 98 const char* signkey_name_from_type(enum signkey_type type, unsigned int *namelen); |
94 enum signkey_type signkey_type_from_name(const char* name, unsigned int namelen); | 99 enum signkey_type signkey_type_from_name(const char* name, unsigned int namelen); |
100 const char* signature_name_from_type(enum signkey_type type, unsigned int *namelen); | |
101 enum signkey_type signature_type_from_name(const char* name, unsigned int namelen); | |
102 enum signkey_type signkey_type_from_signature(enum signkey_type sigtype); | |
95 int buf_get_pub_key(buffer *buf, sign_key *key, enum signkey_type *type); | 103 int buf_get_pub_key(buffer *buf, sign_key *key, enum signkey_type *type); |
96 int buf_get_priv_key(buffer* buf, sign_key *key, enum signkey_type *type); | 104 int buf_get_priv_key(buffer* buf, sign_key *key, enum signkey_type *type); |
97 void buf_put_pub_key(buffer* buf, sign_key *key, enum signkey_type type); | 105 void buf_put_pub_key(buffer* buf, sign_key *key, enum signkey_type type); |
98 void buf_put_priv_key(buffer* buf, sign_key *key, enum signkey_type type); | 106 void buf_put_priv_key(buffer* buf, sign_key *key, enum signkey_type type); |
99 void sign_key_free(sign_key *key); | 107 void sign_key_free(sign_key *key); |
100 void buf_put_sign(buffer* buf, sign_key *key, enum signkey_type type, const buffer *data_buf); | 108 void buf_put_sign(buffer* buf, sign_key *key, enum signkey_type sigtype, const buffer *data_buf); |
101 #if DROPBEAR_SIGNKEY_VERIFY | 109 #if DROPBEAR_SIGNKEY_VERIFY |
102 int buf_verify(buffer * buf, sign_key *key, const buffer *data_buf); | 110 int buf_verify(buffer * buf, sign_key *key, enum signkey_type type, const buffer *data_buf); |
103 char * sign_key_fingerprint(const unsigned char* keyblob, unsigned int keybloblen); | 111 char * sign_key_fingerprint(const unsigned char* keyblob, unsigned int keybloblen); |
104 #endif | 112 #endif |
105 int cmp_base64_key(const unsigned char* keyblob, unsigned int keybloblen, | 113 int cmp_base64_key(const unsigned char* keyblob, unsigned int keybloblen, |
106 const unsigned char* algoname, unsigned int algolen, | 114 const unsigned char* algoname, unsigned int algolen, |
107 const buffer * line, char ** fingerprint); | 115 const buffer * line, char ** fingerprint); |