OpenCoverage

bf_buff.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/bf_buff.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static int buffer_write(BIO *h, const char *buf, int num);-
4static int buffer_read(BIO *h, char *buf, int size);-
5static int buffer_puts(BIO *h, const char *str);-
6static int buffer_gets(BIO *h, char *str, int size);-
7static long buffer_ctrl(BIO *h, int cmd, long arg1, void *arg2);-
8static int buffer_new(BIO *h);-
9static int buffer_free(BIO *data);-
10static long buffer_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);-
11-
12-
13static const BIO_METHOD methods_buffer = {-
14 ( 9|0x0200),-
15 "buffer",-
16-
17 bwrite_conv,-
18 buffer_write,-
19-
20 bread_conv,-
21 buffer_read,-
22 buffer_puts,-
23 buffer_gets,-
24 buffer_ctrl,-
25 buffer_new,-
26 buffer_free,-
27 buffer_callback_ctrl,-
28};-
29-
30const BIO_METHOD *BIO_f_buffer(void)-
31{-
32 return
executed 9513 times by 1 test: return &methods_buffer;
Executed by:
  • libcrypto.so.1.1
&methods_buffer;
executed 9513 times by 1 test: return &methods_buffer;
Executed by:
  • libcrypto.so.1.1
9513
33}-
34-
35static int buffer_new(BIO *bi)-
36{-
37 BIO_F_BUFFER_CTX *ctx = CRYPTO_zalloc(sizeof(*ctx), __FILE__, 49);-
38-
39 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
40 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
41 )-
42 return
never executed: return 0;
0;
never executed: return 0;
0
43 ctx->ibuf_size = 4096;-
44 ctx->ibuf = CRYPTO_malloc(4096, __FILE__, 54);-
45 if (ctx->ibuf ==
ctx->ibuf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
46 ((void *)0)
ctx->ibuf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
47 ) {-
48 CRYPTO_free(ctx, __FILE__, 56);-
49 return
never executed: return 0;
0;
never executed: return 0;
0
50 }-
51 ctx->obuf_size = 4096;-
52 ctx->obuf = CRYPTO_malloc(4096, __FILE__, 60);-
53 if (ctx->obuf ==
ctx->obuf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
54 ((void *)0)
ctx->obuf == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
55 ) {-
56 CRYPTO_free(ctx->ibuf, __FILE__, 62);-
57 CRYPTO_free(ctx, __FILE__, 63);-
58 return
never executed: return 0;
0;
never executed: return 0;
0
59 }-
60-
61 bi->init = 1;-
62 bi->ptr = (char *)ctx;-
63 bi->flags = 0;-
64 return
executed 9513 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 9513 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
9513
65}-
66-
67static int buffer_free(BIO *a)-
68{-
69 BIO_F_BUFFER_CTX *b;-
70-
71 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
72 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9513 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9513
73 )-
74 return
never executed: return 0;
0;
never executed: return 0;
0
75 b = (BIO_F_BUFFER_CTX *)a->ptr;-
76 CRYPTO_free(b->ibuf, __FILE__, 80);-
77 CRYPTO_free(b->obuf, __FILE__, 81);-
78 CRYPTO_free(a->ptr, __FILE__, 82);-
79 a->ptr = -
80 ((void *)0)-
81 ;-
82 a->init = 0;-
83 a->flags = 0;-
84 return
executed 9513 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 9513 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
9513
85}-
86-
87static int buffer_read(BIO *b, char *out, int outl)-
88{-
89 int i, num = 0;-
90 BIO_F_BUFFER_CTX *ctx;-
91-
92 if (out ==
out == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
93 ((void *)0)
out == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
94 )-
95 return
never executed: return 0;
0;
never executed: return 0;
0
96 ctx = (BIO_F_BUFFER_CTX *)b->ptr;-
97-
98 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
99 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
100 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
b->next_bio ==
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
101 ((void *)0)
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
102 )
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
)
0
103 return
never executed: return 0;
0;
never executed: return 0;
0
104 num = 0;-
105 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
106-
107 start:
code before this statement never executed: start:
0
108 i = ctx->ibuf_len;-
109-
110 if (i != 0
i != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
111 if (i > outl
i > outlDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
112 i = outl;
never executed: i = outl;
0
113 memcpy(out, &(ctx->ibuf[ctx->ibuf_off]), i);-
114 ctx->ibuf_off += i;-
115 ctx->ibuf_len -= i;-
116 num += i;-
117 if (outl == i
outl == iDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
118 return
never executed: return num;
num;
never executed: return num;
0
119 outl -= i;-
120 out += i;-
121 }
never executed: end of block
0
122-
123-
124-
125-
126-
127-
128-
129 if (outl > ctx->ibuf_size
outl > ctx->ibuf_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
130 for (;;) {-
131 i = BIO_read(b->next_bio, out, outl);-
132 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
133 BIO_copy_next_retry(b);-
134 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
135 return
never executed: return ((num > 0) ? num : i);
((
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
num > 0)
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
? num : i);
never executed: return ((num > 0) ? num : i);
0
136 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
137 return
never executed: return num;
num;
never executed: return num;
0
138 }
never executed: end of block
0
139 num += i;-
140 if (outl == i
outl == iDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
141 return
never executed: return num;
num;
never executed: return num;
0
142 out += i;-
143 outl -= i;-
144 }
never executed: end of block
0
145 }
never executed: end of block
0
146-
147-
148-
149 i = BIO_read(b->next_bio, ctx->ibuf, ctx->ibuf_size);-
150 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
151 BIO_copy_next_retry(b);-
152 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
153 return
never executed: return ((num > 0) ? num : i);
((
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
num > 0)
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
? num : i);
never executed: return ((num > 0) ? num : i);
0
154 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
155 return
never executed: return num;
num;
never executed: return num;
0
156 }
never executed: end of block
0
157 ctx->ibuf_off = 0;-
158 ctx->ibuf_len = i;-
159-
160-
161 goto
never executed: goto start;
start;
never executed: goto start;
0
162}-
163-
164static int buffer_write(BIO *b, const char *in, int inl)-
165{-
166 int i, num = 0;-
167 BIO_F_BUFFER_CTX *ctx;-
168-
169 if ((
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
in ==
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32043
170 ((void *)0)
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32043
171 )
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(inl <= 0)Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
inl <= 0)
(inl <= 0)Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-32043
172 return
never executed: return 0;
0;
never executed: return 0;
0
173 ctx = (BIO_F_BUFFER_CTX *)b->ptr;-
174 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32043
175 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32043
176 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
b->next_bio ==
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32043
177 ((void *)0)
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-32043
178 )
(b->next_bio == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 32043 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-32043
179 return
never executed: return 0;
0;
never executed: return 0;
0
180-
181 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
182 start:
code before this statement executed 32043 times by 1 test: start:
Executed by:
  • libcrypto.so.1.1
32043
183 i = ctx->obuf_size - (ctx->obuf_len + ctx->obuf_off);-
184-
185 if (i >= inl
i >= inlDescription
TRUEevaluated 32037 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
6-32037
186 memcpy(&(ctx->obuf[ctx->obuf_off + ctx->obuf_len]), in, inl);-
187 ctx->obuf_len += inl;-
188 return
executed 32037 times by 1 test: return (num + inl);
Executed by:
  • libcrypto.so.1.1
(num + inl);
executed 32037 times by 1 test: return (num + inl);
Executed by:
  • libcrypto.so.1.1
32037
189 }-
190-
191-
192 if (ctx->obuf_len != 0
ctx->obuf_len != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-4
193 if (i > 0
i > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-2
194 memcpy(&(ctx->obuf[ctx->obuf_off + ctx->obuf_len]), in, i);-
195 in += i;-
196 inl -= i;-
197 num += i;-
198 ctx->obuf_len += i;-
199 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
200-
201 for (;;) {-
202 i = BIO_write(b->next_bio, &(ctx->obuf[ctx->obuf_off]),-
203 ctx->obuf_len);-
204 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
205 BIO_copy_next_retry(b);-
206-
207 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
208 return
never executed: return ((num > 0) ? num : i);
((
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
num > 0)
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
? num : i);
never executed: return ((num > 0) ? num : i);
0
209 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
210 return
never executed: return num;
num;
never executed: return num;
0
211 }
never executed: end of block
0
212 ctx->obuf_off += i;-
213 ctx->obuf_len -= i;-
214 if (ctx->obuf_len == 0
ctx->obuf_len == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-2
215 break;
executed 2 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
2
216 }
never executed: end of block
0
217 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
218-
219-
220-
221-
222 ctx->obuf_off = 0;-
223-
224-
225 while (inl >= ctx->obuf_size
inl >= ctx->obuf_sizeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-6
226 i = BIO_write(b->next_bio, in, inl);-
227 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-6
228 BIO_copy_next_retry(b);-
229 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
230 return
never executed: return ((num > 0) ? num : i);
((
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
num > 0)
(num > 0)Description
TRUEnever evaluated
FALSEnever evaluated
? num : i);
never executed: return ((num > 0) ? num : i);
0
231 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
232 return
never executed: return num;
num;
never executed: return num;
0
233 }
never executed: end of block
0
234 num += i;-
235 in += i;-
236 inl -= i;-
237 if (inl == 0
inl == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-6
238 return
executed 6 times by 1 test: return num;
Executed by:
  • libcrypto.so.1.1
num;
executed 6 times by 1 test: return num;
Executed by:
  • libcrypto.so.1.1
6
239 }
never executed: end of block
0
240-
241-
242-
243-
244 goto
never executed: goto start;
start;
never executed: goto start;
0
245}-
246-
247static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)-
248{-
249 BIO *dbio;-
250 BIO_F_BUFFER_CTX *ctx;-
251 long ret = 1;-
252 char *p1, *p2;-
253 int r, i, *ip;-
254 int ibs, obs;-
255-
256 ctx = (BIO_F_BUFFER_CTX *)b->ptr;-
257-
258 switch (cmd) {-
259 case
never executed: case 1:
1:
never executed: case 1:
0
260 ctx->ibuf_off = 0;-
261 ctx->ibuf_len = 0;-
262 ctx->obuf_off = 0;-
263 ctx->obuf_len = 0;-
264 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
265 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
266 )-
267 return
never executed: return 0;
0;
never executed: return 0;
0
268 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
269 break;
never executed: break;
0
270 case
never executed: case 2:
2:
never executed: case 2:
0
271 if (ctx->ibuf_len > 0
ctx->ibuf_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
272 return
never executed: return 0;
0;
never executed: return 0;
0
273 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
274 break;
never executed: break;
0
275 case
never executed: case 3:
3:
never executed: case 3:
0
276 ret = (long)ctx->obuf_len;-
277 break;
never executed: break;
0
278 case
never executed: case 116:
116:
never executed: case 116:
0
279 ret = 0;-
280 p1 = ctx->ibuf;-
281 for (i = 0; i < ctx->ibuf_len
i < ctx->ibuf_lenDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
282 if (p1[ctx->ibuf_off + i] == '\n'
p1[ctx->ibuf_off + i] == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
283 ret++;
never executed: ret++;
0
284 }
never executed: end of block
0
285 break;
never executed: break;
0
286 case
executed 3009 times by 1 test: case 13:
Executed by:
  • libcrypto.so.1.1
13:
executed 3009 times by 1 test: case 13:
Executed by:
  • libcrypto.so.1.1
3009
287 ret = (long)ctx->obuf_len;-
288 if (ret == 0
ret == 0Description
TRUEevaluated 825 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2184 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
825-2184
289 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 825 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-825
290 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 825 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-825
291 )-
292 return
never executed: return 0;
0;
never executed: return 0;
0
293 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
294 }
executed 825 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
825
295 break;
executed 3009 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
3009
296 case
never executed: case 10:
10:
never executed: case 10:
0
297 ret = (long)ctx->ibuf_len;-
298 if (ret == 0
ret == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
299 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
300 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
301 )-
302 return
never executed: return 0;
0;
never executed: return 0;
0
303 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
304 }
never executed: end of block
0
305 break;
never executed: break;
0
306 case
never executed: case 122:
122:
never executed: case 122:
0
307 if (num > ctx->ibuf_size
num > ctx->ibuf_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
308 p1 = CRYPTO_malloc((int)num, __FILE__, 292);-
309 if (p1 ==
p1 == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
310 ((void *)0)
p1 == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
311 )-
312 goto
never executed: goto malloc_error;
malloc_error;
never executed: goto malloc_error;
0
313 CRYPTO_free(ctx->ibuf, __FILE__, 295);-
314 ctx->ibuf = p1;-
315 }
never executed: end of block
0
316 ctx->ibuf_off = 0;-
317 ctx->ibuf_len = (int)num;-
318 memcpy(ctx->ibuf, ptr, (int)num);-
319 ret = 1;-
320 break;
never executed: break;
0
321 case
executed 9434 times by 1 test: case 117:
Executed by:
  • libcrypto.so.1.1
117:
executed 9434 times by 1 test: case 117:
Executed by:
  • libcrypto.so.1.1
9434
322 if (ptr !=
ptr != ((void *)0)Description
TRUEevaluated 9434 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-9434
323 ((void *)0)
ptr != ((void *)0)Description
TRUEevaluated 9434 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-9434
324 ) {-
325 ip = (int *)ptr;-
326 if (*
*ip == 0Description
TRUEevaluated 9243 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ip == 0
*ip == 0Description
TRUEevaluated 9243 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
191-9243
327 ibs = (int)num;-
328 obs = ctx->obuf_size;-
329 }
executed 9243 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
9243
330-
331 ibs = ctx->ibuf_size;-
332 obs = (int)num;-
333 }
executed 191 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
191
334 } else {-
335 ibs = (int)num;-
336 obs = (int)num;-
337 }
never executed: end of block
0
338 p1 = ctx->ibuf;-
339 p2 = ctx->obuf;-
340 if ((
(ibs > 4096)Description
TRUEnever evaluated
FALSEevaluated 9434 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ibs > 4096)
(ibs > 4096)Description
TRUEnever evaluated
FALSEevaluated 9434 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(ibs != ctx->ibuf_size)Description
TRUEnever evaluated
FALSEnever evaluated
ibs != ctx->ibuf_size)
(ibs != ctx->ibuf_size)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-9434
341 p1 = CRYPTO_malloc((int)num, __FILE__, 321);-
342 if (p1 ==
p1 == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
343 ((void *)0)
p1 == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
344 )-
345 goto
never executed: goto malloc_error;
malloc_error;
never executed: goto malloc_error;
0
346 }
never executed: end of block
0
347 if ((
(obs > 4096)Description
TRUEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9243 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
obs > 4096)
(obs > 4096)Description
TRUEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9243 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(obs != ctx->obuf_size)Description
TRUEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
obs != ctx->obuf_size)
(obs != ctx->obuf_size)Description
TRUEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-9243
348 p2 = CRYPTO_malloc((int)num, __FILE__, 326);-
349 if (p2 ==
p2 == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-191
350 ((void *)0)
p2 == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-191
351 ) {-
352 if (p1 != ctx->ibuf
p1 != ctx->ibufDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
353 CRYPTO_free(p1, __FILE__, 329);
never executed: CRYPTO_free(p1, __FILE__, 329);
0
354 goto
never executed: goto malloc_error;
malloc_error;
never executed: goto malloc_error;
0
355 }-
356 }
executed 191 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
191
357 if (ctx->ibuf != p1
ctx->ibuf != p1Description
TRUEnever evaluated
FALSEevaluated 9434 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-9434
358 CRYPTO_free(ctx->ibuf, __FILE__, 334);-
359 ctx->ibuf = p1;-
360 ctx->ibuf_off = 0;-
361 ctx->ibuf_len = 0;-
362 ctx->ibuf_size = ibs;-
363 }
never executed: end of block
0
364 if (ctx->obuf != p2
ctx->obuf != p2Description
TRUEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9243 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
191-9243
365 CRYPTO_free(ctx->obuf, __FILE__, 341);-
366 ctx->obuf = p2;-
367 ctx->obuf_off = 0;-
368 ctx->obuf_len = 0;-
369 ctx->obuf_size = obs;-
370 }
executed 191 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
191
371 break;
executed 9434 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
9434
372 case
executed 191 times by 1 test: case 101:
Executed by:
  • libcrypto.so.1.1
