OpenCoverage

evp_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/evp/evp_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11int-
12EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
13 const unsigned char *key, const unsigned char *iv, int enc)-
14{-
15 if (cipher
cipherDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
16 EVP_CIPHER_CTX_init(ctx);
never executed: EVP_CIPHER_CTX_init(ctx);
0
17 return
never executed: return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc);
EVP_CipherInit_ex(ctx, cipher,
never executed: return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc);
0
18 ((void *)0)
never executed: return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc);
0
19 , key, iv, enc);
never executed: return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc);
0
20}-
21-
22int-
23EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,-
24 const unsigned char *key, const unsigned char *iv, int enc)-
25{-
26 if (enc == -1
enc == -1Description
TRUEnever evaluated
FALSEevaluated 878 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
)
0-878
27 enc = ctx->encrypt;
never executed: enc = ctx->encrypt;
0
28 else {-
29 if (enc
encDescription
TRUEevaluated 486 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 392 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
)
392-486
30 enc = 1;
executed 486 times by 5 tests: enc = 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
486
31 ctx->encrypt = enc;-
32 }
executed 878 times by 5 tests: end of block
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
878
33-
34-
35-
36-
37-
38 if (ctx->engine
ctx->engineDescription
TRUEnever evaluated
FALSEevaluated 878 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
&& ctx->cipher
ctx->cipherDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0-878
39 (!cipher
!cipherDescription
TRUEnever evaluated
FALSEnever evaluated
|| (cipher
cipherDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(cipher->nid =...->cipher->nid)Description
TRUEnever evaluated
FALSEnever evaluated
cipher->nid == ctx->cipher->nid)
(cipher->nid =...->cipher->nid)Description
TRUEnever evaluated
FALSEnever evaluated
)))
0
40 goto
never executed: goto skip_to_init;
skip_to_init;
never executed: goto skip_to_init;
0
41-
42 if (cipher
cipherDescription
TRUEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
198-680
43-
44-
45-
46 if (ctx->cipher
ctx->cipherDescription
TRUEevaluated 66 times by 1 test
Evaluated by:
  • evptest
FALSEevaluated 614 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
66-614
47 unsigned long flags = ctx->flags;-
48 EVP_CIPHER_CTX_cleanup(ctx);-
49-
50 ctx->encrypt = enc;-
51 ctx->flags = flags;-
52 }
executed 66 times by 1 test: end of block
Executed by:
  • evptest
66
53-
54 if (impl
implDescription
TRUEnever evaluated
FALSEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-680
55 if (!ENGINE_init(impl)
!ENGINE_init(impl)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
56 ERR_put_error(6,(0xfff),(134),__FILE__,121);-
57 return
never executed: return 0;
0;
never executed: return 0;
0
58 }-
59 }
never executed: end of block
else
0
60-
61 impl = ENGINE_get_cipher_engine(cipher->nid);
executed 680 times by 5 tests: impl = ENGINE_get_cipher_engine(cipher->nid);
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
62 if (impl
implDescription
TRUEnever evaluated
FALSEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-680
63-
64 const EVP_CIPHER *c =-
65 ENGINE_get_cipher(impl, cipher->nid);-
66 if (!c
!cDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
67 ERR_put_error(6,(0xfff),(134),__FILE__,132);-
68 return
never executed: return 0;
0;
never executed: return 0;
0
69 }-
70-
71 cipher = c;-
72-
73-
74-
75 ctx->engine = impl;-
76 }
never executed: end of block
else
0
77 ctx->engine =
executed 680 times by 5 tests: ctx->engine = ((void *)0) ;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
78 ((void *)0)
executed 680 times by 5 tests: ctx->engine = ((void *)0) ;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
79 ;
executed 680 times by 5 tests: ctx->engine = ((void *)0) ;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
80-
81-
82 ctx->cipher = cipher;-
83 if (ctx->cipher->ctx_size
ctx->cipher->ctx_sizeDescription
TRUEevaluated 668 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 12 times by 1 test
Evaluated by:
  • ssltest
) {
12-668
84 ctx->cipher_data = malloc(ctx->cipher->ctx_size);-
85 if (!ctx->cipher_data
!ctx->cipher_dataDescription
TRUEnever evaluated
FALSEevaluated 668 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-668
86 ERR_put_error(6,(0xfff),((1|64)),__FILE__,149);-
87 return
never executed: return 0;
0;
never executed: return 0;
0
88 }-
89 }
executed 668 times by 5 tests: end of block
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
else {
668
90 ctx->cipher_data = -
91 ((void *)0)-
92 ;-
93 }
executed 12 times by 1 test: end of block
Executed by:
  • ssltest
12
94 ctx->key_len = cipher->key_len;-
95 ctx->flags = 0;-
96 if (ctx->cipher->flags & 0x40
ctx->cipher->flags & 0x40Description
TRUEevaluated 36 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
FALSEevaluated 644 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
36-644
97 if (!EVP_CIPHER_CTX_ctrl(ctx, 0x0, 0,
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
0-36
98 ((void *)0)
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
0-36
99 )
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
) {
0-36
100 ERR_put_error(6,(0xfff),(134),__FILE__,159);-
101 return
never executed: return 0;
0;
never executed: return 0;
0
102 }-
103 }
executed 36 times by 2 tests: end of block
Executed by:
  • gost2814789t
  • libcrypto.so.44.0.1
36
104 }
executed 680 times by 5 tests: end of block
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
else if (!ctx->cipher
!ctx->cipherDescription
TRUEnever evaluated
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-680
105 ERR_put_error(6,(0xfff),(131),__FILE__,164);-
106 return
never executed: return 0;
0;
never executed: return 0;
0
107 }-
108-
109skip_to_init:
code before this statement executed 878 times by 5 tests: skip_to_init:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
878
110-
111-
112 if (ctx->cipher->block_size != 1
ctx->cipher->block_size != 1Description
TRUEevaluated 517 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 361 times by 4 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • ssltest
&&
361-517
113 ctx->cipher->block_size != 8
ctx->cipher->block_size != 8Description
TRUEevaluated 363 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 154 times by 4 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • ssltest
&&
154-363
114 ctx->cipher->block_size != 16
ctx->cipher->block_size != 16Description
TRUEnever evaluated
FALSEevaluated 363 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-363
115 ERR_put_error(6,(0xfff),(136),__FILE__,174);-
116 return
never executed: return 0;
0;
never executed: return 0;
0
117 }-
118-
119 if (!(EVP_CIPHER_CTX_flags(ctx) & 0x10)
!(EVP_CIPHER_C...s(ctx) & 0x10)Description
TRUEevaluated 878 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
) {
0-878
120 switch ((EVP_CIPHER_CTX_flags(ctx) & 0xF0007)) {-
121-
122 case
executed 48 times by 3 tests: case 0x0:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
  • ssltest
0x0:
executed 48 times by 3 tests: case 0x0:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
  • ssltest
48
123 case
executed 150 times by 3 tests: case 0x1:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
0x1:
executed 150 times by 3 tests: case 0x1:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
150
124 break;
executed 198 times by 4 tests: break;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • ssltest
198
125-
126 case
executed 181 times by 3 tests: case 0x3:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
0x3:
executed 181 times by 3 tests: case 0x3:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
181
127 case
executed 123 times by 3 tests: case 0x4:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
0x4:
executed 123 times by 3 tests: case 0x4:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
123
128-
129 ctx->num = 0;-
130-
131-
132 case
executed 367 times by 4 tests: case 0x2:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
0x2:
executed 367 times by 4 tests: case 0x2:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
code before this statement executed 304 times by 3 tests: case 0x2:
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
304-367
133-
134 if ((
(size_t)EVP_CI...izeof(ctx->iv)Description
TRUEnever evaluated
FALSEevaluated 671 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
size_t)EVP_CIPHER_CTX_iv_length(ctx) >
(size_t)EVP_CI...izeof(ctx->iv)Description
TRUEnever evaluated
FALSEevaluated 671 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
0-671
135 sizeof(ctx->iv)
(size_t)EVP_CI...izeof(ctx->iv)Description
TRUEnever evaluated
FALSEevaluated 671 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-671
136 ERR_put_error(6,(0xfff),(102),__FILE__,195);-
137 return
never executed: return 0;
0;
never executed: return 0;
0
138 }-
139 if (iv
ivDescription
TRUEevaluated 516 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 155 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
155-516
140 memcpy(ctx->oiv, iv,
executed 516 times by 5 tests: memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
516
141 EVP_CIPHER_CTX_iv_length(ctx));
executed 516 times by 5 tests: memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
516
142 memcpy(ctx->iv, ctx->oiv,-
143 EVP_CIPHER_CTX_iv_length(ctx));-
144 break;
executed 671 times by 5 tests: break;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
671
145-
146 case
executed 9 times by 1 test: case 0x5:
Executed by:
  • evptest
0x5:
executed 9 times by 1 test: case 0x5:
Executed by:
  • evptest
9
147 ctx->num = 0;-
148-
149 if (iv
ivDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • evptest
FALSEnever evaluated
)
0-9
150 memcpy(ctx->iv, iv,
executed 9 times by 1 test: memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx));
Executed by:
  • evptest
9
151 EVP_CIPHER_CTX_iv_length(ctx));
executed 9 times by 1 test: memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx));
Executed by:
  • evptest
