Mercurial > dropbear
comparison signkey_ossh.c @ 1911:ced53051e200
Add ecdsa OpenSSH format for dropbearconvert
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 29 Mar 2022 23:27:55 +0800 |
parents | eadd023fde4d |
children |
comparison
equal
deleted
inserted
replaced
1910:54a85bbe5017 | 1911:ced53051e200 |
---|---|
121 return DROPBEAR_FAILURE; | 121 return DROPBEAR_FAILURE; |
122 } | 122 } |
123 return DROPBEAR_SUCCESS; | 123 return DROPBEAR_SUCCESS; |
124 } | 124 } |
125 #endif /* DROPBEAR_ED255219 */ | 125 #endif /* DROPBEAR_ED255219 */ |
126 | |
127 #if DROPBEAR_ECDSA | |
128 /* OpenSSH raw private ecdsa format is the same as Dropbear's. | |
129 # First part is the same as the SSH wire pubkey format | |
130 string "ecdsa-sha2-[identifier]" | |
131 string [identifier] | |
132 string Q | |
133 # With private part appended | |
134 mpint d | |
135 */ | |
136 | |
137 void buf_put_ecdsa_priv_ossh(buffer *buf, const sign_key *key) { | |
138 ecc_key **eck = (ecc_key**)signkey_key_ptr((sign_key*)key, key->type); | |
139 if (eck && *eck) { | |
140 buf_put_ecdsa_priv_key(buf, *eck); | |
141 return; | |
142 } | |
143 dropbear_exit("ecdsa key is not set"); | |
144 } | |
145 | |
146 int buf_get_ecdsa_priv_ossh(buffer *buf, sign_key *key) { | |
147 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, key->type); | |
148 if (eck) { | |
149 if (*eck) { | |
150 ecc_free(*eck); | |
151 m_free(*eck); | |
152 *eck = NULL; | |
153 } | |
154 *eck = buf_get_ecdsa_priv_key(buf); | |
155 if (*eck) { | |
156 return DROPBEAR_SUCCESS; | |
157 } | |
158 } | |
159 return DROPBEAR_FAILURE; | |
160 } | |
161 #endif /* DROPBEAR_ECDSA */ |