OpenCoverage

bio_b64.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/bio_b64.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static int b64_write(BIO *h, const char *buf, int num);-
4static int b64_read(BIO *h, char *buf, int size);-
5static int b64_puts(BIO *h, const char *str);-
6static long b64_ctrl(BIO *h, int cmd, long arg1, void *arg2);-
7static int b64_new(BIO *h);-
8static int b64_free(BIO *data);-
9static long b64_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);-
10-
11-
12-
13-
14-
15-
16typedef struct b64_struct {-
17-
18-
19-
20 int buf_len;-
21 int buf_off;-
22 int tmp_len;-
23 int tmp_nl;-
24 int encode;-
25 int start;-
26 int cont;-
27 EVP_ENCODE_CTX *base64;-
28 char buf[((((1024)+2)/3*4)+((1024)/48+1)*2+80) + 10];-
29 char tmp[1024];-
30} BIO_B64_CTX;-
31-
32static const BIO_METHOD methods_b64 = {-
33 (11|0x0200),-
34 "base64 encoding",-
35-
36 bwrite_conv,-
37 b64_write,-
38-
39 bread_conv,-
40 b64_read,-
41 b64_puts,-
42 -
43 ((void *)0)-
44 ,-
45 b64_ctrl,-
46 b64_new,-
47 b64_free,-
48 b64_callback_ctrl,-
49};-
50-
51-
52const BIO_METHOD *BIO_f_base64(void)-
53{-
54 return
executed 302 times by 1 test: return &methods_b64;
Executed by:
  • libcrypto.so.1.1
&methods_b64;
executed 302 times by 1 test: return &methods_b64;
Executed by:
  • libcrypto.so.1.1
302
55}-
56-
57static int b64_new(BIO *bi)-
58{-
59 BIO_B64_CTX *ctx;-
60-
61 if ((
(ctx = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx = CRYPTO_zalloc(sizeof(*ctx), __FILE__, 73)) ==
(ctx = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
62 ((void *)0)
(ctx = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
63 ) {-
64 ERR_put_error(6,(198),((1|64)),__FILE__,74);-
65 return
never executed: return 0;
0;
never executed: return 0;
0
66 }-
67-
68 ctx->cont = 1;-
69 ctx->start = 1;-
70 ctx->base64 = EVP_ENCODE_CTX_new();-
71 if (ctx->base64 ==
ctx->base64 == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
72 ((void *)0)
ctx->base64 == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
73 ) {-
74 CRYPTO_free(ctx, __FILE__, 82);-
75 return
never executed: return 0;
0;
never executed: return 0;
0
76 }-
77-
78 BIO_set_data(bi, ctx);-
79 BIO_set_init(bi, 1);-
80-
81 return
executed 302 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 302 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
302
82}-
83-
84static int b64_free(BIO *a)-
85{-
86 BIO_B64_CTX *ctx;-
87 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
88 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
89 )-
90 return
never executed: return 0;
0;
never executed: return 0;
0
91-
92 ctx = BIO_get_data(a);-
93 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
94 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-302
95 )-
96 return
never executed: return 0;
0;
never executed: return 0;
0
97-
98 EVP_ENCODE_CTX_free(ctx->base64);-
99 CRYPTO_free(ctx, __FILE__, 103);-
100 BIO_set_data(a, -
101 ((void *)0)-
102 );-
103 BIO_set_init(a, 0);-
104-
105 return
executed 302 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 302 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
302
106}-
107-
108static int b64_read(BIO *b, char *out, int outl)-
109{-
110 int ret = 0, i, ii, j, k, x, n, num, ret_code = 0;-
111 BIO_B64_CTX *ctx;-
112 unsigned char *p, *q;-
113 BIO *next;-
114-
115 if (out ==
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2129
116 ((void *)0)
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2129
117 )-
118 return
never executed: return 0;
0;
never executed: return 0;
0
119 ctx = (BIO_B64_CTX *)BIO_get_data(b);-
120-
121 next = BIO_next(b);-
122 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2129
123 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2129
124 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
next ==
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2129
125 ((void *)0)
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2129
126 )
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2129 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2129
127 return
never executed: return 0;
0;
never executed: return 0;
0
128-
129 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
130-
131 if (ctx->encode != 2
ctx->encode != 2Description
TRUEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1955 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
174-1955
132 ctx->encode = 2;-
133 ctx->buf_len = 0;-
134 ctx->buf_off = 0;-
135 ctx->tmp_len = 0;-
136 EVP_DecodeInit(ctx->base64);-
137 }
executed 174 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
174
138-
139-
140 if (ctx->buf_len > 0
ctx->buf_len > 0Description
TRUEevaluated 1746 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 383 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
383-1746
141 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 137), 1));-
142 i = ctx->buf_len - ctx->buf_off;-
143 if (i > outl
i > outlDescription
TRUEevaluated 1438 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 308 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
308-1438
144 i = outl;
executed 1438 times by 1 test: i = outl;
Executed by:
  • libcrypto.so.1.1
1438
145 (void)((ctx->buf_off + i < (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off + i < (int)sizeof(ctx->buf)", __FILE__, 141), 1));-
146 memcpy(out, &(ctx->buf[ctx->buf_off]), i);-
147 ret = i;-
148 out += i;-
149 outl -= i;-
150 ctx->buf_off += i;-
151 if (ctx->buf_len == ctx->buf_off
ctx->buf_len == ctx->buf_offDescription
TRUEevaluated 308 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1438 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
308-1438
152 ctx->buf_len = 0;-
153 ctx->buf_off = 0;-
154 }
executed 308 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
308
155 }
executed 1746 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1746
156-
157-
158-
159-
160-
161-
162 ret_code = 0;-
163 while (outl > 0
outl > 0Description
TRUEevaluated 961 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1777 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
961-1777
164 if (ctx->cont <= 0
ctx->cont <= 0Description
TRUEevaluated 282 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 679 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
282-679
165 break;
executed 282 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
282
166-
167 i = BIO_read(next, &(ctx->tmp[ctx->tmp_len]),-
168 1024 - ctx->tmp_len);-
169-
170 if (i <= 0
i <= 0Description
TRUEevaluated 211 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 468 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
211-468
171 ret_code = i;-
172-
173-
174 if (!BIO_test_flags(next, 0x08)
!BIO_test_flags(next, 0x08)Description
TRUEevaluated 211 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-211
175 ctx->cont = i;-
176-
177 if (ctx->tmp_len == 0
ctx->tmp_len == 0Description
TRUEevaluated 70 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
70-141
178 break;
executed 70 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
70
179-
180 else-
181 i = 0;
executed 141 times by 1 test: i = 0;
Executed by:
  • libcrypto.so.1.1
141
182 }-
183-
184 else-
185 break;
never executed: break;
0
186 }-
187 i += ctx->tmp_len;-
188 ctx->tmp_len = i;-
189-
190-
191-
192-
193-
194 if (ctx->start
ctx->startDescription
TRUEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 435 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(BIO_test_flag...0x0)) & 0x100)Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
BIO_test_flags(b, ~(0x0)) & 0x100)
(BIO_test_flag...0x0)) & 0x100)Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-435
195-
196 ctx->tmp_len = 0;-
197 }
never executed: end of block
else if (ctx->start
ctx->startDescription
TRUEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 435 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-435
198 q = p = (unsigned char *)ctx->tmp;-
199 num = 0;-
200 for (j = 0; j < i
j < iDescription
TRUEevaluated 11316 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
; j++) {
0-11316
201 if (*(
*(q++) != '\n'Description
TRUEevaluated 11142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
q++) != '\n'
*(q++) != '\n'Description
TRUEevaluated 11142 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
174-11142
202 continue;
executed 11142 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
11142
203-
204-
205-
206-
207-
208-
209 if (ctx->tmp_nl
ctx->tmp_nlDescription
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-174
210 p = q;-
211 ctx->tmp_nl = 0;-
212 continue;
never executed: continue;
0
213 }-
214-
215 k = EVP_DecodeUpdate(ctx->base64,-
216 (unsigned char *)ctx->buf,-
217 &num, p, q - p);-
218 if ((
(k <= 0)Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
k <= 0)
(k <= 0)Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(num == 0)Description
TRUEnever evaluated
FALSEnever evaluated
num == 0)
(num == 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(ctx->start)Description
TRUEnever evaluated
FALSEnever evaluated
ctx->start)
(ctx->start)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-174
219 EVP_DecodeInit(ctx->base64);
never executed: EVP_DecodeInit(ctx->base64);
0
220 else {-
221 if (p != (unsigned char *)
p != (unsigned...&(ctx->tmp[0])Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-174
222 &(ctx->tmp[0])
p != (unsigned...&(ctx->tmp[0])Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-174
223 i -= (p - (unsigned char *)-
224 &(ctx->tmp[0]));-
225 for (x = 0; x < i
x < iDescription
TRUEnever evaluated
FALSEnever evaluated
; x++)
0
226 ctx->tmp[x] = p[x];
never executed: ctx->tmp[x] = p[x];
0
227 }
never executed: end of block
0
228 EVP_DecodeInit(ctx->base64);-
229 ctx->start = 0;-
230 break;
executed 174 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
174
231 }-
232 p = q;-
233 }
never executed: end of block
0
234-
235-
236 if ((
(j == i)Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
j == i)
(j == i)Description
TRUEnever evaluated
FALSEevaluated 174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(num == 0)Description
TRUEnever evaluated
FALSEnever evaluated
num == 0)
(num == 0)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-174
237-
238-
239-
240-
241 if (p == (unsigned char *)&(ctx->tmp[0])
p == (unsigned...&(ctx->tmp[0])Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
242-
243 if (i == 1024
i == 1024Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
244 ctx->tmp_nl = 1;-
245 ctx->tmp_len = 0;-
246 }
never executed: end of block
0
247 }
never executed: end of block
else if (p != q
p != qDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
248 n = q - p;-
249 for (ii = 0; ii < n
ii < nDescription
TRUEnever evaluated
FALSEnever evaluated
; ii++)
0
250 ctx->tmp[ii] = p[ii];
never executed: ctx->tmp[ii] = p[ii];
0
251 ctx->tmp_len = n;-
252 }
never executed: end of block
0
253-
254 continue;
never executed: continue;
0
255 } else {-
256 ctx->tmp_len = 0;-
257 }
executed 174 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
174
258 } else if ((
(i < 1024)Description
TRUEevaluated 282 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 153 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i < 1024)
(i < 1024)Description
TRUEevaluated 282 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 153 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(ctx->cont > 0)Description
TRUEevaluated 141 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx->cont > 0)
(ctx->cont > 0)Description
TRUEevaluated 141 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
141-282
259-
260-
261-
262-
263 continue;
executed 141 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
141
264 }-
265-
266 if (BIO_test_flags(b, ~(0x0)) & 0x100
BIO_test_flags...(0x0)) & 0x100Description
TRUEnever evaluated
FALSEevaluated 468 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-468
267 int z, jj;-
268-
269 jj = i & ~3;-
270 z = EVP_DecodeBlock((unsigned char *)ctx->buf,-
271 (unsigned char *)ctx->tmp, jj);-
272 if (jj > 2
jj > 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
273 if (ctx->tmp[jj - 1] == '='
ctx->tmp[jj - 1] == '='Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
274 z--;-
275 if (ctx->tmp[jj - 2] == '='
ctx->tmp[jj - 2] == '='Description
TRUEnever evaluated
FALSEnever evaluated
)
0
276 z--;
never executed: z--;
0
277 }
never executed: end of block
0
278 }
never executed: end of block
0
279-
280-
281-
282 if (jj != i
jj != iDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
283 memmove(ctx->tmp, &ctx->tmp[jj], i - jj);-
284 ctx->tmp_len = i - jj;-
285 }
never executed: end of block
0
286 ctx->buf_len = 0;-
287 if (z > 0
z > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
288 ctx->buf_len = z;-
289 }
never executed: end of block
0
290 i = z;-
291 }
never executed: end of block
else {
0
292 i = EVP_DecodeUpdate(ctx->base64,-
293 (unsigned char *)ctx->buf, &ctx->buf_len,-
294 (unsigned char *)ctx->tmp, i);-
295 ctx->tmp_len = 0;-
296 }
executed 468 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
468
297-
298-
299-
300-
301-
302-
303 ctx->cont = i;-
304-
305 ctx->buf_off = 0;-
306 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 468 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-468
307 ret_code = 0;-
308 ctx->buf_len = 0;-
309 break;
never executed: break;
0
310 }-
311-
312 if (ctx->buf_len <= outl
ctx->buf_len <= outlDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 308 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
160-308
313 i = ctx->buf_len;
executed 160 times by 1 test: i = ctx->buf_len;
Executed by:
  • libcrypto.so.1.1
160
314 else-
315 i = outl;
executed 308 times by 1 test: i = outl;
Executed by:
  • libcrypto.so.1.1
308
316-
317 memcpy(out, ctx->buf, i);-
318 ret += i;-
319 ctx->buf_off = i;-
320 if (ctx->buf_off == ctx->buf_len
ctx->buf_off == ctx->buf_lenDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 308 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
160-308
321 ctx->buf_len = 0;-
322 ctx->buf_off = 0;-
323 }
executed 160 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
160
324 outl -= i;-
325 out += i;-
326 }
executed 468 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
468
327-
328 BIO_copy_next_retry(b);-
329 return
executed 2129 times by 1 test: return ((ret == 0) ? ret_code : ret);
Executed by:
  • libcrypto.so.1.1
((
(ret == 0)Description
TRUEevaluated 209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1920 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret == 0)
(ret == 0)Description
TRUEevaluated 209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1920 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? ret_code : ret);
executed 2129 times by 1 test: return ((ret == 0) ? ret_code : ret);
Executed by:
  • libcrypto.so.1.1
209-2129
330}-
331-
332static int b64_write(BIO *b, const char *in, int inl)-
333{-
334 int ret = 0;-
335 int n;-
336 int i;-
337 BIO_B64_CTX *ctx;-
338 BIO *next;-
339-
340 ctx = (BIO_B64_CTX *)BIO_get_data(b);-
341 next = BIO_next(b);-
342 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2209
343 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2209
344 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
next ==
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2209
345 ((void *)0)
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2209
346 )
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2209
347 return
never executed: return 0;
0;
never executed: return 0;
0
348-
349 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
350-
351 if (ctx->encode != 1
ctx->encode != 1Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2081 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
128-2081
352 ctx->encode = 1;-
353 ctx->buf_len = 0;-
354 ctx->buf_off = 0;-
355 ctx->tmp_len = 0;-
356 EVP_EncodeInit(ctx->base64);-
357 }
executed 128 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
128
358-
359 (void)((ctx->buf_off < (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off < (int)sizeof(ctx->buf)", __FILE__, 351), 1));-
360 (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 352), 1));-
361 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 353), 1));-
362 n = ctx->buf_len - ctx->buf_off;-
363 while (n > 0
n > 0Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2209 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
126-2209
364 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);-
365 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-126
366 BIO_copy_next_retry(b);-
367 return
never executed: return i;
i;
never executed: return i;
0
368 }-
369 (void)((i <= n) ? 0 : (OPENSSL_die("assertion failed: " "i <= n", __FILE__, 361), 1));-
370 ctx->buf_off += i;-
371 (void)((ctx->buf_off <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off <= (int)sizeof(ctx->buf)", __FILE__, 363), 1));-
372 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 364), 1));-
373 n -= i;-
374 }
executed 126 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
126
375-
376 ctx->buf_off = 0;-
377 ctx->buf_len = 0;-
378-
379 if ((
(in == ((void *)0) )Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
in ==
(in == ((void *)0) )Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
126-2083
380 ((void *)0)
(in == ((void *)0) )Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
126-2083
381 )
(in == ((void *)0) )Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(inl <= 0)Description
TRUEnever evaluated
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
inl <= 0)
(inl <= 0)Description
TRUEnever evaluated
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2083
382 return
executed 126 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 126 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
126
383-
384 while (inl > 0
inl > 0Description
TRUEevaluated 2148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2083-2148
385 n = (
(inl > 1024)Description
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
inl > 1024)
(inl > 1024)Description
TRUEevaluated 65 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2083 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 1024 : inl;
65-2083
386-
387 if (BIO_test_flags(b, ~(0x0)) & 0x100
BIO_test_flags...(0x0)) & 0x100Description
TRUEnever evaluated
FALSEevaluated 2148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2148
388 if (ctx->tmp_len > 0
ctx->tmp_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
389 (void)((ctx->tmp_len <= 3) ? 0 : (OPENSSL_die("assertion failed: " "ctx->tmp_len <= 3", __FILE__, 379), 1));-
390 n = 3 - ctx->tmp_len;-
391-
392-
393-
394 if (n > inl
n > inlDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
395 n = inl;
never executed: n = inl;
0
396 memcpy(&(ctx->tmp[ctx->tmp_len]), in, n);-
397 ctx->tmp_len += n;-
398 ret += n;-
399 if (ctx->tmp_len < 3
ctx->tmp_len < 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
400 break;
never executed: break;
0
401 ctx->buf_len =-
402 EVP_EncodeBlock((unsigned char *)ctx->buf,-
403 (unsigned char *)ctx->tmp, ctx->tmp_len);-
404 (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 394), 1));-
405 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 395), 1));-
406-
407-
408-
409-
410 ctx->tmp_len = 0;-
411 }
never executed: end of block
else {
0
412 if (n < 3
n < 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
413 memcpy(ctx->tmp, in, n);-
414 ctx->tmp_len = n;-
415 ret += n;-
416 break;
never executed: break;
0
417 }-
418 n -= n % 3;-
419 ctx->buf_len =-
420 EVP_EncodeBlock((unsigned char *)ctx->buf,-
421 (const unsigned char *)in, n);-
422 (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 412), 1));-
423 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 413), 1));-
424 ret += n;-
425 }
never executed: end of block
0
426 } else {-
427 if (!EVP_EncodeUpdate(ctx->base64,
!EVP_EncodeUpd... char *)in, n)Description
TRUEnever evaluated
FALSEevaluated 2148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2148
428 (unsigned char *)ctx->buf, &ctx->buf_len,
!EVP_EncodeUpd... char *)in, n)Description
TRUEnever evaluated
FALSEevaluated 2148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2148
429 (unsigned char *)in, n)
!EVP_EncodeUpd... char *)in, n)Description
TRUEnever evaluated
FALSEevaluated 2148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-2148
430 return
never executed: return ((ret == 0) ? -1 : ret);
((
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
ret == 0)
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
? -1 : ret);
never executed: return ((ret == 0) ? -1 : ret);
0
431 (void)((ctx->buf_len <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len <= (int)sizeof(ctx->buf)", __FILE__, 421), 1));-
432 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 422), 1));-
433 ret += n;-
434 }
executed 2148 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2148
435 inl -= n;-
436 in += n;-
437-
438 ctx->buf_off = 0;-
439 n = ctx->buf_len;-
440 while (n > 0
n > 0Description
TRUEevaluated 1776 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2148 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1776-2148
441 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);-
442 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 1776 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-1776
443 BIO_copy_next_retry(b);-
444 return
never executed: return ((ret == 0) ? i : ret);
((
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
ret == 0)
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
? i : ret);
never executed: return ((ret == 0) ? i : ret);
0
445 }-
446 (void)((i <= n) ? 0 : (OPENSSL_die("assertion failed: " "i <= n", __FILE__, 436), 1));-
447 n -= i;-
448 ctx->buf_off += i;-
449 (void)((ctx->buf_off <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_off <= (int)sizeof(ctx->buf)", __FILE__, 439), 1));-
450 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 440), 1));-
451 }
executed 1776 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1776
452 ctx->buf_len = 0;-
453 ctx->buf_off = 0;-
454 }
executed 2148 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2148
455 return
executed 2083 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 2083 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
2083
456}-
457-
458static long b64_ctrl(BIO *b, int cmd, long num, void *ptr)-
459{-
460 BIO_B64_CTX *ctx;-
461 long ret = 1;-
462 int i;-
463 BIO *next;-
464-
465 ctx = (BIO_B64_CTX *)BIO_get_data(b);-
466 next = BIO_next(b);-
467 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-878
468 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-878
469 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
next ==
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-878
470 ((void *)0)
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-878
471 )
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 878 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-878
472 return
never executed: return 0;
0;
never executed: return 0;
0
473-
474 switch (cmd) {-
475 case
never executed: case 1:
1:
never executed: case 1:
0
476 ctx->cont = 1;-
477 ctx->start = 1;-
478 ctx->encode = 0;-
479 ret = BIO_ctrl(next, cmd, num, ptr);-
480 break;
never executed: break;
0
481 case
never executed: case 2:
2:
never executed: case 2:
0
482 if (ctx->cont <= 0
ctx->cont <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
483 ret = 1;
never executed: ret = 1;
0
484 else-
485 ret = BIO_ctrl(next, cmd, num, ptr);
never executed: ret = BIO_ctrl(next, cmd, num, ptr);
0
486 break;
never executed: break;
0
487 case
never executed: case 13:
13:
never executed: case 13:
0
488 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 474), 1));-
489 ret = ctx->buf_len - ctx->buf_off;-
490 if ((
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
ret == 0)
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(ctx->encode != 0)Description
TRUEnever evaluated
FALSEnever evaluated
ctx->encode != 0)
(ctx->encode != 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
491 && (
(EVP_ENCODE_CT...>base64) != 0)Description
TRUEnever evaluated
FALSEnever evaluated
EVP_ENCODE_CTX_num(ctx->base64) != 0)
(EVP_ENCODE_CT...>base64) != 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
492 ret = 1;
never executed: ret = 1;
0
493 else if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
494 ret = BIO_ctrl(next, cmd, num, ptr);
never executed: ret = BIO_ctrl(next, cmd, num, ptr);
0
495 break;
never executed: break;
0
496 case
never executed: case 10:
10:
never executed: case 10:
0
497 (void)((ctx->buf_len >= ctx->buf_off) ? 0 : (OPENSSL_die("assertion failed: " "ctx->buf_len >= ctx->buf_off", __FILE__, 483), 1));-
498 ret = ctx->buf_len - ctx->buf_off;-
499 if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
500 ret = BIO_ctrl(next, cmd, num, ptr);
never executed: ret = BIO_ctrl(next, cmd, num, ptr);
0
501 break;
never executed: break;
0
502 case
executed 226 times by 1 test: case 11:
Executed by:
  • libcrypto.so.1.1