9
152 break;
executed 9 times by 1 test: break;
Executed by:
  • evptest
9
153-
154 default
never executed: default:
:
never executed: default:
0
155 return
never executed: return 0;
0;
never executed: return 0;
0
156 break;
dead code: break;
-
157 }-
158 }-
159-
160 if (key
keyDescription
TRUEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
|| (
(ctx->cipher->flags & 0x20)Description
TRUEnever evaluated
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
ctx->cipher->flags & 0x20)
(ctx->cipher->flags & 0x20)Description
TRUEnever evaluated
FALSEevaluated 198 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-680
161 if (!ctx->cipher->init(ctx, key, iv, enc)
!ctx->cipher->... key, iv, enc)Description
TRUEnever evaluated
FALSEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
)
0-680
162 return
never executed: return 0;
0;
never executed: return 0;
0
163 }
executed 680 times by 5 tests: end of block
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
164 ctx->buf_len = 0;-
165 ctx->final_used = 0;-
166 ctx->block_mask = ctx->cipher->block_size - 1;-
167 return
executed 878 times by 5 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
1;
executed 878 times by 5 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
878
168}-
169-
170int-
171EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,-
172 const unsigned char *in, int inl)-
173{-
174 if (ctx->encrypt
ctx->encryptDescription
TRUEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
99
175 return
executed 99 times by 2 tests: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
EVP_EncryptUpdate(ctx, out, outl, in, inl);
executed 99 times by 2 tests: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
176 else-
177 return
executed 99 times by 2 tests: return EVP_DecryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
EVP_DecryptUpdate(ctx, out, outl, in, inl);
executed 99 times by 2 tests: return EVP_DecryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
178}-
179-
180int-
181EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
182{-
183 if (ctx->encrypt
ctx->encryptDescription
TRUEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
99
184 return
executed 99 times by 2 tests: return EVP_EncryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
EVP_EncryptFinal_ex(ctx, out, outl);
executed 99 times by 2 tests: return EVP_EncryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
185 else-
186 return
executed 99 times by 2 tests: return EVP_DecryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
EVP_DecryptFinal_ex(ctx, out, outl);
executed 99 times by 2 tests: return EVP_DecryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
187}-
188-
189-
190__asm__(".section .gnu.warning." -
191"EVP_CipherFinal" -
192"\n\t.ascii \"" -
193"EVP_CipherFinal is often misused, please use EVP_CipherFinal_ex and EVP_CIPHER_CTX_cleanup" -
194"\"\n\t.text");-
195 -
196 ;-
197-
198int-
199EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
200{-
201 int ret;-
202 if (ctx->encrypt
ctx->encryptDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
203 ret = EVP_EncryptFinal_ex(ctx, out, outl);
never executed: ret = EVP_EncryptFinal_ex(ctx, out, outl);
0
204 else-
205 ret = EVP_DecryptFinal_ex(ctx, out, outl);
never executed: ret = EVP_DecryptFinal_ex(ctx, out, outl);
0
206 return
never executed: return ret;
ret;
never executed: return ret;
0
207}-
208-
209int-
210EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
211 const unsigned char *key, const unsigned char *iv)-
212{-
213 return
never executed: return EVP_CipherInit(ctx, cipher, key, iv, 1);
EVP_CipherInit(ctx, cipher, key, iv, 1);
never executed: return EVP_CipherInit(ctx, cipher, key, iv, 1);
0
214}-
215-
216int-
217EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,-
218 const unsigned char *key, const unsigned char *iv)-
219{-
220 return
executed 208 times by 3 tests: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
Executed by:
  • evptest
  • gost2814789t
  • ssltest
EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
executed 208 times by 3 tests: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
Executed by:
  • evptest
  • gost2814789t
  • ssltest
208
221}-
222-
223int-
224EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
225 const unsigned char *key, const unsigned char *iv)-
226{-
227 return
never executed: return EVP_CipherInit(ctx, cipher, key, iv, 0);
EVP_CipherInit(ctx, cipher, key, iv, 0);
never executed: return EVP_CipherInit(ctx, cipher, key, iv, 0);
0
228}-
229-
230int-
231EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,-
232 const unsigned char *key, const unsigned char *iv)-
233{-
234 return
executed 114 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
Executed by:
  • evptest
EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
executed 114 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
Executed by:
  • evptest
114
235}-
236-
237int-
238EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,-
239 const unsigned char *in, int inl)-
240{-
241 int i, j, bl;-
242-
243 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEnever evaluated
FALSEevaluated 520 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-520
244 i = ctx->cipher->do_cipher(ctx, out, in, inl);-
245 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
246 return
never executed: return 0;
0;
never executed: return 0;
0
247 else-
248 *
never executed: *outl = i;
outl = i;
never executed: *outl = i;
0
249 return
never executed: return 1;
1;
never executed: return 1;
0
250 }-
251-
252 if (inl <= 0
inl <= 0Description
TRUEnever evaluated
FALSEevaluated 520 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-520
253 *outl = 0;-
254 return
never executed: return inl == 0;
inl == 0;
never executed: return inl == 0;
0
255 }-
256-
257 if (ctx->buf_len == 0
ctx->buf_len == 0Description
TRUEevaluated 520 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
&& (
(inl&(ctx->block_mask)) == 0Description
TRUEevaluated 448 times by 4 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
inl&(ctx->block_mask)) == 0
(inl&(ctx->block_mask)) == 0Description
TRUEevaluated 448 times by 4 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-520
258 if (ctx->cipher->do_cipher(ctx, out, in, inl)
ctx->cipher->d... out, in, inl)Description
TRUEevaluated 448 times by 4 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEnever evaluated
) {
0-448
259 *outl = inl;-
260 return
executed 448 times by 4 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
1;
executed 448 times by 4 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
448
261 } else {-
262 *outl = 0;-
263 return
never executed: return 0;
0;
never executed: return 0;
0
264 }-
265 }-
266 i = ctx->buf_len;-
267 bl = ctx->cipher->block_size;-
268 if ((
(size_t)bl > sizeof(ctx->buf)Description
TRUEnever evaluated
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
size_t)bl > sizeof(ctx->buf)
(size_t)bl > sizeof(ctx->buf)Description
TRUEnever evaluated
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-72
269 ERR_put_error(6,(0xfff),(136),__FILE__,322);-
270 *outl = 0;-
271 return
never executed: return 0;
0;
never executed: return 0;
0
272 }-
273 if (i != 0
i != 0Description
TRUEnever evaluated
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-72
274 if (bl - i > inl
bl - i > inlDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 memcpy(&(ctx->buf[i]), in, inl);-
276 ctx->buf_len += inl;-
277 *outl = 0;-
278 return
never executed: return 1;
1;
never executed: return 1;
0
279 } else {-
280 j = bl - i;-
281 memcpy(&(ctx->buf[i]), in, j);-
282 if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl)
!ctx->cipher->... ctx->buf, bl)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
283 return
never executed: return 0;
0;
never executed: return 0;
0
284 inl -= j;-
285 in += j;-
286 out += bl;-
287 *outl = bl;-
288 }
never executed: end of block
0
289 } else-
290 *
executed 72 times by 3 tests: *outl = 0;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
outl = 0;
executed 72 times by 3 tests: *outl = 0;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
72
291 i = inl&(bl - 1);-
292 inl -= i;-
293 if (inl > 0
inl > 0Description
TRUEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
) {
0-72
294 if (!ctx->cipher->do_cipher(ctx, out, in, inl)
!ctx->cipher->... out, in, inl)Description
TRUEnever evaluated
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
)
0-72
295 return
never executed: return 0;
0;
never executed: return 0;
0
296 *outl += inl;-
297 }
executed 72 times by 3 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
72
298-
299 if (i != 0
i != 0Description
TRUEevaluated 72 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
)
0-72
300 memcpy(ctx->buf, &(in[inl]), i);
executed 72 times by 3 tests: memcpy(ctx->buf, &(in[inl]), i);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
72
301 ctx->buf_len = i;-
302 return
executed 72 times by 3 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
1;
executed 72 times by 3 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
72
303}-
304-
305-
306__asm__(".section .gnu.warning." -
307"EVP_EncryptFinal" -
308"\n\t.ascii \"" -
309"EVP_EncryptFinal is often misused, please use EVP_EncryptFinal_ex and EVP_CIPHER_CTX_cleanup" -
310"\"\n\t.text");-
311 -
312 ;-
313-
314int-
315EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
316{-
317 int ret;-
318-
319 ret = EVP_EncryptFinal_ex(ctx, out, outl);-
320 return
never executed: return ret;
ret;
never executed: return ret;
0
321}-
322-
323int-
324EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
325{-
326 int n, ret;-
327 unsigned int i, b, bl;-
328-
329 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEnever evaluated
FALSEevaluated 303 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-303
330 ret = ctx->cipher->do_cipher(ctx, out, -
331 ((void *)0)-
332 , 0);-
333 if (ret < 0
ret < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
334 return
never executed: return 0;
0;
never executed: return 0;
0
335 else-
336 *
never executed: *outl = ret;
outl = ret;
never executed: *outl = ret;
0
337 return
never executed: return 1;
1;
never executed: return 1;
0
338 }-
339-
340 b = ctx->cipher->block_size;-
341 if (b > sizeof ctx->buf
b > sizeof ctx->bufDescription
TRUEnever evaluated
FALSEevaluated 303 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
0-303
342 ERR_put_error(6,(0xfff),(136),__FILE__,387);-
343 return
never executed: return 0;
0;
never executed: return 0;
0
344 }-
345 if (b == 1
b == 1Description
TRUEevaluated 133 times by 3 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
FALSEevaluated 170 times by 4 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
133-170
346 *outl = 0;-
347 return
executed 133 times by 3 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
1;
executed 133 times by 3 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
133
348 }-
349 bl = ctx->buf_len;-
350 if (ctx->flags & 0x100
ctx->flags & 0x100Description
TRUEevaluated 66 times by 1 test
Evaluated by:
  • evptest
FALSEevaluated 104 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
) {
66-104
351 if (bl
blDescription
TRUEnever evaluated
FALSEevaluated 66 times by 1 test
Evaluated by:
  • evptest
) {
0-66
352 ERR_put_error(6,(0xfff),(138),__FILE__,397);-
353 return
never executed: return 0;
0;
never executed: return 0;
0
354 }-
355 *outl = 0;-
356 return
executed 66 times by 1 test: return 1;
Executed by:
  • evptest
1;
executed 66 times by 1 test: return 1;
Executed by:
  • evptest
66
357 }-
358-
359 n = b - bl;-
360 for (i = bl; i < b
i < bDescription
TRUEevaluated 884 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 104 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
; i++)
104-884
361 ctx->buf[i] = n;
executed 884 times by 3 tests: ctx->buf[i] = n;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
884
362 ret = ctx->cipher->do_cipher(ctx, out, ctx->buf, b);-
363-
364-
365 if (ret
retDescription
TRUEevaluated 104 times by 3 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
)
0-104
366 *
executed 104 times by 3 tests: *outl = b;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
outl = b;
executed 104 times by 3 tests: *outl = b;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
104
367-
368 return
executed 104 times by 3 tests: return ret;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
ret;
executed 104 times by 3 tests: return ret;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
104
369}-
370-
371int-
372EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,-
373 const unsigned char *in, int inl)-
374{-
375 int fix_len;-
376 unsigned int b;-
377-
378 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEnever evaluated
FALSEevaluated 213 times by 3 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-213
379 fix_len = ctx->cipher->do_cipher(ctx, out, in, inl);-
380 if (fix_len < 0
fix_len < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
381 *outl = 0;-
382 return
never executed: return 0;
0;
never executed: return 0;
0
383 } else-
384 *
never executed: *outl = fix_len;
outl = fix_len;
never executed: *outl = fix_len;
0
385 return
never executed: return 1;
1;
never executed: return 1;
0
386 }-
387-
388 if (inl <= 0
inl <= 0Description
TRUEnever evaluated
FALSEevaluated 213 times by 3 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-213
389 *outl = 0;-
390 return
never executed: return inl == 0;
inl == 0;
never executed: return inl == 0;
0
391 }-
392-
393 if (ctx->flags & 0x100
ctx->flags & 0x100Description
TRUEevaluated 114 times by 1 test
Evaluated by:
  • evptest
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
99-114
394 return
executed 114 times by 1 test: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • evptest
EVP_EncryptUpdate(ctx, out, outl, in, inl);
executed 114 times by 1 test: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • evptest
114
395-
396 b = ctx->cipher->block_size;-
397 if (b > sizeof ctx->final
b > sizeof ctx->finalDescription
TRUEnever evaluated
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-99
398 ERR_put_error(6,(0xfff),(136),__FILE__,443);-
399 return
never executed: return 0;
0;
never executed: return 0;
0
400 }-
401-
402 if (ctx->final_used
ctx->final_usedDescription
TRUEnever evaluated
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-99
403 memcpy(out, ctx->final, b);-
404 out += b;-
405 fix_len = 1;-
406 }
never executed: end of block
else
0
407 fix_len = 0;
executed 99 times by 2 tests: fix_len = 0;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
408-
409-
410 if (!EVP_EncryptUpdate(ctx, out, outl, in, inl)
!EVP_EncryptUp...outl, in, inl)Description
TRUEnever evaluated
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
0-99
411 return
never executed: return 0;
0;
never executed: return 0;
0
412-
413-
414-
415 if (b > 1
b > 1Description
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 54 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
&& !ctx->buf_len
!ctx->buf_lenDescription
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEnever evaluated
) {
0-54
416 *outl -= b;-
417 ctx->final_used = 1;-
418 memcpy(ctx->final, &out[*outl], b);-
419 }
executed 45 times by 2 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
else
45
420 ctx->final_used = 0;
executed 54 times by 1 test: ctx->final_used = 0;
Executed by:
  • libcrypto.so.44.0.1
54
421-
422 if (fix_len
fix_lenDescription
TRUEnever evaluated
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
)
0-99
423 *
never executed: *outl += b;
outl += b;
never executed: *outl += b;
0
424-
425 return
executed 99 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
1;
executed 99 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
426}-
427-
428-
429__asm__(".section .gnu.warning." -
430"EVP_DecryptFinal" -
431"\n\t.ascii \"" -
432"EVP_DecryptFinal is often misused, please use EVP_DecryptFinal_ex and EVP_CIPHER_CTX_cleanup" -
433"\"\n\t.text");-
434 -
435 ;-
436-
437int-
438EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
439{-
440 int ret;-
441-
442 ret = EVP_DecryptFinal_ex(ctx, out, outl);-
443 return
never executed: return ret;
ret;
never executed: return ret;
0
444}-
445-
446int-
447EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
448{-
449 int i, n;-
450 unsigned int b;-
451 *outl = 0;-
452-
453 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEnever evaluated
FALSEevaluated 213 times by 3 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-213
454 i = ctx->cipher->do_cipher(ctx, out, -
455 ((void *)0)-
456 , 0);-
457 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
458 return
never executed: return 0;
0;
never executed: return 0;
0
459 else-
460 *
never executed: *outl = i;
outl = i;
never executed: *outl = i;
0
461 return
never executed: return 1;
1;
never executed: return 1;
0
462 }-
463-
464 b = ctx->cipher->block_size;-
465 if (ctx->flags & 0x100
ctx->flags & 0x100Description
TRUEevaluated 114 times by 1 test
Evaluated by:
  • evptest
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
99-114
466 if (ctx->buf_len
ctx->buf_lenDescription
TRUEnever evaluated
FALSEevaluated 114 times by 1 test
Evaluated by:
  • evptest
) {
0-114
467 ERR_put_error(6,(0xfff),(138),__FILE__,504);-
468 return
never executed: return 0;
0;
never executed: return 0;
0
469 }-
470 *outl = 0;-
471 return
executed 114 times by 1 test: return 1;
Executed by:
  • evptest
1;
executed 114 times by 1 test: return 1;
Executed by:
  • evptest
114
472 }-
473 if (b > 1
b > 1Description
TRUEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 54 times by 1 test
Evaluated by:
  • libcrypto.so.44.0.1
) {
45-54
474 if (ctx->buf_len
ctx->buf_lenDescription
TRUEnever evaluated
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
|| !ctx->final_used
!ctx->final_usedDescription
TRUEnever evaluated
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-45
475 ERR_put_error(6,(0xfff),(109),__FILE__,512);-
476 return
never executed: return (0);
(0);
never executed: return (0);
0
477 }-
478 if (b > sizeof ctx->final
b > sizeof ctx->finalDescription
TRUEnever evaluated
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-45
479 ERR_put_error(6,(0xfff),(136),__FILE__,516);-
480 return
never executed: return 0;
0;
never executed: return 0;
0
481 }-
482 n = ctx->final[b - 1];-
483 if (n == 0
n == 0Description
TRUEnever evaluated
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
|| n > (int)b
n > (int)bDescription
TRUEnever evaluated
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-45
484 ERR_put_error(6,(0xfff),(100),__FILE__,521);-
485 return
never executed: return (0);
(0);
never executed: return (0);
0
486 }-
487 for (i = 0; i < n
i < nDescription
TRUEevaluated 362 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
; i++) {
45-362
488 if (ctx->final[--b] != n
ctx->final[--b] != nDescription
TRUEnever evaluated
FALSEevaluated 362 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
) {
0-362
489 ERR_put_error(6,(0xfff),(100),__FILE__,526);-
490 return
never executed: return (0);
(0);
never executed: return (0);
0
491 }-
492 }
executed 362 times by 2 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
362
493 n = ctx->cipher->block_size - n;-
494 for (i = 0; i < n
i < nDescription
TRUEevaluated 102 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • libcrypto.so.44.0.1
  • pkcs7test
; i++)
45-102
495 out[i] = ctx->final[i];
executed 102 times by 2 tests: out[i] = ctx->final[i];
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
102
496 *outl = n;-
497 }
executed 45 times by 2 tests: end of block
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
else
45
498 *
executed 54 times by 1 test: *outl = 0;
Executed by:
  • libcrypto.so.44.0.1
