Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | int _ssh_exchange_banner(struct ssh *); | - |
7 | int _ssh_send_banner(struct ssh *, char **); | - |
8 | int _ssh_read_banner(struct ssh *, char **); | - |
9 | int _ssh_order_hostkeyalgs(struct ssh *); | - |
10 | int _ssh_verify_host_key(struct sshkey *, struct ssh *); | - |
11 | struct sshkey *_ssh_host_public_key(int, int, struct ssh *); | - |
12 | struct sshkey *_ssh_host_private_key(int, int, struct ssh *); | - |
13 | int _ssh_host_key_sign(struct sshkey *, struct sshkey *, | - |
14 | u_char **, size_t *, const u_char *, size_t, const char *, u_int); | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | int use_privsep = 0; | - |
21 | int mm_sshkey_sign(struct sshkey *, u_char **, u_int *, | - |
22 | u_char *, u_int, char *, u_int); | - |
23 | DH *mm_choose_dh(int, int, int); | - |
24 | | - |
25 | | - |
26 | u_char *session_id2 = | - |
27 | ((void *)0) | - |
28 | ; | - |
29 | u_int session_id2_len = 0; | - |
30 | | - |
31 | int | - |
32 | mm_sshkey_sign(struct sshkey *key, u_char **sigp, u_int *lenp, | - |
33 | u_char *data, u_int datalen, char *alg, u_int compat) | - |
34 | { | - |
35 | return never executed: return (-1); (-1);never executed: return (-1); | 0 |
36 | } | - |
37 | | - |
38 | DH * | - |
39 | mm_choose_dh(int min, int nbits, int max) | - |
40 | { | - |
41 | return never executed: return ( ((void *)0) ); (never executed: return ( ((void *)0) ); | 0 |
42 | ((void *)0) never executed: return ( ((void *)0) ); | 0 |
43 | ); never executed: return ( ((void *)0) ); | 0 |
44 | } | - |
45 | | - |
46 | | - |
47 | | - |
48 | int | - |
49 | ssh_init(struct ssh **sshp, int is_server, struct kex_params *kex_params) | - |
50 | { | - |
51 | char *myproposal[PROPOSAL_MAX] = { "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group-exchange-sha1," "diffie-hellman-group14-sha256," "diffie-hellman-group14-sha1", "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "ssh-ed25519-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-rsa-cert-v01@openssh.com," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "ssh-ed25519," "rsa-sha2-512," "rsa-sha2-256," "ssh-rsa", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr" ",aes128-gcm@openssh.com,aes256-gcm@openssh.com", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr" ",aes128-gcm@openssh.com,aes256-gcm@openssh.com", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "none,zlib@openssh.com", "none,zlib@openssh.com", "", "" }; | - |
52 | struct ssh *ssh; | - |
53 | char **proposal; | - |
54 | static int called; | - |
55 | int r; | - |
56 | | - |
57 | if (!calledTRUE | evaluated 1 time by 1 test | FALSE | evaluated 95 times by 1 test |
) { | 1-95 |
58 | | - |
59 | | - |
60 | OPENSSL_add_all_algorithms_noconf() | - |
61 | ; | - |
62 | | - |
63 | called = 1; | - |
64 | }executed 1 time by 1 test: end of block | 1 |
65 | | - |
66 | if ((TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
ssh = ssh_packet_set_connection(TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
| 0-96 |
67 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
| 0-96 |
68 | , -1, -1)) == TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
| 0-96 |
69 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
| 0-96 |
70 | ) | - |
71 | return never executed: return -2; -2;never executed: return -2; | 0 |
72 | if (is_serverTRUE | evaluated 64 times by 1 test | FALSE | evaluated 32 times by 1 test |
) | 32-64 |
73 | ssh_packet_set_server(ssh);executed 64 times by 1 test: ssh_packet_set_server(ssh); | 64 |
74 | | - |
75 | | - |
76 | proposal = kex_paramsTRUE | evaluated 64 times by 1 test | FALSE | evaluated 32 times by 1 test |
? kex_params->proposal : myproposal; | 32-64 |
77 | if ((TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
r = kex_new(ssh, proposal, &ssh->kex)) != 0TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
) { | 0-96 |
78 | ssh_free(ssh); | - |
79 | return never executed: return r; r;never executed: return r; | 0 |
80 | } | - |
81 | ssh->kex->server = is_server; | - |
82 | if (is_serverTRUE | evaluated 64 times by 1 test | FALSE | evaluated 32 times by 1 test |
) { | 32-64 |
83 | | - |
84 | ssh->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; | - |
85 | ssh->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; | - |
86 | ssh->kex->kex[KEX_DH_GRP14_SHA256] = kexdh_server; | - |
87 | ssh->kex->kex[KEX_DH_GRP16_SHA512] = kexdh_server; | - |
88 | ssh->kex->kex[KEX_DH_GRP18_SHA512] = kexdh_server; | - |
89 | ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; | - |
90 | ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; | - |
91 | | - |
92 | ssh->kex->kex[KEX_ECDH_SHA2] = kexecdh_server; | - |
93 | | - |
94 | | - |
95 | ssh->kex->kex[KEX_C25519_SHA256] = kexc25519_server; | - |
96 | ssh->kex->load_host_public_key=&_ssh_host_public_key; | - |
97 | ssh->kex->load_host_private_key=&_ssh_host_private_key; | - |
98 | ssh->kex->sign=&_ssh_host_key_sign; | - |
99 | }executed 64 times by 1 test: end of block else { | 64 |
100 | | - |
101 | ssh->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; | - |
102 | ssh->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; | - |
103 | ssh->kex->kex[KEX_DH_GRP14_SHA256] = kexdh_client; | - |
104 | ssh->kex->kex[KEX_DH_GRP16_SHA512] = kexdh_client; | - |
105 | ssh->kex->kex[KEX_DH_GRP18_SHA512] = kexdh_client; | - |
106 | ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; | - |
107 | ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; | - |
108 | | - |
109 | ssh->kex->kex[KEX_ECDH_SHA2] = kexecdh_client; | - |
110 | | - |
111 | | - |
112 | ssh->kex->kex[KEX_C25519_SHA256] = kexc25519_client; | - |
113 | ssh->kex->verify_host_key =&_ssh_verify_host_key; | - |
114 | }executed 32 times by 1 test: end of block | 32 |
115 | *sshp = ssh; | - |
116 | returnexecuted 96 times by 1 test: return 0; 0;executed 96 times by 1 test: return 0; | 96 |
117 | } | - |
118 | | - |
119 | void | - |
120 | ssh_free(struct ssh *ssh) | - |
121 | { | - |
122 | struct key_entry *k; | - |
123 | | - |
124 | ssh_packet_close(ssh); | - |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | while ((TRUE | evaluated 96 times by 1 test | FALSE | evaluated 96 times by 1 test |
k = ((&ssh->public_keys)->tqh_first)) != TRUE | evaluated 96 times by 1 test | FALSE | evaluated 96 times by 1 test |
| 96 |
130 | ((void *)0)TRUE | evaluated 96 times by 1 test | FALSE | evaluated 96 times by 1 test |
| 96 |
131 | ) { | - |
132 | do { if (((TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
k)->next.tqe_next) != TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
| 0-96 |
133 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 96 times by 1 test |
| 0-96 |
134 | ) ( never executed: (k)->next.tqe_next->next.tqe_prev = (k)->next.tqe_prev; k)->next.tqe_next->next.tqe_prev = (k)->next.tqe_prev;never executed: (k)->next.tqe_next->next.tqe_prev = (k)->next.tqe_prev; else (executed 96 times by 1 test: (&ssh->public_keys)->tqh_last = (k)->next.tqe_prev; &ssh->public_keys)->tqh_last = (k)->next.tqe_prev;executed 96 times by 1 test: (&ssh->public_keys)->tqh_last = (k)->next.tqe_prev; *(k)->next.tqe_prev = (k)->next.tqe_next; ; ; } while (0); | 0-96 |
135 | if (ssh->kexTRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
&& ssh->kex->serverTRUE | evaluated 64 times by 1 test | FALSE | evaluated 32 times by 1 test |
) | 0-96 |
136 | sshkey_free(k->key);executed 64 times by 1 test: sshkey_free(k->key); | 64 |
137 | free(k); | - |
138 | }executed 96 times by 1 test: end of block | 96 |
139 | while ((TRUE | evaluated 64 times by 1 test | FALSE | evaluated 96 times by 1 test |
k = ((&ssh->private_keys)->tqh_first)) != TRUE | evaluated 64 times by 1 test | FALSE | evaluated 96 times by 1 test |
| 64-96 |
140 | ((void *)0)TRUE | evaluated 64 times by 1 test | FALSE | evaluated 96 times by 1 test |
| 64-96 |
141 | ) { | - |
142 | do { if (((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
k)->next.tqe_next) != TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
143 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
144 | ) ( never executed: (k)->next.tqe_next->next.tqe_prev = (k)->next.tqe_prev; k)->next.tqe_next->next.tqe_prev = (k)->next.tqe_prev;never executed: (k)->next.tqe_next->next.tqe_prev = (k)->next.tqe_prev; else (executed 64 times by 1 test: (&ssh->private_keys)->tqh_last = (k)->next.tqe_prev; &ssh->private_keys)->tqh_last = (k)->next.tqe_prev;executed 64 times by 1 test: (&ssh->private_keys)->tqh_last = (k)->next.tqe_prev; *(k)->next.tqe_prev = (k)->next.tqe_next; ; ; } while (0); | 0-64 |
145 | free(k); | - |
146 | }executed 64 times by 1 test: end of block | 64 |
147 | if (ssh->kexTRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
) | 0-96 |
148 | kex_free(ssh->kex);executed 96 times by 1 test: kex_free(ssh->kex); | 96 |
149 | free(ssh); | - |
150 | }executed 96 times by 1 test: end of block | 96 |
151 | | - |
152 | void | - |
153 | ssh_set_app_data(struct ssh *ssh, void *app_data) | - |
154 | { | - |
155 | ssh->app_data = app_data; | - |
156 | } never executed: end of block | 0 |
157 | | - |
158 | void * | - |
159 | ssh_get_app_data(struct ssh *ssh) | - |
160 | { | - |
161 | return never executed: return ssh->app_data; ssh->app_data;never executed: return ssh->app_data; | 0 |
162 | } | - |
163 | | - |
164 | | - |
165 | int | - |
166 | ssh_add_hostkey(struct ssh *ssh, struct sshkey *key) | - |
167 | { | - |
168 | struct sshkey *pubkey = | - |
169 | ((void *)0) | - |
170 | ; | - |
171 | struct key_entry *k = | - |
172 | ((void *)0) | - |
173 | , *k_prv = | - |
174 | ((void *)0) | - |
175 | ; | - |
176 | int r; | - |
177 | | - |
178 | if (ssh->kex->serverTRUE | evaluated 64 times by 1 test | FALSE | evaluated 32 times by 1 test |
) { | 32-64 |
179 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
r = sshkey_from_private(key, &pubkey)) != 0TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
180 | return never executed: return r; r;never executed: return r; | 0 |
181 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
k = malloc(sizeof(*k))) == TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
182 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
183 | || | - |
184 | (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
k_prv = malloc(sizeof(*k_prv))) == TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
185 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
186 | ) { | - |
187 | free(k); | - |
188 | sshkey_free(pubkey); | - |
189 | return never executed: return -2; -2;never executed: return -2; | 0 |
190 | } | - |
191 | k_prv->key = key; | - |
192 | do { (k_prv)->next.tqe_next = | - |
193 | ((void *)0) | - |
194 | ; (k_prv)->next.tqe_prev = (&ssh->private_keys)->tqh_last; *(&ssh->private_keys)->tqh_last = (k_prv); (&ssh->private_keys)->tqh_last = &(k_prv)->next.tqe_next; } while (0); | - |
195 | | - |
196 | | - |
197 | k->key = pubkey; | - |
198 | do { (k)->next.tqe_next = | - |
199 | ((void *)0) | - |
200 | ; (k)->next.tqe_prev = (&ssh->public_keys)->tqh_last; *(&ssh->public_keys)->tqh_last = (k); (&ssh->public_keys)->tqh_last = &(k)->next.tqe_next; } while (0); | - |
201 | r = 0; | - |
202 | }executed 64 times by 1 test: end of block else { | 64 |
203 | if ((TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
k = malloc(sizeof(*k))) == TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
| 0-32 |
204 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
| 0-32 |
205 | ) | - |
206 | return never executed: return -2; -2;never executed: return -2; | 0 |
207 | k->key = key; | - |
208 | do { (k)->next.tqe_next = | - |
209 | ((void *)0) | - |
210 | ; (k)->next.tqe_prev = (&ssh->public_keys)->tqh_last; *(&ssh->public_keys)->tqh_last = (k); (&ssh->public_keys)->tqh_last = &(k)->next.tqe_next; } while (0); | - |
211 | r = 0; | - |
212 | }executed 32 times by 1 test: end of block | 32 |
213 | | - |
214 | returnexecuted 96 times by 1 test: return r; r;executed 96 times by 1 test: return r; | 96 |
215 | } | - |
216 | | - |
217 | int | - |
218 | ssh_set_verify_host_key_callback(struct ssh *ssh, | - |
219 | int (*cb)(struct sshkey *, struct ssh *)) | - |
220 | { | - |
221 | if (cb == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
222 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
223 | || ssh->kex == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
224 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
225 | ) | - |
226 | return never executed: return -10; -10;never executed: return -10; | 0 |
227 | | - |
228 | ssh->kex->verify_host_key = cb; | - |
229 | | - |
230 | return never executed: return 0; 0;never executed: return 0; | 0 |
231 | } | - |
232 | | - |
233 | int | - |
234 | ssh_input_append(struct ssh *ssh, const u_char *data, size_t len) | - |
235 | { | - |
236 | returnexecuted 848 times by 1 test: return sshbuf_put(ssh_packet_get_input(ssh), data, len); sshbuf_put(ssh_packet_get_input(ssh), data, len);executed 848 times by 1 test: return sshbuf_put(ssh_packet_get_input(ssh), data, len); | 848 |
237 | } | - |
238 | | - |
239 | int | - |
240 | ssh_packet_next(struct ssh *ssh, u_char *typep) | - |
241 | { | - |
242 | int r; | - |
243 | u_int32_t seqnr; | - |
244 | u_char type; | - |
245 | | - |
246 | | - |
247 | | - |
248 | | - |
249 | | - |
250 | *typep = 0; | - |
251 | if (ssh->kex->client_version_string == TRUE | evaluated 128 times by 1 test | FALSE | evaluated 1952 times by 1 test |
| 128-1952 |
252 | ((void *)0)TRUE | evaluated 128 times by 1 test | FALSE | evaluated 1952 times by 1 test |
| 128-1952 |
253 | || | - |
254 | ssh->kex->server_version_string == TRUE | never evaluated | FALSE | evaluated 1952 times by 1 test |
| 0-1952 |
255 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 1952 times by 1 test |
| 0-1952 |
256 | ) | - |
257 | returnexecuted 128 times by 1 test: return _ssh_exchange_banner(ssh); _ssh_exchange_banner(ssh);executed 128 times by 1 test: return _ssh_exchange_banner(ssh); | 128 |
258 | for (;;) { | - |
259 | if ((TRUE | never evaluated | FALSE | evaluated 2992 times by 1 test |
r = ssh_packet_read_poll2(ssh, &type, &seqnr)) != 0TRUE | never evaluated | FALSE | evaluated 2992 times by 1 test |
) | 0-2992 |
260 | return never executed: return r; r;never executed: return r; | 0 |
261 | if (type > 0TRUE | evaluated 1040 times by 1 test | FALSE | evaluated 1952 times by 1 test |
&& type < 255TRUE | evaluated 1040 times by 1 test | FALSE | never evaluated |
&& | 0-1952 |
262 | type >= 20TRUE | evaluated 1040 times by 1 test | FALSE | never evaluated |
&& type <= 49TRUE | evaluated 1040 times by 1 test | FALSE | never evaluated |
&& | 0-1040 |
263 | ssh->dispatch[type] != TRUE | evaluated 1040 times by 1 test | FALSE | never evaluated |
| 0-1040 |
264 | ((void *)0)TRUE | evaluated 1040 times by 1 test | FALSE | never evaluated |
| 0-1040 |
265 | ) { | - |
266 | if ((TRUE | never evaluated | FALSE | evaluated 1040 times by 1 test |
r = (*ssh->dispatch[type])(type, seqnr, ssh)) != 0TRUE | never evaluated | FALSE | evaluated 1040 times by 1 test |
) | 0-1040 |
267 | return never executed: return r; r;never executed: return r; | 0 |
268 | }executed 1040 times by 1 test: end of block else { | 1040 |
269 | *typep = type; | - |
270 | returnexecuted 1952 times by 1 test: return 0; 0;executed 1952 times by 1 test: return 0; | 1952 |
271 | } | - |
272 | } | - |
273 | } never executed: end of block | 0 |
274 | | - |
275 | const u_char * | - |
276 | ssh_packet_payload(struct ssh *ssh, size_t *lenp) | - |
277 | { | - |
278 | return never executed: return sshpkt_ptr(ssh, lenp); sshpkt_ptr(ssh, lenp);never executed: return sshpkt_ptr(ssh, lenp); | 0 |
279 | } | - |
280 | | - |
281 | int | - |
282 | ssh_packet_put(struct ssh *ssh, int type, const u_char *data, size_t len) | - |
283 | { | - |
284 | int r; | - |
285 | | - |
286 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_start(ssh, type)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
287 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_put(ssh, data, len)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
288 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshpkt_send(ssh)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
289 | return never executed: return r; r;never executed: return r; | 0 |
290 | return never executed: return 0; 0;never executed: return 0; | 0 |
291 | } | - |
292 | | - |
293 | const u_char * | - |
294 | ssh_output_ptr(struct ssh *ssh, size_t *len) | - |
295 | { | - |
296 | struct sshbuf *output = ssh_packet_get_output(ssh); | - |
297 | | - |
298 | *len = sshbuf_len(output); | - |
299 | returnexecuted 2080 times by 1 test: return sshbuf_ptr(output); sshbuf_ptr(output);executed 2080 times by 1 test: return sshbuf_ptr(output); | 2080 |
300 | } | - |
301 | | - |
302 | int | - |
303 | ssh_output_consume(struct ssh *ssh, size_t len) | - |
304 | { | - |
305 | returnexecuted 848 times by 1 test: return sshbuf_consume(ssh_packet_get_output(ssh), len); sshbuf_consume(ssh_packet_get_output(ssh), len);executed 848 times by 1 test: return sshbuf_consume(ssh_packet_get_output(ssh), len); | 848 |
306 | } | - |
307 | | - |
308 | int | - |
309 | ssh_output_space(struct ssh *ssh, size_t len) | - |
310 | { | - |
311 | return never executed: return (0 == sshbuf_check_reserve(ssh_packet_get_output(ssh), len)); (0 == sshbuf_check_reserve(ssh_packet_get_output(ssh), len));never executed: return (0 == sshbuf_check_reserve(ssh_packet_get_output(ssh), len)); | 0 |
312 | } | - |
313 | | - |
314 | int | - |
315 | ssh_input_space(struct ssh *ssh, size_t len) | - |
316 | { | - |
317 | return never executed: return (0 == sshbuf_check_reserve(ssh_packet_get_input(ssh), len)); (0 == sshbuf_check_reserve(ssh_packet_get_input(ssh), len));never executed: return (0 == sshbuf_check_reserve(ssh_packet_get_input(ssh), len)); | 0 |
318 | } | - |
319 | | - |
320 | | - |
321 | int | - |
322 | _ssh_read_banner(struct ssh *ssh, char **bannerp) | - |
323 | { | - |
324 | struct sshbuf *input; | - |
325 | const char *s; | - |
326 | char buf[256], remote_version[256]; | - |
327 | const char *mismatch = "Protocol mismatch.\r\n"; | - |
328 | int r, remote_major, remote_minor; | - |
329 | size_t i, n, j, len; | - |
330 | | - |
331 | *bannerp = | - |
332 | ((void *)0) | - |
333 | ; | - |
334 | input = ssh_packet_get_input(ssh); | - |
335 | len = sshbuf_len(input); | - |
336 | s = (const char *)sshbuf_ptr(input); | - |
337 | for (j = n = 0;;) { | - |
338 | for (i = 0; i < sizeof(buf) - 1TRUE | evaluated 1408 times by 1 test | FALSE | never evaluated |
; i++) { | 0-1408 |
339 | if (j >= lenTRUE | evaluated 64 times by 1 test | FALSE | evaluated 1344 times by 1 test |
) | 64-1344 |
340 | returnexecuted 64 times by 1 test: return (0); (0);executed 64 times by 1 test: return (0); | 64 |
341 | buf[i] = s[j++]; | - |
342 | if (buf[i] == '\r'TRUE | evaluated 64 times by 1 test | FALSE | evaluated 1280 times by 1 test |
) { | 64-1280 |
343 | buf[i] = '\n'; | - |
344 | buf[i + 1] = 0; | - |
345 | continue;executed 64 times by 1 test: continue; | 64 |
346 | } | - |
347 | if (buf[i] == '\n'TRUE | evaluated 64 times by 1 test | FALSE | evaluated 1216 times by 1 test |
) { | 64-1216 |
348 | buf[i + 1] = 0; | - |
349 | break;executed 64 times by 1 test: break; | 64 |
350 | } | - |
351 | }executed 1216 times by 1 test: end of block | 1216 |
352 | buf[sizeof(buf) - 1] = 0; | - |
353 | if ( | - |
354 | (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
__extension__ (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
355 | 4TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
356 | )TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
&& ((__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
357 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
358 | )TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
&& strlen (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
359 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
360 | ) < ((size_t) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
361 | 4TRUE | never evaluated | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
362 | ))TRUE | never evaluated | FALSE | never evaluated |
) || (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
363 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
364 | )TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
&& strlen (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
365 | "SSH-"TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
366 | ) < ((size_t) (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
367 | 4TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
368 | ))TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
)) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
369 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
370 | ) && __builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
371 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
372 | ) && (__s1_len = __builtin_strlen (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
373 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
374 | ), __s2_len = __builtin_strlen (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
375 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
376 | ), (!((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
377 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
378 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
379 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
380 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
381 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
382 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
383 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
384 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
385 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
386 | , TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
387 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
388 | ) : (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
389 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
390 | ) && ((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
391 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
392 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
393 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
394 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
395 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
396 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
397 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
398 | ) && ((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
399 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
400 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
401 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
402 | ) == 1) ? __builtin_strcmp (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
403 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
404 | , TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
405 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
406 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
407 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
408 | ); int __result = (((const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
409 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
410 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
411 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
412 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
413 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
414 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]); TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
415 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]); | 0-64 |
416 | ))[3] - __s2[3]);TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
417 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
418 | ) && ((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
419 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
420 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
421 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
422 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
423 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
424 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
425 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
426 | ) && ((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
427 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
428 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
429 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
430 | ) == 1) ? __builtin_strcmp (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
431 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
432 | , TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
433 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
434 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
435 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
436 | ); int __result = (((const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
437 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
438 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
439 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
440 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
441 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
442 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]); TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
443 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]); | 0-64 |
444 | ))[3] - __s2[3]);TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
445 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
446 | , TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
447 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
448 | )))); }) : strncmp (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
449 | bufTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
450 | , TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
451 | "SSH-"TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
452 | , TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
453 | 4TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
454 | ))) TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
455 | == 0TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
) | 0-64 |
456 | break;executed 64 times by 1 test: break; | 64 |
457 | debug("ssh_exchange_identification: %s", buf); | - |
458 | if (ssh->kex->serverTRUE | never evaluated | FALSE | never evaluated |
|| ++TRUE | never evaluated | FALSE | never evaluated |
n > 65536TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
459 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put(ssh_packet_get_output(ssh),TRUE | never evaluated | FALSE | never evaluated |
| 0 |
460 | mismatch, strlen(mismatch))) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
461 | return never executed: return r; r;never executed: return r; | 0 |
462 | return never executed: return -38; -38;never executed: return -38; | 0 |
463 | } | - |
464 | } never executed: end of block | 0 |
465 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
r = sshbuf_consume(input, j)) != 0TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
466 | return never executed: return r; r;never executed: return r; | 0 |
467 | | - |
468 | | - |
469 | | - |
470 | | - |
471 | | - |
472 | if (sscanf(buf, "SSH-%d.%d-%[^\n]\n",TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
473 | &remote_major, &remote_minor, remote_version) != 3TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
474 | return never executed: return -4; -4;never executed: return -4; | 0 |
475 | debug("Remote protocol version %d.%d, remote software version %.100s", | - |
476 | remote_major, remote_minor, remote_version); | - |
477 | | - |
478 | ssh->compat = compat_datafellows(remote_version); | - |
479 | if (remote_major == 1TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
&& remote_minor == 99TRUE | never evaluated | FALSE | never evaluated |
) { | 0-64 |
480 | remote_major = 2; | - |
481 | remote_minor = 0; | - |
482 | } never executed: end of block | 0 |
483 | if (remote_major != 2TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
484 | return never executed: return -37; -37;never executed: return -37; | 0 |
485 | chop(buf); | - |
486 | debug("Remote version string %.100s", buf); | - |
487 | if ((*TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
bannerp = TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
488 | (__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
489 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
490 | )TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
&& ((TRUE | never evaluated | FALSE | never evaluated |
size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
491 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
492 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
493 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
494 | ) == 1)TRUE | never evaluated | FALSE | never evaluated |
? (((constTRUE | never evaluated | FALSE | never evaluated |
char *) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
495 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
496 | ))[0] == '\0'TRUE | never evaluated | FALSE | never evaluated |
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
497 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
498 | ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
) __retval = (char *) memcpy (__retval, never executed: __retval = (char *) memcpy (__retval, buf , __len); TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
499 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
never executed: __retval = (char *) memcpy (__retval, buf , __len); | 0-64 |
500 | , __len);TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
never executed: __retval = (char *) memcpy (__retval, buf , __len); __retval; })) : __strdup (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
501 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
502 | )))TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
503 | ) == TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
504 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
505 | ) | - |
506 | return never executed: return -2; -2;never executed: return -2; | 0 |
507 | returnexecuted 64 times by 1 test: return 0; 0;executed 64 times by 1 test: return 0; | 64 |
508 | } | - |
509 | | - |
510 | | - |
511 | int | - |
512 | _ssh_send_banner(struct ssh *ssh, char **bannerp) | - |
513 | { | - |
514 | char buf[256]; | - |
515 | int r; | - |
516 | | - |
517 | snprintf(buf, sizeof buf, "SSH-2.0-%.100s\r\n", "OpenSSH_7.8"); | - |
518 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
r = sshbuf_put(ssh_packet_get_output(ssh), buf, strlen(buf))) != 0TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
519 | return never executed: return r; r;never executed: return r; | 0 |
520 | chop(buf); | - |
521 | debug("Local version string %.100s", buf); | - |
522 | if ((*TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
bannerp = TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
523 | (__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
524 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
525 | )TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
&& ((TRUE | never evaluated | FALSE | never evaluated |
size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
526 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
527 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
528 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
529 | ) == 1)TRUE | never evaluated | FALSE | never evaluated |
? (((constTRUE | never evaluated | FALSE | never evaluated |
char *) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
530 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
531 | ))[0] == '\0'TRUE | never evaluated | FALSE | never evaluated |
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
532 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
533 | ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
) __retval = (char *) memcpy (__retval, never executed: __retval = (char *) memcpy (__retval, buf , __len); TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
534 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
never executed: __retval = (char *) memcpy (__retval, buf , __len); | 0-64 |
535 | , __len);TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
never executed: __retval = (char *) memcpy (__retval, buf , __len); __retval; })) : __strdup (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
536 | bufTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
537 | )))TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
538 | ) == TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
539 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
540 | ) | - |
541 | return never executed: return -2; -2;never executed: return -2; | 0 |
542 | returnexecuted 64 times by 1 test: return 0; 0;executed 64 times by 1 test: return 0; | 64 |
543 | } | - |
544 | | - |
545 | int | - |
546 | _ssh_exchange_banner(struct ssh *ssh) | - |
547 | { | - |
548 | struct kex *kex = ssh->kex; | - |
549 | int r; | - |
550 | | - |
551 | | - |
552 | | - |
553 | | - |
554 | | - |
555 | | - |
556 | r = 0; | - |
557 | if (kex->serverTRUE | evaluated 96 times by 1 test | FALSE | evaluated 32 times by 1 test |
) { | 32-96 |
558 | if (kex->server_version_string == TRUE | evaluated 32 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 32-64 |
559 | ((void *)0)TRUE | evaluated 32 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 32-64 |
560 | ) | - |
561 | r = _ssh_send_banner(ssh, &kex->server_version_string);executed 32 times by 1 test: r = _ssh_send_banner(ssh, &kex->server_version_string); | 32 |
562 | if (r == 0TRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
&& | 0-96 |
563 | kex->server_version_string != TRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
| 0-96 |
564 | ((void *)0)TRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
| 0-96 |
565 | && | - |
566 | kex->client_version_string == TRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
| 0-96 |
567 | ((void *)0)TRUE | evaluated 96 times by 1 test | FALSE | never evaluated |
| 0-96 |
568 | ) | - |
569 | r = _ssh_read_banner(ssh, &kex->client_version_string);executed 96 times by 1 test: r = _ssh_read_banner(ssh, &kex->client_version_string); | 96 |
570 | }executed 96 times by 1 test: end of block else { | 96 |
571 | if (kex->server_version_string == TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
| 0-32 |
572 | ((void *)0)TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
| 0-32 |
573 | ) | - |
574 | r = _ssh_read_banner(ssh, &kex->server_version_string);executed 32 times by 1 test: r = _ssh_read_banner(ssh, &kex->server_version_string); | 32 |
575 | if (r == 0TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
&& | 0-32 |
576 | kex->server_version_string != TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
| 0-32 |
577 | ((void *)0)TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
| 0-32 |
578 | && | - |
579 | kex->client_version_string == TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
| 0-32 |
580 | ((void *)0)TRUE | evaluated 32 times by 1 test | FALSE | never evaluated |
| 0-32 |
581 | ) | - |
582 | r = _ssh_send_banner(ssh, &kex->client_version_string);executed 32 times by 1 test: r = _ssh_send_banner(ssh, &kex->client_version_string); | 32 |
583 | }executed 32 times by 1 test: end of block | 32 |
584 | if (r != 0TRUE | never evaluated | FALSE | evaluated 128 times by 1 test |
) | 0-128 |
585 | return never executed: return r; r;never executed: return r; | 0 |
586 | | - |
587 | if (kex->server_version_string != TRUE | evaluated 128 times by 1 test | FALSE | never evaluated |
| 0-128 |
588 | ((void *)0)TRUE | evaluated 128 times by 1 test | FALSE | never evaluated |
| 0-128 |
589 | && | - |
590 | kex->client_version_string != TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
591 | ((void *)0)TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
592 | ) { | - |
593 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
r = _ssh_order_hostkeyalgs(ssh)) != 0TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
|| | 0-64 |
594 | (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
r = kex_send_kexinit(ssh)) != 0TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
595 | return never executed: return r; r;never executed: return r; | 0 |
596 | }executed 64 times by 1 test: end of block | 64 |
597 | returnexecuted 128 times by 1 test: return 0; 0;executed 128 times by 1 test: return 0; | 128 |
598 | } | - |
599 | | - |
600 | struct sshkey * | - |
601 | _ssh_host_public_key(int type, int nid, struct ssh *ssh) | - |
602 | { | - |
603 | struct key_entry *k; | - |
604 | | - |
605 | debug3("%s: need %d", __func__, type); | - |
606 | for((k) = ((&ssh->public_keys)->tqh_first); (TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
k) != TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
| 0-160 |
607 | ((TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
void *)0)TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
| 0-160 |
608 | ; (k) = ((k)->next.tqe_next)) { | - |
609 | debug3("%s: check %s", __func__, sshkey_type(k->key)); | - |
610 | if (k->key->type == typeTRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
&& | 0-160 |
611 | (type != KEY_ECDSATRUE | evaluated 120 times by 1 test | FALSE | evaluated 40 times by 1 test |
|| k->key->ecdsa_nid == nidTRUE | evaluated 40 times by 1 test | FALSE | never evaluated |
)) | 0-120 |
612 | returnexecuted 160 times by 1 test: return (k->key); (k->key);executed 160 times by 1 test: return (k->key); | 160 |
613 | } never executed: end of block | 0 |
614 | return never executed: return ( ((void *)0) ); (never executed: return ( ((void *)0) ); | 0 |
615 | ((void *)0) never executed: return ( ((void *)0) ); | 0 |
616 | ); never executed: return ( ((void *)0) ); | 0 |
617 | } | - |
618 | | - |
619 | struct sshkey * | - |
620 | _ssh_host_private_key(int type, int nid, struct ssh *ssh) | - |
621 | { | - |
622 | struct key_entry *k; | - |
623 | | - |
624 | debug3("%s: need %d", __func__, type); | - |
625 | for((k) = ((&ssh->private_keys)->tqh_first); (TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
k) != TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
| 0-160 |
626 | ((TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
void *)0)TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
| 0-160 |
627 | ; (k) = ((k)->next.tqe_next)) { | - |
628 | debug3("%s: check %s", __func__, sshkey_type(k->key)); | - |
629 | if (k->key->type == typeTRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
&& | 0-160 |
630 | (type != KEY_ECDSATRUE | evaluated 120 times by 1 test | FALSE | evaluated 40 times by 1 test |
|| k->key->ecdsa_nid == nidTRUE | evaluated 40 times by 1 test | FALSE | never evaluated |
)) | 0-120 |
631 | returnexecuted 160 times by 1 test: return (k->key); (k->key);executed 160 times by 1 test: return (k->key); | 160 |
632 | } never executed: end of block | 0 |
633 | return never executed: return ( ((void *)0) ); (never executed: return ( ((void *)0) ); | 0 |
634 | ((void *)0) never executed: return ( ((void *)0) ); | 0 |
635 | ); never executed: return ( ((void *)0) ); | 0 |
636 | } | - |
637 | | - |
638 | int | - |
639 | _ssh_verify_host_key(struct sshkey *hostkey, struct ssh *ssh) | - |
640 | { | - |
641 | struct key_entry *k; | - |
642 | | - |
643 | debug3("%s: need %s", __func__, sshkey_type(hostkey)); | - |
644 | for((k) = ((&ssh->public_keys)->tqh_first); (TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
k) != TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
| 0-160 |
645 | ((TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
void *)0)TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
| 0-160 |
646 | ; (k) = ((k)->next.tqe_next)) { | - |
647 | debug3("%s: check %s", __func__, sshkey_type(k->key)); | - |
648 | if (sshkey_equal_public(hostkey, k->key)TRUE | evaluated 160 times by 1 test | FALSE | never evaluated |
) | 0-160 |
649 | returnexecuted 160 times by 1 test: return (0); (0);executed 160 times by 1 test: return (0); | 160 |
650 | } never executed: end of block | 0 |
651 | return never executed: return (-1); (-1);never executed: return (-1); | 0 |
652 | } | - |
653 | | - |
654 | | - |
655 | int | - |
656 | _ssh_order_hostkeyalgs(struct ssh *ssh) | - |
657 | { | - |
658 | struct key_entry *k; | - |
659 | char *orig, *avail, *oavail = | - |
660 | ((void *)0) | - |
661 | , *alg, *replace = | - |
662 | ((void *)0) | - |
663 | ; | - |
664 | char **proposal; | - |
665 | size_t maxlen; | - |
666 | int ktype, r; | - |
667 | | - |
668 | | - |
669 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
r = kex_buf2prop(ssh->kex->my, TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
670 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
671 | , &proposal)) != 0TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
672 | return never executed: return r; r;never executed: return r; | 0 |
673 | orig = proposal[PROPOSAL_SERVER_HOST_KEY_ALGS]; | - |
674 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
oavail = avail = TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
675 | (__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
676 | origTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
677 | )TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
&& ((TRUE | never evaluated | FALSE | never evaluated |
size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
678 | origTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
679 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
680 | origTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
681 | ) == 1)TRUE | never evaluated | FALSE | never evaluated |
? (((constTRUE | never evaluated | FALSE | never evaluated |
char *) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
682 | origTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
683 | ))[0] == '\0'TRUE | never evaluated | FALSE | never evaluated |
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
684 | origTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
685 | ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
) __retval = (char *) memcpy (__retval, never executed: __retval = (char *) memcpy (__retval, orig , __len); TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
686 | origTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
never executed: __retval = (char *) memcpy (__retval, orig , __len); | 0-64 |
687 | , __len);TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
never executed: __retval = (char *) memcpy (__retval, orig , __len); __retval; })) : __strdup (TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
688 | origTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
689 | )))TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
690 | ) == TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
691 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
692 | ) { | - |
693 | r = -2; | - |
694 | goto never executed: goto out; out;never executed: goto out; | 0 |
695 | } | - |
696 | maxlen = strlen(avail) + 1; | - |
697 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
replace = calloc(1, maxlen)) == TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
698 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
| 0-64 |
699 | ) { | - |
700 | r = -2; | - |
701 | goto never executed: goto out; out;never executed: goto out; | 0 |
702 | } | - |
703 | *replace = '\0'; | - |
704 | while ((TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
alg = TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
705 | __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
706 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
707 | ) && ((size_t)(const void *)((TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
708 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
709 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
710 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
711 | ) == 1) && (__r0 = ((const char *) (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
712 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
713 | ))[0], ((const char *) (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
714 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
715 | ))[0] != '\0') ? ((__r1 = ((const char *) (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
716 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
717 | ))[1], ((const char *) (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
718 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
719 | ))[1] == '\0') ? __strsep_1c (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
720 | &availTRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
721 | , __r0) : ((__r2 = ((const char *) (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
722 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
723 | ))[2], __r2 == '\0') ? __strsep_2c (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
724 | &availTRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
725 | , __r0, __r1) : (((const char *) (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
726 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
727 | ))[3] == '\0' ? __strsep_3c (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
728 | &availTRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
729 | , __r0, __r1, __r2) : __strsep_g (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
730 | &availTRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
731 | , TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
732 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
733 | )))) : __strsep_g (TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
734 | &availTRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
735 | , TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
736 | ","TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
737 | )); })TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
| 64 |
738 | )TRUE | evaluated 64 times by 1 test | FALSE | evaluated 64 times by 1 test |
&& *TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
alg != '\0'TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
) { | 0-64 |
739 | if ((TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
ktype = sshkey_type_from_name(alg)) == KEY_UNSPECTRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
740 | continue; never executed: continue; | 0 |
741 | for((k) = ((&ssh->public_keys)->tqh_first); (TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
k) != TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
742 | ((void *)0)TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
| 0-64 |
743 | ; (k) = ((k)->next.tqe_next)) { | - |
744 | if (k->key->type == ktypeTRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
|| | 0-64 |
745 | (sshkey_is_cert(k->key)TRUE | never evaluated | FALSE | never evaluated |
&& k->key->type ==TRUE | never evaluated | FALSE | never evaluated |
| 0 |
746 | sshkey_type_plain(ktype)TRUE | never evaluated | FALSE | never evaluated |
)) { | 0 |
747 | if (*TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
replace != '\0'TRUE | never evaluated | FALSE | evaluated 64 times by 1 test |
) | 0-64 |
748 | strlcat(replace, ",", maxlen); never executed: strlcat(replace, ",", maxlen); | 0 |
749 | strlcat(replace, alg, maxlen); | - |
750 | break;executed 64 times by 1 test: break; | 64 |
751 | } | - |
752 | } never executed: end of block | 0 |
753 | }executed 64 times by 1 test: end of block | 64 |
754 | if (*TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
replace != '\0'TRUE | evaluated 64 times by 1 test | FALSE | never evaluated |
) { | 0-64 |
755 | debug2("%s: orig/%d %s", __func__, ssh->kex->server, orig); | - |
756 | debug2("%s: replace/%d %s", __func__, ssh->kex->server, replace); | - |
757 | free(orig); | - |
758 | proposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = replace; | - |
759 | replace = | - |
760 | ((void *)0) | - |
761 | ; | - |
762 | r = kex_prop2buf(ssh->kex->my, proposal); | - |
763 | }executed 64 times by 1 test: end of block | 64 |
764 | out:code before this statement executed 64 times by 1 test: out: | 64 |
765 | free(oavail); | - |
766 | free(replace); | - |
767 | kex_prop_free(proposal); | - |
768 | returnexecuted 64 times by 1 test: return r; r;executed 64 times by 1 test: return r; | 64 |
769 | } | - |
770 | | - |
771 | int | - |
772 | _ssh_host_key_sign(struct sshkey *privkey, struct sshkey *pubkey, | - |
773 | u_char **signature, size_t *slen, const u_char *data, size_t dlen, | - |
774 | const char *alg, u_int compat) | - |
775 | { | - |
776 | returnexecuted 160 times by 1 test: return sshkey_sign(privkey, signature, slen, data, dlen, alg, compat); sshkey_sign(privkey, signature, slen, data, dlen, alg, compat);executed 160 times by 1 test: return sshkey_sign(privkey, signature, slen, data, dlen, alg, compat); | 160 |
777 | } | - |
| | |