101:
executed 191 times by 1 test: case 101:
Executed by:
  • libcrypto.so.1.1
191
373 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-191
374 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-191
375 )-
376 return
never executed: return 0;
0;
never executed: return 0;
0
377 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
378 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
379 BIO_copy_next_retry(b);-
380 break;
executed 191 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
191
381-
382 case
executed 17364 times by 1 test: case 11:
Executed by:
  • libcrypto.so.1.1
11:
executed 17364 times by 1 test: case 11:
Executed by:
  • libcrypto.so.1.1
17364
383 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 17364 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-17364
384 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 17364 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-17364
385 )-
386 return
never executed: return 0;
0;
never executed: return 0;
0
387 if (ctx->obuf_len <= 0
ctx->obuf_len <= 0Description
TRUEnever evaluated
FALSEevaluated 17364 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-17364
388 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
389 break;
never executed: break;
0
390 }-
391-
392 for (;;) {-
393 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
394 if (ctx->obuf_len > 0
ctx->obuf_len > 0Description
TRUEevaluated 17667 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 16748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
16748-17667
395 r = BIO_write(b->next_bio,-
396 &(ctx->obuf[ctx->obuf_off]), ctx->obuf_len);-
397 BIO_copy_next_retry(b);-
398 if (r <= 0
r <= 0Description
TRUEevaluated 616 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 17051 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
616-17051
399 return
executed 616 times by 1 test: return (long)r;
Executed by:
  • libcrypto.so.1.1
(long)r;
executed 616 times by 1 test: return (long)r;
Executed by:
  • libcrypto.so.1.1
616
400 ctx->obuf_off += r;-
401 ctx->obuf_len -= r;-
402 }
executed 17051 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
17051
403 ctx->obuf_len = 0;-
404 ctx->obuf_off = 0;-
405 break;
executed 16748 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
16748
406 }-
407 }-
408 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
409 break;
executed 16748 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
16748
410 case
never executed: case 12:
12:
never executed: case 12:
0
411 dbio = (BIO *)ptr;-
412 if (!BIO_int_ctrl(dbio,117,ctx->ibuf_size,0)
!BIO_int_ctrl(...->ibuf_size,0)Description
TRUEnever evaluated
FALSEnever evaluated
||
0
413 !BIO_int_ctrl(dbio,117,ctx->obuf_size,1)
!BIO_int_ctrl(...->obuf_size,1)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
414 ret = 0;
never executed: ret = 0;
0
415 break;
never executed: break;
0
416 case
never executed: case 29:
29:
never executed: case 29:
0
417-
418 {-
419 char fake_buf[1];-
420 (void)buffer_read(b, fake_buf, 0);-
421 }-
422 if (num > ctx->ibuf_len
num > ctx->ibuf_lenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
423 num = ctx->ibuf_len;
never executed: num = ctx->ibuf_len;
0
424 memcpy(ptr, &(ctx->ibuf[ctx->ibuf_off]), num);-
425 ret = num;-
426 break;
never executed: break;
0
427 default
executed 18845 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 18845 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
18845
428 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18841 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-18841
429 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18841 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-18841
430 )-
431 return
executed 4 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 4 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
4
432 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);-
433 break;
executed 18841 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
18841
434 }-
435 return
executed 48223 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 48223 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
48223
436 malloc_error:-
437 ERR_put_error(32,(114),((1|64)),__FILE__,407);-
438 return
never executed: return 0;
0;
never executed: return 0;
0
439}-
440-
441static long buffer_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)-
442{-
443 long ret = 1;-
444-
445 if (b->next_bio ==
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
446 ((void *)0)
b->next_bio == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
447 )-
448 return
never executed: return 0;
0;
never executed: return 0;
0
449 switch (cmd) {-
450 default
never executed: default:
:
never executed: default:
0
451 ret = BIO_callback_ctrl(b->next_bio, cmd, fp);-
452 break;
never executed: break;
0
453 }-
454 return
never executed: return ret;
ret;
never executed: return ret;
0
455}-
456-
457static int buffer_gets(BIO *b, char *buf, int size)-
458{-
459 BIO_F_BUFFER_CTX *ctx;-
460 int num = 0, i, flag;-
461 char *p;-
462-
463 ctx = (BIO_F_BUFFER_CTX *)b->ptr;-
464 size--;-
465 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
466-
467 for (;;) {-
468 if (ctx->ibuf_len > 0
ctx->ibuf_len > 0Description
TRUEevaluated 113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 350 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
113-350
469 p = &(ctx->ibuf[ctx->ibuf_off]);-
470 flag = 0;-
471 for (i = 0; (
(i < ctx->ibuf_len)Description
TRUEevaluated 443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i < ctx->ibuf_len)
(i < ctx->ibuf_len)Description
TRUEevaluated 443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(i < size)Description
TRUEevaluated 443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
i < size)
(i < size)Description
TRUEevaluated 443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
; i++) {
0-443
472 *(buf++) = p[i];-
473 if (p[i] == '\n'
p[i] == '\n'Description
TRUEnever evaluated
FALSEevaluated 443 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-443
474 flag = 1;-
475 i++;-
476 break;
never executed: break;
0
477 }-
478 }
executed 443 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
443
479 num += i;-
480 size -= i;-
481 ctx->ibuf_len -= i;-
482 ctx->ibuf_off += i;-
483 if (flag
flagDescription
TRUEnever evaluated
FALSEevaluated 113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| size == 0
size == 0Description
TRUEnever evaluated
FALSEevaluated 113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-113
484 *buf = '\0';-
485 return
never executed: return num;
num;
never executed: return num;
0
486 }-
487 }
executed 113 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
113
488-
489 i = BIO_read(b->next_bio, ctx->ibuf, ctx->ibuf_size);-
490 if (i <= 0
i <= 0Description
TRUEevaluated 237 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 113 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
113-237
491 BIO_copy_next_retry(b);-
492 *buf = '\0';-
493 if (i < 0
i < 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 233 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
4-233
494 return
executed 4 times by 1 test: return ((num > 0) ? num : i);
Executed by:
  • libcrypto.so.1.1
((
(num > 0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
num > 0)
(num > 0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? num : i);
executed 4 times by 1 test: return ((num > 0) ? num : i);
Executed by:
  • libcrypto.so.1.1
0-4
495 if (i == 0
i == 0Description
TRUEevaluated 233 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-233
496 return
executed 233 times by 1 test: return num;
Executed by:
  • libcrypto.so.1.1
num;
executed 233 times by 1 test: return num;
Executed by:
  • libcrypto.so.1.1
233
497 }
never executed: end of block
0
498 ctx->ibuf_len = i;-
499 ctx->ibuf_off = 0;-
500 }
executed 113 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
113
501 }-
502}
never executed: end of block
0
503-
504static int buffer_puts(BIO *b, const char *str)-
505{-
506 return
never executed: return buffer_write(b, str, strlen(str));
buffer_write(b, str, strlen(str));
never executed: return buffer_write(b, str, strlen(str));
0
507}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2