Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | struct macalg { | - |
13 | char *name; | - |
14 | int type; | - |
15 | int alg; | - |
16 | int truncatebits; | - |
17 | int key_len; | - |
18 | int len; | - |
19 | int etm; | - |
20 | }; | - |
21 | | - |
22 | static const struct macalg macs[] = { | - |
23 | | - |
24 | { "hmac-sha1", 1, 1, 0, 0, 0, 0 }, | - |
25 | { "hmac-sha1-96", 1, 1, 96, 0, 0, 0 }, | - |
26 | | - |
27 | { "hmac-sha2-256", 1, 2, 0, 0, 0, 0 }, | - |
28 | { "hmac-sha2-512", 1, 4, 0, 0, 0, 0 }, | - |
29 | | - |
30 | { "hmac-md5", 1, 0, 0, 0, 0, 0 }, | - |
31 | { "hmac-md5-96", 1, 0, 96, 0, 0, 0 }, | - |
32 | { "umac-64@openssh.com", 2, 0, 0, 128, 64, 0 }, | - |
33 | { "umac-128@openssh.com", 3, 0, 0, 128, 128, 0 }, | - |
34 | | - |
35 | | - |
36 | { "hmac-sha1-etm@openssh.com", 1, 1, 0, 0, 0, 1 }, | - |
37 | { "hmac-sha1-96-etm@openssh.com", 1, 1, 96, 0, 0, 1 }, | - |
38 | | - |
39 | { "hmac-sha2-256-etm@openssh.com", 1, 2, 0, 0, 0, 1 }, | - |
40 | { "hmac-sha2-512-etm@openssh.com", 1, 4, 0, 0, 0, 1 }, | - |
41 | | - |
42 | { "hmac-md5-etm@openssh.com", 1, 0, 0, 0, 0, 1 }, | - |
43 | { "hmac-md5-96-etm@openssh.com", 1, 0, 96, 0, 0, 1 }, | - |
44 | { "umac-64-etm@openssh.com", 2, 0, 0, 128, 64, 1 }, | - |
45 | { "umac-128-etm@openssh.com", 3, 0, 0, 128, 128, 1 }, | - |
46 | | - |
47 | { | - |
48 | ((void *)0) | - |
49 | , 0, 0, 0, 0, 0, 0 } | - |
50 | }; | - |
51 | | - |
52 | | - |
53 | char * | - |
54 | mac_alg_list(char sep) | - |
55 | { | - |
56 | char *ret = | - |
57 | ((void *)0) | - |
58 | , *tmp; | - |
59 | size_t nlen, rlen = 0; | - |
60 | const struct macalg *m; | - |
61 | | - |
62 | for (m = macs; m->name != TRUE | evaluated 32 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-32 |
63 | ((void *)0)TRUE | evaluated 32 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-32 |
64 | ; m++) { | - |
65 | if (ret != TRUE | evaluated 30 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-30 |
66 | ((void *)0)TRUE | evaluated 30 times by 1 test | FALSE | evaluated 2 times by 1 test |
| 2-30 |
67 | ) | - |
68 | ret[rlen++] = sep;executed 30 times by 1 test: ret[rlen++] = sep; | 30 |
69 | nlen = strlen(m->name); | - |
70 | if ((TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
tmp = realloc(ret, rlen + nlen + 2)) == TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
| 0-32 |
71 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 32 times by 1 test |
| 0-32 |
72 | ) { | - |
73 | free(ret); | - |
74 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 |
75 | ((void *)0) never executed: return ((void *)0) ; | 0 |
76 | ; never executed: return ((void *)0) ; | 0 |
77 | } | - |
78 | ret = tmp; | - |
79 | memcpy(ret + rlen, m->name, nlen + 1); | - |
80 | rlen += nlen; | - |
81 | }executed 32 times by 1 test: end of block | 32 |
82 | returnexecuted 2 times by 1 test: return ret; ret;executed 2 times by 1 test: return ret; | 2 |
83 | } | - |
84 | | - |
85 | static int | - |
86 | mac_setup_by_alg(struct sshmac *mac, const struct macalg *macalg) | - |
87 | { | - |
88 | mac->type = macalg->type; | - |
89 | if (mac->type == 1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
90 | if ((TRUE | never evaluated | FALSE | never evaluated |
mac->hmac_ctx = ssh_hmac_start(macalg->alg)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
91 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
92 | ) | - |
93 | return never executed: return -2; -2;never executed: return -2; | 0 |
94 | mac->key_len = mac->mac_len = ssh_hmac_bytes(macalg->alg); | - |
95 | } never executed: end of block else { | 0 |
96 | mac->mac_len = macalg->len / 8; | - |
97 | mac->key_len = macalg->key_len / 8; | - |
98 | mac->umac_ctx = | - |
99 | ((void *)0) | - |
100 | ; | - |
101 | } never executed: end of block | 0 |
102 | if (macalg->truncatebits != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
103 | mac->mac_len = macalg->truncatebits / 8; never executed: mac->mac_len = macalg->truncatebits / 8; | 0 |
104 | mac->etm = macalg->etm; | - |
105 | return never executed: return 0; 0;never executed: return 0; | 0 |
106 | } | - |
107 | | - |
108 | int | - |
109 | mac_setup(struct sshmac *mac, char *name) | - |
110 | { | - |
111 | const struct macalg *m; | - |
112 | | - |
113 | for (m = macs; m->name != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
114 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
115 | ; m++) { | - |
116 | if ( | - |
117 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
118 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
119 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
120 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
121 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
122 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
123 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
124 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
125 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
126 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
127 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
128 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
129 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
130 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
131 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
132 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
133 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
134 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
135 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
136 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
137 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
138 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
139 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
140 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
141 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
142 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
143 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
144 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
145 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
146 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
147 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
148 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
149 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
150 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
151 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
152 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
153 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
154 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
155 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
156 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
157 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
158 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
159 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
160 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
161 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
162 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
163 | ))[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 *) ( name ))[3] - __s2[3]); | 0 |
164 | nameTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( name ))[3] - __s2[3]); | 0 |
165 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
166 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
167 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
168 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
169 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
170 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
171 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
172 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
173 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
174 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
175 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
176 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
177 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
178 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
179 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
180 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
181 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
182 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
183 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
184 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
185 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
186 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
187 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
188 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
189 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
190 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
191 | ))[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 *) ( m->name ))[3] - __s2[3]); | 0 |
192 | m->nameTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( m->name ))[3] - __s2[3]); | 0 |
193 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
194 | nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
195 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
196 | m->nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
197 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
198 | != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
199 | continue; never executed: continue; | 0 |
200 | if (mac != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
201 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
202 | ) | - |
203 | return never executed: return mac_setup_by_alg(mac, m); mac_setup_by_alg(mac, m);never executed: return mac_setup_by_alg(mac, m); | 0 |
204 | return never executed: return 0; 0;never executed: return 0; | 0 |
205 | } | - |
206 | return never executed: return -10; -10;never executed: return -10; | 0 |
207 | } | - |
208 | | - |
209 | int | - |
210 | mac_init(struct sshmac *mac) | - |
211 | { | - |
212 | if (mac->key == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
213 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
214 | ) | - |
215 | return never executed: return -10; -10;never executed: return -10; | 0 |
216 | switch (mac->type) { | - |
217 | case never executed: case 1: 1:never executed: case 1: | 0 |
218 | if (mac->hmac_ctx == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
219 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
220 | || | - |
221 | ssh_hmac_init(mac->hmac_ctx, mac->key, mac->key_len) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
222 | return never executed: return -10; -10;never executed: return -10; | 0 |
223 | return never executed: return 0; 0;never executed: return 0; | 0 |
224 | case never executed: case 2: 2:never executed: case 2: | 0 |
225 | if ((TRUE | never evaluated | FALSE | never evaluated |
mac->umac_ctx = umac_new(mac->key)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
226 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
227 | ) | - |
228 | return never executed: return -2; -2;never executed: return -2; | 0 |
229 | return never executed: return 0; 0;never executed: return 0; | 0 |
230 | case never executed: case 3: 3:never executed: case 3: | 0 |
231 | if ((TRUE | never evaluated | FALSE | never evaluated |
mac->umac_ctx = umac128_new(mac->key)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
232 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
233 | ) | - |
234 | return never executed: return -2; -2;never executed: return -2; | 0 |
235 | return never executed: return 0; 0;never executed: return 0; | 0 |
236 | default never executed: default: :never executed: default: | 0 |
237 | return never executed: return -10; -10;never executed: return -10; | 0 |
238 | } | - |
239 | } | - |
240 | | - |
241 | int | - |
242 | mac_compute(struct sshmac *mac, u_int32_t seqno, | - |
243 | const u_char *data, int datalen, | - |
244 | u_char *digest, size_t dlen) | - |
245 | { | - |
246 | static union { | - |
247 | u_char m[64]; | - |
248 | u_int64_t for_align; | - |
249 | } u; | - |
250 | u_char b[4]; | - |
251 | u_char nonce[8]; | - |
252 | | - |
253 | if (mac->mac_len > sizeof(u)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
254 | return never executed: return -1; -1;never executed: return -1; | 0 |
255 | | - |
256 | switch (mac->type) { | - |
257 | case never executed: case 1: 1:never executed: case 1: | 0 |
258 | put_u32(b, seqno); | - |
259 | | - |
260 | if (ssh_hmac_init(mac->hmac_ctx, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
261 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
262 | , 0) < 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
263 | ssh_hmac_update(mac->hmac_ctx, b, sizeof(b)) < 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
264 | ssh_hmac_update(mac->hmac_ctx, data, datalen) < 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
265 | ssh_hmac_final(mac->hmac_ctx, u.m, sizeof(u.m)) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
266 | return never executed: return -22; -22;never executed: return -22; | 0 |
267 | break; never executed: break; | 0 |
268 | case never executed: case 2: 2:never executed: case 2: | 0 |
269 | do { const u_int64_t __v = (seqno); ((u_char *)(nonce))[0] = (__v >> 56) & 0xff; ((u_char *)(nonce))[1] = (__v >> 48) & 0xff; ((u_char *)(nonce))[2] = (__v >> 40) & 0xff; ((u_char *)(nonce))[3] = (__v >> 32) & 0xff; ((u_char *)(nonce))[4] = (__v >> 24) & 0xff; ((u_char *)(nonce))[5] = (__v >> 16) & 0xff; ((u_char *)(nonce))[6] = (__v >> 8) & 0xff; ((u_char *)(nonce))[7] = __v & 0xff; } while (0); | - |
270 | umac_update(mac->umac_ctx, data, datalen); | - |
271 | umac_final(mac->umac_ctx, u.m, nonce); | - |
272 | break; never executed: break; | 0 |
273 | case never executed: case 3: 3:never executed: case 3: | 0 |
274 | put_u64(nonce, seqno); | - |
275 | umac128_update(mac->umac_ctx, data, datalen); | - |
276 | umac128_final(mac->umac_ctx, u.m, nonce); | - |
277 | break; never executed: break; | 0 |
278 | default never executed: default: :never executed: default: | 0 |
279 | return never executed: return -10; -10;never executed: return -10; | 0 |
280 | } | - |
281 | if (digest != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
282 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
283 | ) { | - |
284 | if (dlen > mac->mac_lenTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
285 | dlen = mac->mac_len; never executed: dlen = mac->mac_len; | 0 |
286 | memcpy(digest, u.m, dlen); | - |
287 | } never executed: end of block | 0 |
288 | return never executed: return 0; 0;never executed: return 0; | 0 |
289 | } | - |
290 | | - |
291 | int | - |
292 | mac_check(struct sshmac *mac, u_int32_t seqno, | - |
293 | const u_char *data, size_t dlen, | - |
294 | const u_char *theirmac, size_t mlen) | - |
295 | { | - |
296 | u_char ourmac[64]; | - |
297 | int r; | - |
298 | | - |
299 | if (mac->mac_len > mlenTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
300 | return never executed: return -10; -10;never executed: return -10; | 0 |
301 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = mac_compute(mac, seqno, data, dlen,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
302 | ourmac, sizeof(ourmac))) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
303 | return never executed: return r; r;never executed: return r; | 0 |
304 | if (timingsafe_bcmp(ourmac, theirmac, mac->mac_len) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
305 | return never executed: return -30; -30;never executed: return -30; | 0 |
306 | return never executed: return 0; 0;never executed: return 0; | 0 |
307 | } | - |
308 | | - |
309 | void | - |
310 | mac_clear(struct sshmac *mac) | - |
311 | { | - |
312 | if (mac->type == 2TRUE | never evaluated | FALSE | evaluated 704 times by 1 test |
) { | 0-704 |
313 | if (mac->umac_ctx != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
314 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
315 | ) | - |
316 | umac_delete(mac->umac_ctx); never executed: umac_delete(mac->umac_ctx); | 0 |
317 | } never executed: end of block else if (mac->type == 3TRUE | never evaluated | FALSE | evaluated 704 times by 1 test |
) { | 0-704 |
318 | if (mac->umac_ctx != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
319 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
320 | ) | - |
321 | umac128_delete(mac->umac_ctx); never executed: umac128_delete(mac->umac_ctx); | 0 |
322 | } never executed: end of block else if (mac->hmac_ctx != TRUE | never evaluated | FALSE | evaluated 704 times by 1 test |
| 0-704 |
323 | ((void *)0)TRUE | never evaluated | FALSE | evaluated 704 times by 1 test |
| 0-704 |
324 | ) | - |
325 | ssh_hmac_free(mac->hmac_ctx); never executed: ssh_hmac_free(mac->hmac_ctx); | 0 |
326 | mac->hmac_ctx = | - |
327 | ((void *)0) | - |
328 | ; | - |
329 | mac->umac_ctx = | - |
330 | ((void *)0) | - |
331 | ; | - |
332 | }executed 704 times by 1 test: end of block | 704 |
333 | | - |
334 | | - |
335 | | - |
336 | int | - |
337 | mac_valid(const char *names) | - |
338 | { | - |
339 | char *maclist, *cp, *p; | - |
340 | | - |
341 | if (names == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
342 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
343 | || | - |
344 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
345 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
346 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
347 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
348 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
349 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
350 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
351 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
352 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
353 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
354 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
355 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
356 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
357 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
358 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
359 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
360 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
361 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
362 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
363 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
364 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
365 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
366 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
367 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
368 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
369 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
370 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
371 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
372 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
373 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
374 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
375 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
376 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
377 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
378 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
379 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
380 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
381 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
382 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
383 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
384 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
385 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
386 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
387 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
388 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
389 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
390 | ))[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 *) ( names ))[3] - __s2[3]); | 0 |
391 | namesTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( names ))[3] - __s2[3]); | 0 |
392 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
393 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
394 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
395 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
396 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
397 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
398 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
399 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
400 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
401 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
402 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
403 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
404 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
405 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
406 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
407 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
408 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
409 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
410 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
411 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
412 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
413 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
414 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
415 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
416 | ))[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 | never evaluated | FALSE | never evaluated |
| 0 |
417 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
418 | ))[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 *) ( "" ))[3] - __s2[3]); | 0 |
419 | ""TRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( "" ))[3] - __s2[3]); | 0 |
420 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
421 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
422 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
423 | ""TRUE | never evaluated | FALSE | never evaluated |
| 0 |
424 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
425 | == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
426 | return never executed: return 0; 0;never executed: return 0; | 0 |
427 | if ((TRUE | never evaluated | FALSE | never evaluated |
maclist = cp = TRUE | never evaluated | FALSE | never evaluated |
| 0 |
428 | (__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
429 | namesTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
430 | )TRUE | never evaluated | FALSE | never evaluated |
&& ((TRUE | never evaluated | FALSE | never evaluated |
size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
431 | namesTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
432 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
433 | namesTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
434 | ) == 1)TRUE | never evaluated | FALSE | never evaluated |
? (((constTRUE | never evaluated | FALSE | never evaluated |
char *) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
435 | namesTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
436 | ))[0] == '\0'TRUE | never evaluated | FALSE | never evaluated |
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
437 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
438 | ) + 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, names , __len); | 0 |
439 | namesTRUE | never evaluated | FALSE | never evaluated |
never executed: __retval = (char *) memcpy (__retval, names , __len); | 0 |
440 | , __len); __retval; })) : __strdup (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
441 | namesTRUE | never evaluated | FALSE | never evaluated |
| 0 |
442 | )))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
443 | ) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
444 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
445 | ) | - |
446 | return never executed: return 0; 0;never executed: return 0; | 0 |
447 | for ((p = | - |
448 | __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p ( | - |
449 | "," | - |
450 | ) && ((size_t)(const void *)(( | - |
451 | "," | - |
452 | ) + 1) - (size_t)(const void *)( | - |
453 | "," | - |
454 | ) == 1) && (__r0 = ((const char *) ( | - |
455 | "," | - |
456 | ))[0], ((const char *) ( | - |
457 | "," | - |
458 | ))[0] != '\0') ? ((__r1 = ((const char *) ( | - |
459 | "," | - |
460 | ))[1], ((const char *) ( | - |
461 | "," | - |
462 | ))[1] == '\0') ? __strsep_1c ( | - |
463 | &cp | - |
464 | , __r0) : ((__r2 = ((const char *) ( | - |
465 | "," | - |
466 | ))[2], __r2 == '\0') ? __strsep_2c ( | - |
467 | &cp | - |
468 | , __r0, __r1) : (((const char *) ( | - |
469 | "," | - |
470 | ))[3] == '\0' ? __strsep_3c ( | - |
471 | &cp | - |
472 | , __r0, __r1, __r2) : __strsep_g ( | - |
473 | &cp | - |
474 | , | - |
475 | "," | - |
476 | )))) : __strsep_g ( | - |
477 | &cp | - |
478 | , | - |
479 | "," | - |
480 | )); }) | - |
481 | ); pTRUE | never evaluated | FALSE | never evaluated |
&& *TRUE | never evaluated | FALSE | never evaluated |
p != '\0'TRUE | never evaluated | FALSE | never evaluated |
; | 0 |
482 | (p = | - |
483 | __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p ( | - |
484 | "," | - |
485 | ) && ((size_t)(const void *)(( | - |
486 | "," | - |
487 | ) + 1) - (size_t)(const void *)( | - |
488 | "," | - |
489 | ) == 1) && (__r0 = ((const char *) ( | - |
490 | "," | - |
491 | ))[0], ((const char *) ( | - |
492 | "," | - |
493 | ))[0] != '\0') ? ((__r1 = ((const char *) ( | - |
494 | "," | - |
495 | ))[1], ((const char *) ( | - |
496 | "," | - |
497 | ))[1] == '\0') ? __strsep_1c ( | - |
498 | &cp | - |
499 | , __r0) : ((__r2 = ((const char *) ( | - |
500 | "," | - |
501 | ))[2], __r2 == '\0') ? __strsep_2c ( | - |
502 | &cp | - |
503 | , __r0, __r1) : (((const char *) ( | - |
504 | "," | - |
505 | ))[3] == '\0' ? __strsep_3c ( | - |
506 | &cp | - |
507 | , __r0, __r1, __r2) : __strsep_g ( | - |
508 | &cp | - |
509 | , | - |
510 | "," | - |
511 | )))) : __strsep_g ( | - |
512 | &cp | - |
513 | , | - |
514 | "," | - |
515 | )); }) | - |
516 | )) { | - |
517 | if (mac_setup(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
518 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
519 | , p) < 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
520 | free(maclist); | - |
521 | return never executed: return 0; 0;never executed: return 0; | 0 |
522 | } | - |
523 | } never executed: end of block | 0 |
524 | free(maclist); | - |
525 | return never executed: return 1; 1;never executed: return 1; | 0 |
526 | } | - |
| | |