outl = 0;
executed 54 times by 1 test: *outl = 0;
Executed by:
  • libcrypto.so.44.0.1
54
499 return
executed 99 times by 2 tests: return (1);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
(1);
executed 99 times by 2 tests: return (1);
Executed by:
  • libcrypto.so.44.0.1
  • pkcs7test
99
500}-
501-
502EVP_CIPHER_CTX *-
503EVP_CIPHER_CTX_new(void)-
504{-
505 return
executed 160 times by 1 test: return calloc(1, sizeof(EVP_CIPHER_CTX));
Executed by:
  • ssltest
calloc(1, sizeof(EVP_CIPHER_CTX));
executed 160 times by 1 test: return calloc(1, sizeof(EVP_CIPHER_CTX));
Executed by:
  • ssltest
160
506}-
507-
508void-
509EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)-
510{-
511 if (ctx ==
ctx == ((void *)0)Description
TRUEevaluated 1432 times by 12 tests
Evaluated by:
  • cipher_list
  • cipherstest
  • clienttest
  • freenull
  • libcrypto.so.44.0.1
  • servertest
  • ssl_versions
  • ssltest
  • tls_ext_alpn
  • tls_prf
  • tlsexttest
  • tlstest
FALSEevaluated 160 times by 1 test
Evaluated by:
  • ssltest
160-1432
512 ((void *)0)
ctx == ((void *)0)Description
TRUEevaluated 1432 times by 12 tests
Evaluated by:
  • cipher_list
  • cipherstest
  • clienttest
  • freenull
  • libcrypto.so.44.0.1
  • servertest
  • ssl_versions
  • ssltest
  • tls_ext_alpn
  • tls_prf
  • tlsexttest
  • tlstest
FALSEevaluated 160 times by 1 test
Evaluated by:
  • ssltest
160-1432
513 )-
514 return;
executed 1432 times by 12 tests: return;
Executed by:
  • cipher_list
  • cipherstest
  • clienttest
  • freenull
  • libcrypto.so.44.0.1
  • servertest
  • ssl_versions
  • ssltest
  • tls_ext_alpn
  • tls_prf
  • tlsexttest
  • tlstest
1432
515-
516 EVP_CIPHER_CTX_cleanup(ctx);-
517-
518 free(ctx);-
519}
executed 160 times by 1 test: end of block
Executed by:
  • ssltest
