OpenCoverage

bio_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/bio_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static int enc_write(BIO *h, const char *buf, int num);-
4static int enc_read(BIO *h, char *buf, int size);-
5static long enc_ctrl(BIO *h, int cmd, long arg1, void *arg2);-
6static int enc_new(BIO *h);-
7static int enc_free(BIO *data);-
8static long enc_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fps);-
9-
10-
11-
12-
13typedef struct enc_struct {-
14 int buf_len;-
15 int buf_off;-
16 int cont;-
17 int finished;-
18 int ok;-
19 EVP_CIPHER_CTX *cipher;-
20 unsigned char *read_start, *read_end;-
21-
22-
23-
24-
25 unsigned char buf[((256) + 32) + (1024*4)];-
26} BIO_ENC_CTX;-
27-
28static const BIO_METHOD methods_enc = {-
29 (10|0x0200),-
30 "cipher",-
31-
32 bwrite_conv,-
33 enc_write,-
34-
35 bread_conv,-
36 enc_read,-
37 -
38 ((void *)0)-
39 ,-
40 -
41 ((void *)0)-
42 ,-
43 enc_ctrl,-
44 enc_new,-
45 enc_free,-
46 enc_callback_ctrl,-
47};-
48-
49const BIO_METHOD *BIO_f_cipher(void)-
50{-
51 return
executed 37594 times by 1 test: return &methods_enc;
Executed by:
  • libcrypto.so.1.1
&methods_enc;
executed 37594 times by 1 test: return &methods_enc;
Executed by:
  • libcrypto.so.1.1
37594
52}-
53-
54static int enc_new(BIO *bi)-
55{-
56 BIO_ENC_CTX *ctx;-
57-
58 if ((
(ctx = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx = CRYPTO_zalloc(sizeof(*ctx), __FILE__, 68)) ==
(ctx = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
59 ((void *)0)
(ctx = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
60 ) {-
61 ERR_put_error(6,(199),((1|64)),__FILE__,69);-
62 return
never executed: return 0;
0;
never executed: return 0;
0
63 }-
64-
65 ctx->cipher = EVP_CIPHER_CTX_new();-
66 if (ctx->cipher ==
ctx->cipher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
67 ((void *)0)
ctx->cipher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
68 ) {-
69 CRYPTO_free(ctx, __FILE__, 75);-
70 return
never executed: return 0;
0;
never executed: return 0;
0
71 }-
72 ctx->cont = 1;-
73 ctx->ok = 1;-
74 ctx->read_end = ctx->read_start = &(ctx->buf[((256) + 32)]);-
75 BIO_set_data(bi, ctx);-
76 BIO_set_init(bi, 1);-
77-
78 return
executed 37594 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 37594 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
37594
79}-
80-
81static int enc_free(BIO *a)-
82{-
83 BIO_ENC_CTX *b;-
84-
85 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
86 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
87 )-
88 return
never executed: return 0;
0;
never executed: return 0;
0
89-
90 b = BIO_get_data(a);-
91 if (b ==
b == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
92 ((void *)0)
b == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 37594 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-37594
93 )-
94 return
never executed: return 0;
0;
never executed: return 0;
0
95-
96 EVP_CIPHER_CTX_free(b->cipher);-
97 CRYPTO_clear_free(b, sizeof(BIO_ENC_CTX), __FILE__, 99);-
98 BIO_set_data(a, -
99 ((void *)0)-
100 );-
101 BIO_set_init(a, 0);-
102-
103 return
executed 37594 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 37594 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
37594
104}-
105-
106static int enc_read(BIO *b, char *out, int outl)-
107{-
108 int ret = 0, i, blocksize;-
109 BIO_ENC_CTX *ctx;-
110 BIO *next;-
111-
112 if (out ==
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235890
113 ((void *)0)
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235890
114 )-
115 return
never executed: return 0;
0;
never executed: return 0;
0
116 ctx = BIO_get_data(b);-
117-
118 next = BIO_next(b);-
119 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235890
120 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235890
121 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
next ==
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235890
122 ((void *)0)
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-235890
123 )
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 235890 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-235890
124 return
never executed: return 0;
0;
never executed: return 0;
0
125-
126-
127 if (ctx->buf_len > 0
ctx->buf_len > 0Description
TRUEevaluated 186712 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 49178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
49178-186712
128 i = ctx->buf_len - ctx->buf_off;-
129 if (i > outl
i > outlDescription
TRUEevaluated 122088 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 64624 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
64624-122088
130 i = outl;
executed 122088 times by 1 test: i = outl;
Executed by:
  • libcrypto.so.1.1
122088
131 memcpy(out, &(ctx->buf[ctx->buf_off]), i);-
132 ret = i;-
133 out += i;-
134 outl -= i;-
135 ctx->buf_off += i;-
136 if (ctx->buf_len == ctx->buf_off
ctx->buf_len == ctx->buf_offDescription
TRUEevaluated 64624 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 122088 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
64624-122088
137 ctx->buf_len = 0;-
138 ctx->buf_off = 0;-
139 }
executed 64624 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
64624
140 }
executed 186712 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
186712
141-
142 blocksize = EVP_CIPHER_CTX_block_size(ctx->cipher);-
143 if (blocksize == 1
blocksize == 1Description
TRUEevaluated 196160 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 39730 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
39730-196160
144 blocksize = 0;
executed 196160 times by 1 test: blocksize = 0;
Executed by:
  • libcrypto.so.1.1
196160
145-
146-
147-
148-
149-
150-
151 while (outl > 0
outl > 0Description
TRUEevaluated 138946 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 166368 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
138946-166368
152 if (ctx->cont <= 0
ctx->cont <= 0Description
TRUEevaluated 15264 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 123682 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
15264-123682
153 break;
executed 15264 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
15264
154-
155 if (ctx->read_start == ctx->read_end
ctx->read_star... ctx->read_endDescription
TRUEevaluated 73928 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 49754 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
49754-73928
156 ctx->read_end = ctx->read_start = &(ctx->buf[((256) + 32)]);-
157 i = BIO_read(next, ctx->read_start, (1024*4));-
158 if (i > 0
i > 0Description
TRUEevaluated 36964 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 36964 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
36964
159 ctx->read_end += i;
executed 36964 times by 1 test: ctx->read_end += i;
Executed by:
  • libcrypto.so.1.1
36964
160 }
executed 73928 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
73928
161 i = ctx->read_end - ctx->read_start;-
162 }
executed 49754 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
49754
163-
164 if (i <= 0
i <= 0Description
TRUEevaluated 36964 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 86718 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
36964-86718
165-
166 if (!BIO_test_flags(next, 0x08)
!BIO_test_flags(next, 0x08)Description
TRUEevaluated 36964 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-36964
167 ctx->cont = i;-
168 i = EVP_CipherFinal_ex(ctx->cipher,-
169 ctx->buf, &(ctx->buf_len));-
170 ctx->ok = i;-
171 ctx->buf_off = 0;-
172 }
executed 36964 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else {
36964
173 ret = (
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
ret == 0)
(ret == 0)Description
TRUEnever evaluated
FALSEnever evaluated
? i : ret;
0
174 break;
never executed: break;
0
175 }-
176 } else {-
177 if (outl > (256)
outl > (256)Description
TRUEevaluated 40898 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 45820 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
40898-45820
178-
179-
180-
181-
182-
183 int j = outl - blocksize, buf_len;-
184-
185 if (!EVP_CipherUpdate(ctx->cipher,
!EVP_CipherUpd...i > j ? j : i)Description
TRUEnever evaluated
FALSEevaluated 40898 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-40898
186 (unsigned char *)out, &buf_len,
!EVP_CipherUpd...i > j ? j : i)Description
TRUEnever evaluated
FALSEevaluated 40898 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-40898
187 ctx->read_start, i > j ? j : i)
!EVP_CipherUpd...i > j ? j : i)Description
TRUEnever evaluated
FALSEevaluated 40898 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-40898
188 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
189 return
never executed: return 0;
0;
never executed: return 0;
0
190 }-
191 ret += buf_len;-
192 out += buf_len;-
193 outl -= buf_len;-
194-
195 if ((
(i -= j) <= 0Description
TRUEevaluated 16156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24742 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
i -= j) <= 0
(i -= j) <= 0Description
TRUEevaluated 16156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 24742 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
16156-24742
196 ctx->read_start = ctx->read_end;-
197 continue;
executed 16156 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
16156
198 }-
199 ctx->read_start += j;-
200 }
executed 24742 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
24742
201 if (i > (256)
i > (256)Description
TRUEevaluated 49754 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20808 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
20808-49754
202 i = (256);
executed 49754 times by 1 test: i = (256);
Executed by:
  • libcrypto.so.1.1
49754
203 if (!EVP_CipherUpdate(ctx->cipher,
!EVP_CipherUpd...read_start, i)Description
TRUEnever evaluated
FALSEevaluated 70562 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-70562
204 ctx->buf, &ctx->buf_len,
!EVP_CipherUpd...read_start, i)Description
TRUEnever evaluated
FALSEevaluated 70562 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-70562
205 ctx->read_start, i)
!EVP_CipherUpd...read_start, i)Description
TRUEnever evaluated
FALSEevaluated 70562 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-70562
206 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
207 ctx->ok = 0;-
208 return
never executed: return 0;
0;
never executed: return 0;
0
209 }-
210 ctx->read_start += i;-
211 ctx->cont = 1;-
212-
213-
214-
215-
216-
217-
218 if (ctx->buf_len == 0
ctx->buf_len == 0Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 70498 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
64-70498
219 continue;
executed 64 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
64
220 }
executed 70498 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
70498
221-
222 if (ctx->buf_len <= outl
ctx->buf_len <= outlDescription
TRUEevaluated 43910 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 63552 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
43910-63552
223 i = ctx->buf_len;
executed 43910 times by 1 test: i = ctx->buf_len;
Executed by:
  • libcrypto.so.1.1
43910
224 else-
225 i = outl;
executed 63552 times by 1 test: i = outl;
Executed by:
  • libcrypto.so.1.1
63552
226 if (i <= 0
i <= 0Description
TRUEevaluated 54258 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
53204-54258
227 break;
executed 54258 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
54258
228 memcpy(out, ctx->buf, i);-
229 ret += i;-
230 ctx->buf_off = i;-
231 outl -= i;-
232 out += i;-
233 }
executed 53204 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
53204
234-
235 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
236 BIO_copy_next_retry(b);-
237 return
executed 235890 times by 1 test: return ((ret == 0) ? ctx->cont : ret);
Executed by:
  • libcrypto.so.1.1
((
(ret == 0)Description
TRUEevaluated 12356 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 223534 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ret == 0)
(ret == 0)Description
TRUEevaluated 12356 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 223534 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? ctx->cont : ret);
executed 235890 times by 1 test: return ((ret == 0) ? ctx->cont : ret);
Executed by:
  • libcrypto.so.1.1
12356-235890
238}-
239-
240static int enc_write(BIO *b, const char *in, int inl)-
241{-
242 int ret = 0, n, i;-
243 BIO_ENC_CTX *ctx;-
244 BIO *next;-
245-
246 ctx = BIO_get_data(b);-
247 next = BIO_next(b);-
248 if ((
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx ==
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6255
249 ((void *)0)
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6255
250 )
(ctx == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
next ==
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6255
251 ((void *)0)
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6255
252 )
(next == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-6255
253 return
never executed: return 0;
0;
never executed: return 0;
0
254-
255 ret = inl;-
256-
257 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
258 n = ctx->buf_len - ctx->buf_off;-
259 while (n > 0
n > 0Description
TRUEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6255 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
313-6255
260 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);-
261 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-313
262 BIO_copy_next_retry(b);-
263 return
never executed: return i;
i;
never executed: return i;
0
264 }-
265 ctx->buf_off += i;-
266 n -= i;-
267 }
executed 313 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
313
268-
269-
270 if ((
(in == ((void *)0) )Description
TRUEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
in ==
(in == ((void *)0) )Description
TRUEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
313-5942
271 ((void *)0)
(in == ((void *)0) )Description
TRUEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
313-5942
272 )
(in == ((void *)0) )Description
TRUEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(inl <= 0)Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
inl <= 0)
(inl <= 0)Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-5942
273 return
executed 313 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 313 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
313
274-
275 ctx->buf_off = 0;-
276 while (inl > 0
inl > 0Description
TRUEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
5942
277 n = (
(inl > (1024*4))Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
inl > (1024*4))
(inl > (1024*4))Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
? (1024*4) : inl;
0-5942
278 if (!EVP_CipherUpdate(ctx->cipher,
!EVP_CipherUpd... char *)in, n)Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5942
279 ctx->buf, &ctx->buf_len,
!EVP_CipherUpd... char *)in, n)Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5942
280 (const unsigned char *)in, n)
!EVP_CipherUpd... char *)in, n)Description
TRUEnever evaluated
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-5942
281 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
282 ctx->ok = 0;-
283 return
never executed: return 0;
0;
never executed: return 0;
0
284 }-
285 inl -= n;-
286 in += n;-
287-
288 ctx->buf_off = 0;-
289 n = ctx->buf_len;-
290 while (n > 0
n > 0Description
TRUEevaluated 5896 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5942 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
5896-5942
291 i = BIO_write(next, &(ctx->buf[ctx->buf_off]), n);-
292 if (i <= 0
i <= 0Description
TRUEnever evaluated
FALSEevaluated 5896 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-5896
293 BIO_copy_next_retry(b);-
294 return
never executed: return (ret == inl) ? i : ret - inl;
(
(ret == inl)Description
TRUEnever evaluated
FALSEnever evaluated
ret == inl)
(ret == inl)Description
TRUEnever evaluated
FALSEnever evaluated
? i : ret - inl;
never executed: return (ret == inl) ? i : ret - inl;
0
295 }-
296 n -= i;-
297 ctx->buf_off += i;-
298 }
executed 5896 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5896
299 ctx->buf_len = 0;-
300 ctx->buf_off = 0;-
301 }
executed 5942 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5942
302 BIO_copy_next_retry(b);-
303 return
executed 5942 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 5942 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
5942
304}-
305-
306static long enc_ctrl(BIO *b, int cmd, long num, void *ptr)-
307{-
308 BIO *dbio;-
309 BIO_ENC_CTX *ctx, *dctx;-
310 long ret = 1;-
311 int i;-
312 EVP_CIPHER_CTX **c_ctx;-
313 BIO *next;-
314-
315 ctx = BIO_get_data(b);-
316 next = BIO_next(b);-
317 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 39033 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-39033
318 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 39033 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-39033
319 )-
320 return
never executed: return 0;
0;
never executed: return 0;
0
321-
322 switch (cmd) {-
323 case
never executed: case 1:
1:
never executed: case 1:
0
324 ctx->ok = 1;-
325 ctx->finished = 0;-
326 if (!EVP_CipherInit_ex(ctx->cipher,
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
327 ((void *)0)
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
328 ,
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
329 ((void *)0)
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
330 ,
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
331 ((void *)0)
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
332 ,
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
333 ((void *)0)
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
334 ,
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
0
335 EVP_CIPHER_CTX_encrypting(ctx->cipher))
!EVP_CipherIni...(ctx->cipher))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
336 return
never executed: return 0;
0;
never executed: return 0;
0
337 ret = BIO_ctrl(next, cmd, num, ptr);-
338 break;
never executed: break;
0
339 case
never executed: case 2:
2:
never executed: case 2:
0
340 if (ctx->cont <= 0
ctx->cont <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
341 ret = 1;
never executed: ret = 1;
0
342 else-
343 ret = BIO_ctrl(next, cmd, num, ptr);
never executed: ret = BIO_ctrl(next, cmd, num, ptr);
0
344 break;
never executed: break;
0
345 case
never executed: case 13:
13:
never executed: case 13:
0
346 ret = ctx->buf_len - ctx->buf_off;-
347 if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
348 ret = BIO_ctrl(next, cmd, num, ptr);
never executed: ret = BIO_ctrl(next, cmd, num, ptr);
0
349 break;
never executed: break;
0
350 case
never executed: case 10:
10:
never executed: case 10:
0
351 ret = ctx->buf_len - ctx->buf_off;-
352 if (ret <= 0
ret <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
353 ret = BIO_ctrl(next, cmd, num, ptr);
never executed: ret = BIO_ctrl(next, cmd, num, ptr);
0
354 break;
never executed: break;
0
355 case
executed 670 times by 1 test: case 11:
Executed by:
  • libcrypto.so.1.1
11:
executed 670 times by 1 test: case 11:
Executed by:
  • libcrypto.so.1.1
670
356-
357 again:-
358 while (ctx->buf_len != ctx->buf_off
ctx->buf_len != ctx->buf_offDescription
TRUEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1310 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
313-1310
359 i = enc_write(b, -
360 ((void *)0)-
361 , 0);-
362 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 313 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-313
363 return
never executed: return i;
i;
never executed: return i;
0
364 }
executed 313 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
313
365-
366 if (!ctx->finished
!ctx->finishedDescription
TRUEevaluated 642 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 668 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
642-668
367 ctx->finished = 1;-
368 ctx->buf_off = 0;-
369 ret = EVP_CipherFinal_ex(ctx->cipher,-
370 (unsigned char *)ctx->buf,-
371 &(ctx->buf_len));-
372 ctx->ok = (int)ret;-
373 if (ret <= 0
ret <= 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 640 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2-640
374 break;
executed 2 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
2
375-
376-
377 goto
executed 640 times by 1 test: goto again;
Executed by:
  • libcrypto.so.1.1
again;
executed 640 times by 1 test: goto again;
Executed by:
  • libcrypto.so.1.1
640
378 }-
379-
380-
381 ret = BIO_ctrl(next, cmd, num, ptr);-
382 break;
executed 668 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
668
383 case
executed 28 times by 1 test: case 113:
Executed by:
  • libcrypto.so.1.1
113:
executed 28 times by 1 test: case 113:
Executed by:
  • libcrypto.so.1.1
28
384 ret = (long)ctx->ok;-
385 break;
executed 28 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
28
386 case
never executed: case 101:
101:
never executed: case 101:
0
387 BIO_clear_flags(b, ((0x01|0x02|0x04)|0x08));-
388 ret = BIO_ctrl(next, cmd, num, ptr);-
389 BIO_copy_next_retry(b);-
390 break;
never executed: break;
0
391 case
executed 658 times by 1 test: case 129:
Executed by:
  • libcrypto.so.1.1
129:
executed 658 times by 1 test: case 129:
Executed by:
  • libcrypto.so.1.1
658
392 c_ctx = (EVP_CIPHER_CTX **)ptr;-
393 *c_ctx = ctx->cipher;-
394 BIO_set_init(b, 1);-
395 break;
executed 658 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
658
396 case
never executed: case 12:
12:
never executed: case 12:
0
397 dbio = (BIO *)ptr;-
398 dctx = BIO_get_data(dbio);-
399 dctx->cipher = EVP_CIPHER_CTX_new();-
400 if (dctx->cipher ==
dctx->cipher == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
401 ((void *)0)
dctx->cipher == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
402 )-
403 return
never executed: return 0;
0;
never executed: return 0;
0
404 ret = EVP_CIPHER_CTX_copy(dctx->cipher, ctx->cipher);-
405 if (ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
406 BIO_set_init(dbio, 1);
never executed: BIO_set_init(dbio, 1);
0
407 break;
never executed: break;
0
408 default
executed 37677 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 37677 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
37677
409 ret = BIO_ctrl(next, cmd, num, ptr);-
410 break;
executed 37677 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
37677
411 }-
412 return
executed 39033 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 39033 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
39033
413}-
414-
415static long enc_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)-
416{-
417 long ret = 1;-
418 BIO *next = BIO_next(b);-
419-
420 if (next ==
next == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
421 ((void *)0)
next == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
422 )-
423 return
never executed: return 0;
0;
never executed: return 0;
0
424 switch (cmd) {-
425 default
never executed: default:
:
never executed: default:
0
426 ret = BIO_callback_ctrl(next, cmd, fp);-
427 break;
never executed: break;
0
428 }-
429 return
never executed: return ret;
ret;
never executed: return ret;
0
430}-
431-
432int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,-
433 const unsigned char *i, int e)-
434{-
435 BIO_ENC_CTX *ctx;-
436 long (*callback) (struct bio_st *, int, const char *, int, long, long);-
437-
438 ctx = BIO_get_data(b);-
439 if (ctx ==
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
440 ((void *)0)
ctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
441 )-
442 return
never executed: return 0;
0;
never executed: return 0;
0
443-
444 callback = BIO_get_callback(b);-
445-
446 if ((
(callback != ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
callback !=
(callback != ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
447 ((void *)0)
(callback != ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
448 )
(callback != ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&&
0-36936
449 (
(callback(b, 0..., e, 0L) <= 0)Description
TRUEnever evaluated
FALSEnever evaluated
callback(b, 0x06, (const char *)c, 4, e,
(callback(b, 0..., e, 0L) <= 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
450 0L) <= 0)
(callback(b, 0..., e, 0L) <= 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
451 return
never executed: return 0;
0;
never executed: return 0;
0
452-
453 BIO_set_init(b, 1);-
454-
455 if (!EVP_CipherInit_ex(ctx->cipher, c,
!EVP_CipherIni...)0) , k, i, e)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
456 ((void *)0)
!EVP_CipherIni...)0) , k, i, e)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
457 , k, i, e)
!EVP_CipherIni...)0) , k, i, e)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-36936
458 return
never executed: return 0;
0;
never executed: return 0;
0
459-
460 if (callback !=
callback != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
461 ((void *)0)
callback != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 36936 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-36936
462 )-
463 return
never executed: return callback(b, 0x06, (const char *)c, 4, e, 1L);
callback(b, 0x06, (const char *)c, 4, e, 1L);
never executed: return callback(b, 0x06, (const char *)c, 4, e, 1L);
0
464 return
executed 36936 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 36936 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
36936
465}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2