Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/packet.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) | - | ||||||||||||
5 | { | - | ||||||||||||
6 | if (!WPACKET_reserve_bytes(pkt, len, allocbytes)
| 5-1301556 | ||||||||||||
7 | return executed 5 times by 1 test: 0;return 0; Executed by:
executed 5 times by 1 test: return 0; Executed by:
| 5 | ||||||||||||
8 | - | |||||||||||||
9 | pkt->written += len; | - | ||||||||||||
10 | pkt->curr += len; | - | ||||||||||||
11 | return executed 1301556 times by 4 tests: 1;return 1; Executed by:
executed 1301556 times by 4 tests: return 1; Executed by:
| 1301556 | ||||||||||||
12 | } | - | ||||||||||||
13 | - | |||||||||||||
14 | int WPACKET_sub_allocate_bytes__(WPACKET *pkt, size_t len, | - | ||||||||||||
15 | unsigned char **allocbytes, size_t lenbytes) | - | ||||||||||||
16 | { | - | ||||||||||||
17 | if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
| 0-3776 | ||||||||||||
18 | || !WPACKET_allocate_bytes(pkt, len, allocbytes)
| 0-3776 | ||||||||||||
19 | || !WPACKET_close(pkt)
| 0-3776 | ||||||||||||
20 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
21 | - | |||||||||||||
22 | return executed 3776 times by 2 tests: 1;return 1; Executed by:
executed 3776 times by 2 tests: return 1; Executed by:
| 3776 | ||||||||||||
23 | } | - | ||||||||||||
24 | - | |||||||||||||
25 | - | |||||||||||||
26 | - | |||||||||||||
27 | - | |||||||||||||
28 | int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) | - | ||||||||||||
29 | { | - | ||||||||||||
30 | - | |||||||||||||
31 | if (!((pkt->subs !=
| 0-1387935 | ||||||||||||
32 | ((void *)0)
| 0-1387935 | ||||||||||||
33 | && len != 0
| 0-1387935 | ||||||||||||
34 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
35 | - | |||||||||||||
36 | if (pkt->maxsize - pkt->written < len
| 5-1387930 | ||||||||||||
37 | return executed 5 times by 1 test: 0;return 0; Executed by:
executed 5 times by 1 test: return 0; Executed by:
| 5 | ||||||||||||
38 | - | |||||||||||||
39 | if (pkt->staticbuf ==
| 584423-803507 | ||||||||||||
40 | ((void *)0)
| 584423-803507 | ||||||||||||
41 | && (
| 5527-797980 | ||||||||||||
42 | size_t newlen; | - | ||||||||||||
43 | size_t reflen; | - | ||||||||||||
44 | - | |||||||||||||
45 | reflen = (
| 2178-3349 | ||||||||||||
46 | - | |||||||||||||
47 | if (reflen >
| 0-5527 | ||||||||||||
48 | (18446744073709551615UL)
| 0-5527 | ||||||||||||
49 | / 2
| 0-5527 | ||||||||||||
50 | newlen = | - | ||||||||||||
51 | (18446744073709551615UL) | - | ||||||||||||
52 | ; | - | ||||||||||||
53 | } never executed: else {end of block | 0 | ||||||||||||
54 | newlen = reflen * 2; | - | ||||||||||||
55 | if (newlen < 256
| 2362-3165 | ||||||||||||
56 | newlen = 256; executed 2362 times by 2 tests: newlen = 256; Executed by:
| 2362 | ||||||||||||
57 | } executed 5527 times by 2 tests: end of block Executed by:
| 5527 | ||||||||||||
58 | if (BUF_MEM_grow(pkt->buf, newlen) == 0
| 0-5527 | ||||||||||||
59 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
60 | } executed 5527 times by 2 tests: end of block Executed by:
| 5527 | ||||||||||||
61 | if (allocbytes !=
| 108484-1279446 | ||||||||||||
62 | ((void *)0)
| 108484-1279446 | ||||||||||||
63 | ) | - | ||||||||||||
64 | * executed 1279446 times by 4 tests: allocbytes = WPACKET_get_curr(pkt);*allocbytes = WPACKET_get_curr(pkt); Executed by:
executed 1279446 times by 4 tests: *allocbytes = WPACKET_get_curr(pkt); Executed by:
| 1279446 | ||||||||||||
65 | - | |||||||||||||
66 | return executed 1387930 times by 4 tests: 1;return 1; Executed by:
executed 1387930 times by 4 tests: return 1; Executed by:
| 1387930 | ||||||||||||
67 | } | - | ||||||||||||
68 | - | |||||||||||||
69 | int WPACKET_sub_reserve_bytes__(WPACKET *pkt, size_t len, | - | ||||||||||||
70 | unsigned char **allocbytes, size_t lenbytes) | - | ||||||||||||
71 | { | - | ||||||||||||
72 | if (!WPACKET_reserve_bytes(pkt, lenbytes + len, allocbytes)
| 0-1114 | ||||||||||||
73 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
74 | - | |||||||||||||
75 | *allocbytes += lenbytes; | - | ||||||||||||
76 | - | |||||||||||||
77 | return executed 1114 times by 1 test: 1;return 1; Executed by:
executed 1114 times by 1 test: return 1; Executed by:
| 1114 | ||||||||||||
78 | } | - | ||||||||||||
79 | - | |||||||||||||
80 | static size_t maxmaxsize(size_t lenbytes) | - | ||||||||||||
81 | { | - | ||||||||||||
82 | if (lenbytes >= sizeof(size_t)
| 16-128620 | ||||||||||||
83 | return executed 133599 times by 4 tests: return (18446744073709551615UL) ; Executed by:
executed 133599 times by 4 tests: return (18446744073709551615UL) ; Executed by:
| 133599 | ||||||||||||
84 | (18446744073709551615UL) executed 133599 times by 4 tests: return (18446744073709551615UL) ; Executed by:
| 133599 | ||||||||||||
85 | ; executed 133599 times by 4 tests: return (18446744073709551615UL) ; Executed by:
| 133599 | ||||||||||||
86 | - | |||||||||||||
87 | return executed 16 times by 1 test: ((size_t)1 << (lenbytes * 8)) - 1 + lenbytes;return ((size_t)1 << (lenbytes * 8)) - 1 + lenbytes; Executed by:
executed 16 times by 1 test: return ((size_t)1 << (lenbytes * 8)) - 1 + lenbytes; Executed by:
| 16 | ||||||||||||
88 | } | - | ||||||||||||
89 | - | |||||||||||||
90 | static int wpacket_intern_init_len(WPACKET *pkt, size_t lenbytes) | - | ||||||||||||
91 | { | - | ||||||||||||
92 | unsigned char *lenchars; | - | ||||||||||||
93 | - | |||||||||||||
94 | pkt->curr = 0; | - | ||||||||||||
95 | pkt->written = 0; | - | ||||||||||||
96 | - | |||||||||||||
97 | if ((
| 0-128615 | ||||||||||||
98 | ((void *)0)
| 0-128615 | ||||||||||||
99 | ) { | - | ||||||||||||
100 | ERR_put_error(20,(633),((1|64)),__FILE__,98); | - | ||||||||||||
101 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
102 | } | - | ||||||||||||
103 | - | |||||||||||||
104 | if (lenbytes == 0
| 11-128604 | ||||||||||||
105 | return executed 128604 times by 4 tests: 1;return 1; Executed by:
executed 128604 times by 4 tests: return 1; Executed by:
| 128604 | ||||||||||||
106 | - | |||||||||||||
107 | pkt->subs->pwritten = lenbytes; | - | ||||||||||||
108 | pkt->subs->lenbytes = lenbytes; | - | ||||||||||||
109 | - | |||||||||||||
110 | if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)
| 0-11 | ||||||||||||
111 | CRYPTO_free(pkt->subs, __FILE__, 109); | - | ||||||||||||
112 | pkt->subs = | - | ||||||||||||
113 | ((void *)0) | - | ||||||||||||
114 | ; | - | ||||||||||||
115 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
116 | } | - | ||||||||||||
117 | pkt->subs->packet_len = lenchars - (((
| 1-10 | ||||||||||||
118 | ((void *)0)
| 1-10 | ||||||||||||
119 | )
| 1-10 | ||||||||||||
120 | - | |||||||||||||
121 | return executed 11 times by 1 test: 1;return 1; Executed by:
executed 11 times by 1 test: return 1; Executed by:
| 11 | ||||||||||||
122 | } | - | ||||||||||||
123 | - | |||||||||||||
124 | int WPACKET_init_static_len(WPACKET *pkt, unsigned char *buf, size_t len, | - | ||||||||||||
125 | size_t lenbytes) | - | ||||||||||||
126 | { | - | ||||||||||||
127 | size_t max = maxmaxsize(lenbytes); | - | ||||||||||||
128 | - | |||||||||||||
129 | - | |||||||||||||
130 | if (!((buf !=
| 0-102574 | ||||||||||||
131 | ((void *)0)
| 0-102574 | ||||||||||||
132 | && len > 0
| 0-102574 | ||||||||||||
133 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
134 | - | |||||||||||||
135 | pkt->staticbuf = buf; | - | ||||||||||||
136 | pkt->buf = | - | ||||||||||||
137 | ((void *)0) | - | ||||||||||||
138 | ; | - | ||||||||||||
139 | pkt->maxsize = (
| 0-102574 | ||||||||||||
140 | - | |||||||||||||
141 | return executed 102574 times by 4 tests: wpacket_intern_init_len(pkt, lenbytes);return wpacket_intern_init_len(pkt, lenbytes); Executed by:
executed 102574 times by 4 tests: return wpacket_intern_init_len(pkt, lenbytes); Executed by:
| 102574 | ||||||||||||
142 | } | - | ||||||||||||
143 | - | |||||||||||||
144 | int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes) | - | ||||||||||||
145 | { | - | ||||||||||||
146 | - | |||||||||||||
147 | if (!((buf !=
| 0-26041 | ||||||||||||
148 | ((void *)0)
| 0-26041 | ||||||||||||
149 | ) != 0)
| 0-26041 | ||||||||||||
150 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
151 | - | |||||||||||||
152 | pkt->staticbuf = | - | ||||||||||||
153 | ((void *)0) | - | ||||||||||||
154 | ; | - | ||||||||||||
155 | pkt->buf = buf; | - | ||||||||||||
156 | pkt->maxsize = maxmaxsize(lenbytes); | - | ||||||||||||
157 | - | |||||||||||||
158 | return executed 26041 times by 2 tests: wpacket_intern_init_len(pkt, lenbytes);return wpacket_intern_init_len(pkt, lenbytes); Executed by:
executed 26041 times by 2 tests: return wpacket_intern_init_len(pkt, lenbytes); Executed by:
| 26041 | ||||||||||||
159 | } | - | ||||||||||||
160 | - | |||||||||||||
161 | int WPACKET_init(WPACKET *pkt, BUF_MEM *buf) | - | ||||||||||||
162 | { | - | ||||||||||||
163 | return executed 26031 times by 2 tests: WPACKET_init_len(pkt, buf, 0);return WPACKET_init_len(pkt, buf, 0); Executed by:
executed 26031 times by 2 tests: return WPACKET_init_len(pkt, buf, 0); Executed by:
| 26031 | ||||||||||||
164 | } | - | ||||||||||||
165 | - | |||||||||||||
166 | int WPACKET_set_flags(WPACKET *pkt, unsigned int flags) | - | ||||||||||||
167 | { | - | ||||||||||||
168 | - | |||||||||||||
169 | if (!((pkt->subs !=
| 0-6485 | ||||||||||||
170 | ((void *)0)
| 0-6485 | ||||||||||||
171 | ) != 0)
| 0-6485 | ||||||||||||
172 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
173 | - | |||||||||||||
174 | pkt->subs->flags = flags; | - | ||||||||||||
175 | - | |||||||||||||
176 | return executed 6485 times by 2 tests: 1;return 1; Executed by:
executed 6485 times by 2 tests: return 1; Executed by:
| 6485 | ||||||||||||
177 | } | - | ||||||||||||
178 | - | |||||||||||||
179 | - | |||||||||||||
180 | static int put_value(unsigned char *data, size_t value, size_t len) | - | ||||||||||||
181 | { | - | ||||||||||||
182 | for (data += len - 1; len > 0
| 1069608-1953018 | ||||||||||||
183 | *data = (unsigned char)(value & 0xff); | - | ||||||||||||
184 | data--; | - | ||||||||||||
185 | value >>= 8; | - | ||||||||||||
186 | } executed 1953018 times by 4 tests: end of block Executed by:
| 1953018 | ||||||||||||
187 | - | |||||||||||||
188 | - | |||||||||||||
189 | if (value > 0
| 0-1069608 | ||||||||||||
190 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
191 | - | |||||||||||||
192 | return executed 1069608 times by 4 tests: 1;return 1; Executed by:
executed 1069608 times by 4 tests: return 1; Executed by:
| 1069608 | ||||||||||||
193 | } | - | ||||||||||||
194 | static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) | - | ||||||||||||
195 | { | - | ||||||||||||
196 | size_t packlen = pkt->written - sub->pwritten; | - | ||||||||||||
197 | - | |||||||||||||
198 | if (packlen == 0
| 27343-339922 | ||||||||||||
199 | && (
| 2-27341 | ||||||||||||
200 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||
201 | - | |||||||||||||
202 | if (packlen == 0
| 27341-339922 | ||||||||||||
203 | && sub->flags & 2
| 74-27267 | ||||||||||||
204 | - | |||||||||||||
205 | if (!doclose
| 0-74 | ||||||||||||
206 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
207 | - | |||||||||||||
208 | - | |||||||||||||
209 | if ((
| 0-74 | ||||||||||||
210 | pkt->written -= sub->lenbytes; | - | ||||||||||||
211 | pkt->curr -= sub->lenbytes; | - | ||||||||||||
212 | } executed 74 times by 2 tests: end of block Executed by:
| 74 | ||||||||||||
213 | - | |||||||||||||
214 | - | |||||||||||||
215 | sub->packet_len = 0; | - | ||||||||||||
216 | sub->lenbytes = 0; | - | ||||||||||||
217 | } executed 74 times by 2 tests: end of block Executed by:
| 74 | ||||||||||||
218 | - | |||||||||||||
219 | - | |||||||||||||
220 | if (sub->lenbytes > 0
| 130293-236970 | ||||||||||||
221 | && !put_value(&(((pkt)->staticbuf !=
| 0-236970 | ||||||||||||
222 | ((void *)0)
| 0-236970 | ||||||||||||
223 | ) ? (pkt)->staticbuf : (unsigned char *)(pkt)->buf->data)[sub->packet_len], packlen,
| 0-236970 | ||||||||||||
224 | sub->lenbytes)
| 0-236970 | ||||||||||||
225 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
226 | - | |||||||||||||
227 | if (doclose
| 520-366743 | ||||||||||||
228 | pkt->subs = sub->parent; | - | ||||||||||||
229 | CRYPTO_free(sub, __FILE__, 219); | - | ||||||||||||
230 | } executed 366743 times by 4 tests: end of block Executed by:
| 366743 | ||||||||||||
231 | - | |||||||||||||
232 | return executed 367263 times by 4 tests: 1;return 1; Executed by:
executed 367263 times by 4 tests: return 1; Executed by:
| 367263 | ||||||||||||
233 | } | - | ||||||||||||
234 | - | |||||||||||||
235 | int WPACKET_fill_lengths(WPACKET *pkt) | - | ||||||||||||
236 | { | - | ||||||||||||
237 | WPACKET_SUB *sub; | - | ||||||||||||
238 | - | |||||||||||||
239 | if (!((pkt->subs !=
| 0-174 | ||||||||||||
240 | ((void *)0)
| 0-174 | ||||||||||||
241 | ) != 0)
| 0-174 | ||||||||||||
242 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
243 | - | |||||||||||||
244 | for (sub = pkt->subs; sub !=
| 174-520 | ||||||||||||
245 | ((void *)0)
| 174-520 | ||||||||||||
246 | ; sub = sub->parent) { | - | ||||||||||||
247 | if (!wpacket_intern_close(pkt, sub, 0)
| 0-520 | ||||||||||||
248 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
249 | } executed 520 times by 2 tests: end of block Executed by:
| 520 | ||||||||||||
250 | - | |||||||||||||
251 | return executed 174 times by 2 tests: 1;return 1; Executed by:
executed 174 times by 2 tests: return 1; Executed by:
| 174 | ||||||||||||
252 | } | - | ||||||||||||
253 | - | |||||||||||||
254 | int WPACKET_close(WPACKET *pkt) | - | ||||||||||||
255 | { | - | ||||||||||||
256 | - | |||||||||||||
257 | - | |||||||||||||
258 | - | |||||||||||||
259 | - | |||||||||||||
260 | if (pkt->subs ==
| 1-238224 | ||||||||||||
261 | ((void *)0)
| 1-238224 | ||||||||||||
262 | || pkt->subs->parent ==
| 2-238222 | ||||||||||||
263 | ((void *)0)
| 2-238222 | ||||||||||||
264 | ) | - | ||||||||||||
265 | return executed 3 times by 1 test: 0;return 0; Executed by:
executed 3 times by 1 test: return 0; Executed by:
| 3 | ||||||||||||
266 | - | |||||||||||||
267 | return executed 238222 times by 3 tests: wpacket_intern_close(pkt, pkt->subs, 1);return wpacket_intern_close(pkt, pkt->subs, 1); Executed by:
executed 238222 times by 3 tests: return wpacket_intern_close(pkt, pkt->subs, 1); Executed by:
| 238222 | ||||||||||||
268 | } | - | ||||||||||||
269 | - | |||||||||||||
270 | int WPACKET_finish(WPACKET *pkt) | - | ||||||||||||
271 | { | - | ||||||||||||
272 | int ret; | - | ||||||||||||
273 | - | |||||||||||||
274 | - | |||||||||||||
275 | - | |||||||||||||
276 | - | |||||||||||||
277 | - | |||||||||||||
278 | if (pkt->subs ==
| 1-128524 | ||||||||||||
279 | ((void *)0)
| 1-128524 | ||||||||||||
280 | || pkt->subs->parent !=
| 1-128523 | ||||||||||||
281 | ((void *)0)
| 1-128523 | ||||||||||||
282 | ) | - | ||||||||||||
283 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||
284 | - | |||||||||||||
285 | ret = wpacket_intern_close(pkt, pkt->subs, 1); | - | ||||||||||||
286 | if (ret
| 1-128522 | ||||||||||||
287 | CRYPTO_free(pkt->subs, __FILE__, 265); | - | ||||||||||||
288 | pkt->subs = | - | ||||||||||||
289 | ((void *)0) | - | ||||||||||||
290 | ; | - | ||||||||||||
291 | } executed 128522 times by 4 tests: end of block Executed by:
| 128522 | ||||||||||||
292 | - | |||||||||||||
293 | return executed 128523 times by 4 tests: ret;return ret; Executed by:
executed 128523 times by 4 tests: return ret; Executed by:
| 128523 | ||||||||||||
294 | } | - | ||||||||||||
295 | - | |||||||||||||
296 | int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) | - | ||||||||||||
297 | { | - | ||||||||||||
298 | WPACKET_SUB *sub; | - | ||||||||||||
299 | unsigned char *lenchars; | - | ||||||||||||
300 | - | |||||||||||||
301 | - | |||||||||||||
302 | if (!((pkt->subs !=
| 0-238342 | ||||||||||||
303 | ((void *)0)
| 0-238342 | ||||||||||||
304 | ) != 0)
| 0-238342 | ||||||||||||
305 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
306 | - | |||||||||||||
307 | if ((
| 0-238342 | ||||||||||||
308 | ((void *)0)
| 0-238342 | ||||||||||||
309 | ) { | - | ||||||||||||
310 | ERR_put_error(20,(634),((1|64)),__FILE__,282); | - | ||||||||||||
311 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
312 | } | - | ||||||||||||
313 | - | |||||||||||||
314 | sub->parent = pkt->subs; | - | ||||||||||||
315 | pkt->subs = sub; | - | ||||||||||||
316 | sub->pwritten = pkt->written + lenbytes; | - | ||||||||||||
317 | sub->lenbytes = lenbytes; | - | ||||||||||||
318 | - | |||||||||||||
319 | if (lenbytes == 0
| 1534-236808 | ||||||||||||
320 | sub->packet_len = 0; | - | ||||||||||||
321 | return executed 1534 times by 2 tests: 1;return 1; Executed by:
executed 1534 times by 2 tests: return 1; Executed by:
| 1534 | ||||||||||||
322 | } | - | ||||||||||||
323 | - | |||||||||||||
324 | if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)
| 0-236808 | ||||||||||||
325 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
326 | - | |||||||||||||
327 | sub->packet_len = lenchars - (((
| 96579-140229 | ||||||||||||
328 | ((void *)0)
| 96579-140229 | ||||||||||||
329 | )
| 96579-140229 | ||||||||||||
330 | - | |||||||||||||
331 | return executed 236808 times by 3 tests: 1;return 1; Executed by:
executed 236808 times by 3 tests: return 1; Executed by:
| 236808 | ||||||||||||
332 | } | - | ||||||||||||
333 | - | |||||||||||||
334 | int WPACKET_start_sub_packet(WPACKET *pkt) | - | ||||||||||||
335 | { | - | ||||||||||||
336 | return executed 1534 times by 2 tests: WPACKET_start_sub_packet_len__(pkt, 0);return WPACKET_start_sub_packet_len__(pkt, 0); Executed by:
executed 1534 times by 2 tests: return WPACKET_start_sub_packet_len__(pkt, 0); Executed by:
| 1534 | ||||||||||||
337 | } | - | ||||||||||||
338 | - | |||||||||||||
339 | int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) | - | ||||||||||||
340 | { | - | ||||||||||||
341 | unsigned char *data; | - | ||||||||||||
342 | - | |||||||||||||
343 | - | |||||||||||||
344 | if (!((size <= sizeof(unsigned int)) != 0)
| 0-832643 | ||||||||||||
345 | || !WPACKET_allocate_bytes(pkt, size, &data)
| 5-832638 | ||||||||||||
346 | || !put_value(data, val, size)
| 0-832638 | ||||||||||||
347 | return executed 5 times by 1 test: 0;return 0; Executed by:
executed 5 times by 1 test: return 0; Executed by:
| 5 | ||||||||||||
348 | - | |||||||||||||
349 | return executed 832638 times by 4 tests: 1;return 1; Executed by:
executed 832638 times by 4 tests: return 1; Executed by:
| 832638 | ||||||||||||
350 | } | - | ||||||||||||
351 | - | |||||||||||||
352 | int WPACKET_set_max_size(WPACKET *pkt, size_t maxsize) | - | ||||||||||||
353 | { | - | ||||||||||||
354 | WPACKET_SUB *sub; | - | ||||||||||||
355 | size_t lenbytes; | - | ||||||||||||
356 | - | |||||||||||||
357 | - | |||||||||||||
358 | if (!((pkt->subs !=
| 0-5000 | ||||||||||||
359 | ((void *)0)
| 0-5000 | ||||||||||||
360 | ) != 0)
| 0-5000 | ||||||||||||
361 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
362 | - | |||||||||||||
363 | - | |||||||||||||
364 | for (sub = pkt->subs; sub->parent !=
| 4992-5000 | ||||||||||||
365 | ((void *)0)
| 4992-5000 | ||||||||||||
366 | ; sub = sub->parent) | - | ||||||||||||
367 | continue; executed 4992 times by 1 test: continue; Executed by:
| 4992 | ||||||||||||
368 | - | |||||||||||||
369 | lenbytes = sub->lenbytes; | - | ||||||||||||
370 | if (lenbytes == 0
| 5-4995 | ||||||||||||
371 | lenbytes = sizeof(pkt->maxsize); executed 4995 times by 2 tests: lenbytes = sizeof(pkt->maxsize); Executed by:
| 4995 | ||||||||||||
372 | - | |||||||||||||
373 | if (maxmaxsize(lenbytes) < maxsize
| 1-4999 | ||||||||||||
374 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||
375 | - | |||||||||||||
376 | pkt->maxsize = maxsize; | - | ||||||||||||
377 | - | |||||||||||||
378 | return executed 4998 times by 2 tests: 1;return 1; Executed by:
executed 4998 times by 2 tests: return 1; Executed by:
| 4998 | ||||||||||||
379 | } | - | ||||||||||||
380 | - | |||||||||||||
381 | int WPACKET_memset(WPACKET *pkt, int ch, size_t len) | - | ||||||||||||
382 | { | - | ||||||||||||
383 | unsigned char *dest; | - | ||||||||||||
384 | - | |||||||||||||
385 | if (len == 0
| 0-11 | ||||||||||||
386 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
387 | - | |||||||||||||
388 | if (!WPACKET_allocate_bytes(pkt, len, &dest)
| 0-11 | ||||||||||||
389 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
390 | - | |||||||||||||
391 | memset(dest, ch, len); | - | ||||||||||||
392 | - | |||||||||||||
393 | return executed 11 times by 1 test: 1;return 1; Executed by:
executed 11 times by 1 test: return 1; Executed by:
| 11 | ||||||||||||
394 | } | - | ||||||||||||
395 | - | |||||||||||||
396 | int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) | - | ||||||||||||
397 | { | - | ||||||||||||
398 | unsigned char *dest; | - | ||||||||||||
399 | - | |||||||||||||
400 | if (len == 0
| 23885-147944 | ||||||||||||
401 | return executed 23885 times by 2 tests: 1;return 1; Executed by:
executed 23885 times by 2 tests: return 1; Executed by:
| 23885 | ||||||||||||
402 | - | |||||||||||||
403 | if (!WPACKET_allocate_bytes(pkt, len, &dest)
| 0-147944 | ||||||||||||
404 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
405 | - | |||||||||||||
406 | memcpy(dest, src, len); | - | ||||||||||||
407 | - | |||||||||||||
408 | return executed 147944 times by 3 tests: 1;return 1; Executed by:
executed 147944 times by 3 tests: return 1; Executed by:
| 147944 | ||||||||||||
409 | } | - | ||||||||||||
410 | - | |||||||||||||
411 | int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, | - | ||||||||||||
412 | size_t lenbytes) | - | ||||||||||||
413 | { | - | ||||||||||||
414 | if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
| 0-53436 | ||||||||||||
415 | || !WPACKET_memcpy(pkt, src, len)
| 0-53436 | ||||||||||||
416 | || !WPACKET_close(pkt)
| 0-53436 | ||||||||||||
417 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
418 | - | |||||||||||||
419 | return executed 53436 times by 3 tests: 1;return 1; Executed by:
executed 53436 times by 3 tests: return 1; Executed by:
| 53436 | ||||||||||||
420 | } | - | ||||||||||||
421 | - | |||||||||||||
422 | int WPACKET_get_total_written(WPACKET *pkt, size_t *written) | - | ||||||||||||
423 | { | - | ||||||||||||
424 | - | |||||||||||||
425 | if (!((written !=
| 0-66553 | ||||||||||||
426 | ((void *)0)
| 0-66553 | ||||||||||||
427 | ) != 0)
| 0-66553 | ||||||||||||
428 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
429 | - | |||||||||||||
430 | *written = pkt->written; | - | ||||||||||||
431 | - | |||||||||||||
432 | return executed 66553 times by 4 tests: 1;return 1; Executed by:
executed 66553 times by 4 tests: return 1; Executed by:
| 66553 | ||||||||||||
433 | } | - | ||||||||||||
434 | - | |||||||||||||
435 | int WPACKET_get_length(WPACKET *pkt, size_t *len) | - | ||||||||||||
436 | { | - | ||||||||||||
437 | - | |||||||||||||
438 | if (!((pkt->subs !=
| 0-150196 | ||||||||||||
439 | ((void *)0)
| 0-150196 | ||||||||||||
440 | && len !=
| 0-150196 | ||||||||||||
441 | ((void *)0)
| 0-150196 | ||||||||||||
442 | ) != 0)
| 0-150196 | ||||||||||||
443 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
444 | - | |||||||||||||
445 | *len = pkt->written - pkt->subs->pwritten; | - | ||||||||||||
446 | - | |||||||||||||
447 | return executed 150196 times by 2 tests: 1;return 1; Executed by:
executed 150196 times by 2 tests: return 1; Executed by:
| 150196 | ||||||||||||
448 | } | - | ||||||||||||
449 | - | |||||||||||||
450 | unsigned char *WPACKET_get_curr(WPACKET *pkt) | - | ||||||||||||
451 | { | - | ||||||||||||
452 | return executed 1320670 times by 4 tests: (((return (((pkt)->staticbuf != ((void *)0) ) ? (pkt)->staticbuf : (unsigned char *)(pkt)->buf->data) + pkt->curr; Executed by:
executed 1320670 times by 4 tests: return (((pkt)->staticbuf != ((void *)0) ) ? (pkt)->staticbuf : (unsigned char *)(pkt)->buf->data) + pkt->curr; Executed by:
| 516990-1320670 | ||||||||||||
453 | ((void *)0)
executed 1320670 times by 4 tests: return (((pkt)->staticbuf != ((void *)0) ) ? (pkt)->staticbuf : (unsigned char *)(pkt)->buf->data) + pkt->curr; Executed by:
| 516990-1320670 | ||||||||||||
454 | )
executed 1320670 times by 4 tests: return (((pkt)->staticbuf != ((void *)0) ) ? (pkt)->staticbuf : (unsigned char *)(pkt)->buf->data) + pkt->curr; Executed by:
| 516990-1320670 | ||||||||||||
455 | } | - | ||||||||||||
456 | - | |||||||||||||
457 | void WPACKET_cleanup(WPACKET *pkt) | - | ||||||||||||
458 | { | - | ||||||||||||
459 | WPACKET_SUB *sub, *parent; | - | ||||||||||||
460 | - | |||||||||||||
461 | for (sub = pkt->subs; sub !=
| 93-214 | ||||||||||||
462 | ((void *)0)
| 93-214 | ||||||||||||
463 | ; sub = parent) { | - | ||||||||||||
464 | parent = sub->parent; | - | ||||||||||||
465 | CRYPTO_free(sub, __FILE__, 421); | - | ||||||||||||
466 | } executed 214 times by 1 test: end of block Executed by:
| 214 | ||||||||||||
467 | pkt->subs = | - | ||||||||||||
468 | ((void *)0) | - | ||||||||||||
469 | ; | - | ||||||||||||
470 | } executed 93 times by 1 test: end of block Executed by:
| 93 | ||||||||||||
Switch to Source code | Preprocessed file |