160
520-
521void-
522EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)-
523{-
524 memset(ctx, 0, sizeof(EVP_CIPHER_CTX));-
525}
executed 454 times by 5 tests: end of block
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
454
526-
527int-
528EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a)-
529{-
530 return
never executed: return EVP_CIPHER_CTX_cleanup(a);
EVP_CIPHER_CTX_cleanup(a);
never executed: return EVP_CIPHER_CTX_cleanup(a);
0
531}-
532-
533int-
534EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c)-
535{-
536 if (c->cipher !=
c->cipher != ((void *)0)Description
TRUEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
0-680
537 ((void *)0)
c->cipher != ((void *)0)Description
TRUEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEnever evaluated
0-680
538 ) {-
539 if (c->cipher->cleanup
c->cipher->cleanupDescription
TRUEnever evaluated
FALSEevaluated 680 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
&& !c->cipher->cleanup(c)
!c->cipher->cleanup(c)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-680
540 return
never executed: return 0;
0;
never executed: return 0;
0
541-
542 if (c->cipher_data
c->cipher_dataDescription
TRUEevaluated 668 times by 5 tests
Evaluated by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
FALSEevaluated 12 times by 1 test
Evaluated by:
  • ssltest
)
12-668
543 explicit_bzero(c->cipher_data, c->cipher->ctx_size);
executed 668 times by 5 tests: explicit_bzero(c->cipher_data, c->cipher->ctx_size);
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
668
544 }
executed 680 times by 5 tests: end of block
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
545 free(c->cipher_data);-
546-
547 ENGINE_finish(c->engine);-
548-
549 explicit_bzero(c, sizeof(EVP_CIPHER_CTX));-
550 return
executed 680 times by 5 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
1;
executed 680 times by 5 tests: return 1;
Executed by:
  • evptest
  • gost2814789t
  • libcrypto.so.44.0.1
  • pkcs7test
  • ssltest
680
551}-
552-
553int-
554EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)-
555{-
556 if (c->cipher->flags & 0x80
c->cipher->flags & 0x80Description
TRUEnever evaluated
FALSEnever evaluated
)
0
557 return
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
EVP_CIPHER_CTX_ctrl(c, 0x1,
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
558 keylen,
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
559 ((void *)0)
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
560 );
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
561 if (c->key_len == keylen
c->key_len == keylenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
562 return
never executed: return 1;
1;
never executed: return 1;
0
563 if ((
(keylen > 0)Description
TRUEnever evaluated
FALSEnever evaluated
keylen > 0)
(keylen > 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(c->cipher->flags & 0x8)Description
TRUEnever evaluated
FALSEnever evaluated
c->cipher->flags & 0x8)
(c->cipher->flags & 0x8)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
564 c->key_len = keylen;-
565 return
never executed: return 1;
1;
never executed: return 1;
0
566 }-
567 ERR_put_error(6,(0xfff),(130),__FILE__,598);-
568 return
never executed: return 0;
0;
never executed: return 0;
0
569}-
570-
571int-
572EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)-
573{-
574 if (pad
padDescription
TRUEnever evaluated
FALSEevaluated 251 times by 1 test
Evaluated by:
  • evptest
)
0-251
575 ctx->flags &= ~0x100;
never executed: ctx->flags &= ~0x100;
0
576 else-
577 ctx->flags |= 0x100;
executed 251 times by 1 test: ctx->flags |= 0x100;
Executed by:
  • evptest
251
578 return
executed 251 times by 1 test: return 1;
Executed by:
  • evptest
1;
executed 251 times by 1 test: return 1;
Executed by:
  • evptest
251
579}-
580-
581int-
582EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)-
583{-
584 int ret;-
585-
586 if (!ctx->cipher
!ctx->cipherDescription
TRUEnever evaluated
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
) {
0-48
587 ERR_put_error(6,(0xfff),(131),__FILE__,618);-
588 return
never executed: return 0;
0;
never executed: return 0;
0
589 }-
590-
591 if (!ctx->cipher->ctrl
!ctx->cipher->ctrlDescription
TRUEnever evaluated
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
) {
0-48
592 ERR_put_error(6,(0xfff),(132),__FILE__,623);-
593 return
never executed: return 0;
0;
never executed: return 0;
0
594 }-
595-
596 ret = ctx->cipher->ctrl(ctx, type, arg, ptr);-
597 if (ret == -1
ret == -1Description
TRUEnever evaluated
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • gost2814789t
  • libcrypto.so.44.0.1
) {
0-48
598 ERR_put_error(6,(0xfff),(133),__FILE__,629);-
599 return
never executed: return 0;
0;
never executed: return 0;
0
600 }-
601 return
executed 48 times by 2 tests: return ret;
Executed by:
  • gost2814789t
  • libcrypto.so.44.0.1
ret;
executed 48 times by 2 tests: return ret;
Executed by:
  • gost2814789t
  • libcrypto.so.44.0.1
48
602}-
603-
604int-
605EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)-
606{-
607 if (ctx->cipher->flags & 0x200
ctx->cipher->flags & 0x200Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • pkcs7test
)
0-2
608 return
never executed: return EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);
EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);
never executed: return EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);
0
609 arc4random_buf(key, ctx->key_len);-
610 return
executed 2 times by 1 test: return 1;
Executed by:
  • pkcs7test