11:
executed 226 times by 1 test: case 11:
Executed by:
  • libcrypto.so.1.1
226
503-
504 again:-
505 while (ctx->buf_len != ctx->buf_off
ctx->buf_len != ctx->buf_offDescription
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 352 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
126-352
506 i = b64_write(b, -
507 ((void *)0)-
508 , 0);-
509 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-126
510 return
never executed: return i;
i;
never executed: return i;
0
511 }
executed 126 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
126
512 if (BIO_test_flags(b, ~(0x0)) & 0x100
BIO_test_flags...(0x0)) & 0x100Description
TRUEnever evaluated
FALSEevaluated 352 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-352
513 if (ctx->tmp_len != 0
ctx->tmp_len != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
514 ctx->buf_len = EVP_EncodeBlock((unsigned char *)ctx->buf,-
515 (unsigned char *)ctx->tmp,-
516 ctx->tmp_len);-
517 ctx->buf_off = 0;-
518 ctx->tmp_len = 0;-
519 goto
never executed: goto again;
again;
never executed: goto again;
0
520 }-
521 }
never executed: end of block
else if (ctx->encode != 0
ctx->encode != 0Description
TRUEevaluated 352 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-352
522 && EVP_ENCODE_CTX_num(ctx->base64) != 0
EVP_ENCODE_CTX...->base64) != 0Description
TRUEevaluated 126 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 226 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
126-226
523 ctx->buf_off = 0;-
524 EVP_EncodeFinal(ctx->base64,-
525 (unsigned char *)ctx->buf, &(ctx->buf_len));-
526-
527 goto
executed 126 times by 1 test: goto again;
Executed by:
  • libcrypto.so.1.1