1;
executed 2 times by 1 test: return 1;
Executed by:
  • pkcs7test
2
611}-
612-
613int-
614EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)-
615{-
616 if ((
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
in ==
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
617 ((void *)0)
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
618 )
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
in->cipher ==
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
619 ((void *)0)
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
0
620 )
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
621 ERR_put_error(6,(0xfff),(111),__FILE__,648);-
622 return
never executed: return 0;
0;
never executed: return 0;
0
623 }-
624-
625-
626 if (in->engine
in->engineDescription
TRUEnever evaluated
FALSEnever evaluated
&& !ENGINE_init(in->engine)
!ENGINE_init(in->engine)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
627 ERR_put_error(6,(0xfff),(38),__FILE__,654);-
628 return
never executed: return 0;
0;
never executed: return 0;
0
629 }-
630-
631-
632 EVP_CIPHER_CTX_cleanup(out);-
633 memcpy(out, in, sizeof *out);-
634-
635 if (in->cipher_data
in->cipher_dataDescription
TRUEnever evaluated
FALSEnever evaluated
&& in->cipher->ctx_size
in->cipher->ctx_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
636 out->cipher_data = malloc(in->cipher->ctx_size);-
637 if (!out->cipher_data
!out->cipher_dataDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
638 ERR_put_error(6,(0xfff),((1|64)),__FILE__,665);-
639 return
never executed: return 0;
0;
never executed: return 0;
0
640 }-
641 memcpy(out->cipher_data, in->cipher_data, in->cipher->ctx_size);-
642 }
never executed: end of block
0
643-
644 if (in->cipher->flags & 0x400
in->cipher->flags & 0x400Description
TRUEnever evaluated
FALSEnever evaluated
)
0
645 return
never executed: return in->cipher->ctrl((EVP_CIPHER_CTX *)in, 0x8, 0, out);
in->cipher->ctrl((EVP_CIPHER_CTX *)in,
never executed: return in->cipher->ctrl((EVP_CIPHER_CTX *)in, 0x8, 0, out);
0
646 0x8, 0, out);
never executed: return in->cipher->ctrl((EVP_CIPHER_CTX *)in, 0x8, 0, out);
0
647 return
never executed: return 1;
1;
never executed: return 1;
0
648}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2