again;
executed 126 times by 1 test: goto again;
Executed by:
  • libcrypto.so.1.1
126
528 }-
529-
530 ret = BIO_ctrl(next, cmd, num, ptr);-
531 break;
executed 226 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
226
532-
533 case
never executed: case 101:
101:
never executed: case 101:
0
534 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
535 ret = BIO_ctrl(next, cmd, num, ptr);-
536 BIO_copy_next_retry(b);-
537 break;
never executed: break;
0
538-
539 case
never executed: case 12:
12:
never executed: case 12:
0
540 break;
never executed: break;
0
541 case
never executed: case 3:
3:
never executed: case 3:
0
542 case
never executed: case 5:
5:
never executed: case 5:
0
543 case
never executed: case 4:
4:
never executed: case 4:
0
544 default
executed 652 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 652 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
652
545 ret = BIO_ctrl(next, cmd, num, ptr);-
546 break;
executed 652 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
652
547 }-
548 return
executed 878 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 878 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
878
549}-
550-
551static long b64_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)-
552{-
553 long ret = 1;-
554 BIO *next = BIO_next(b);-
555-
556 if (next ==
next == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
557 ((void *)0)
next == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
558 )-
559 return
never executed: return 0;
0;
never executed: return 0;
0
560 switch (cmd) {-
561 default
never executed: default:
:
never executed: default:
0
562 ret = BIO_callback_ctrl(next, cmd, fp);-
563 break;
never executed: break;
0
564 }-
565 return
never executed: return ret;
ret;
never executed: return ret;
0
566}-
567-
568static int b64_puts(BIO *b, const char *str)-
569{-
570 return
never executed: return b64_write(b, str, strlen(str));
b64_write(b, str, strlen(str));
never executed: return b64_write(b, str, strlen(str));
0
571}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2