OpenCoverage

evp_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/evp_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c)-
4{-
5 if (c ==
c == ((void *)0)Description
TRUEevaluated 8965 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3259726 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
8965-3259726
6 ((void *)0)
c == ((void *)0)Description
TRUEevaluated 8965 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3259726 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
8965-3259726
7 )-
8 return
executed 8965 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 8965 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
8965
9 if (c->cipher !=
c->cipher != ((void *)0)Description
TRUEevaluated 3252687 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 13304 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
13304-3252687
10 ((void *)0)
c->cipher != ((void *)0)Description
TRUEevaluated 3252687 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 13304 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
13304-3252687
11 ) {-
12 if (c->cipher->cleanup
c->cipher->cleanupDescription
TRUEevaluated 14517 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3232397 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& !c->cipher->cleanup(c)
!c->cipher->cleanup(c)Description
TRUEnever evaluated
FALSEevaluated 14517 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-3232397
13 return
never executed: return 0;
0;
never executed: return 0;
0
14-
15 if (c->cipher_data
c->cipher_dataDescription
TRUEevaluated 3247908 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 79 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& c->cipher->ctx_size
c->cipher->ctx_sizeDescription
TRUEevaluated 3256262 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6645 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
79-3256262
16 OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
executed 3253969 times by 2 tests: OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3253969
17 }
executed 3274767 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3274767
18 CRYPTO_free(c->cipher_data, __FILE__, 32);-
19-
20 ENGINE_finish(c->engine);-
21-
22 memset(c, 0, sizeof(*c));-
23 return
executed 3267094 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 3267094 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3267094
24}-
25-
26EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)-
27{-
28 return
executed 78927 times by 2 tests: return CRYPTO_zalloc(sizeof(EVP_CIPHER_CTX), __FILE__, 42);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
CRYPTO_zalloc(sizeof(EVP_CIPHER_CTX), __FILE__, 42);
executed 78927 times by 2 tests: return CRYPTO_zalloc(sizeof(EVP_CIPHER_CTX), __FILE__, 42);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
78927
29}-
30-
31void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)-
32{-
33 EVP_CIPHER_CTX_reset(ctx);-
34 CRYPTO_free(ctx, __FILE__, 48);-
35}
executed 87892 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
87892
36-
37int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
38 const unsigned char *key, const unsigned char *iv, int enc)-
39{-
40 if (cipher !=
cipher != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
41 ((void *)0)
cipher != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
42 )-
43 EVP_CIPHER_CTX_reset(ctx);
never executed: EVP_CIPHER_CTX_reset(ctx);
0
44 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
45 ((void *)0)
never executed: return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc);
0
46 , key, iv, enc);
never executed: return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc);
0
47}-
48-
49int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
50 ENGINE *impl, const unsigned char *key,-
51 const unsigned char *iv, int enc)-
52{-
53 if (enc == -1
enc == -1Description
TRUEevaluated 11850 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3268282 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
11850-3268282
54 enc = ctx->encrypt;
executed 11850 times by 1 test: enc = ctx->encrypt;
Executed by:
  • libcrypto.so.1.1
11850
55 else {-
56 if (enc
encDescription
TRUEevaluated 3212285 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 48724 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
48724-3212285
57 enc = 1;
executed 3207314 times by 2 tests: enc = 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3207314
58 ctx->encrypt = enc;-
59 }
executed 3270978 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3270978
60-
61-
62-
63-
64-
65-
66-
67 if (ctx->engine
ctx->engineDescription
TRUEevaluated 1338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3268681 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
&& ctx->cipher
ctx->cipherDescription
TRUEevaluated 1338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-3268681
68 && (cipher ==
cipher == ((void *)0)Description
TRUEevaluated 1338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1338
69 ((void *)0)
cipher == ((void *)0)Description
TRUEevaluated 1338 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1338
70 || cipher->nid == ctx->cipher->nid
cipher->nid ==...x->cipher->nidDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
71 goto
executed 1338 times by 1 test: goto skip_to_init;
Executed by:
  • libcrypto.so.1.1
skip_to_init;
executed 1338 times by 1 test: goto skip_to_init;
Executed by:
  • libcrypto.so.1.1
1338
72-
73 if (cipher
cipherDescription
TRUEevaluated 3246307 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 44958 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
44958-3246307
74-
75-
76-
77-
78-
79 if (ctx->cipher
ctx->cipherDescription
TRUEevaluated 3174184 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 70747 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
70747-3174184
80 unsigned long flags = ctx->flags;-
81 EVP_CIPHER_CTX_reset(ctx);-
82-
83 ctx->encrypt = enc;-
84 ctx->flags = flags;-
85 }
executed 3149954 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3149954
86-
87 if (impl
implDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3198085 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
6-3198085
88 if (!ENGINE_init(impl)
!ENGINE_init(impl)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-6
89 ERR_put_error(6,(123),(134),__FILE__,97);-
90 return
never executed: return 0;
0;
never executed: return 0;
0
91 }-
92 }
executed 6 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
6
93-
94 impl = ENGINE_get_cipher_engine(cipher->nid);
executed 3210132 times by 2 tests: impl = ENGINE_get_cipher_engine(cipher->nid);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3210132
95 if (impl
implDescription
TRUEevaluated 757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3200483 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
757-3200483
96-
97 const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid);-
98 if (!c
!cDescription
TRUEnever evaluated
FALSEevaluated 757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-757
99-
100-
101-
102-
103-
104 ERR_put_error(6,(123),(134),__FILE__,112);-
105 return
never executed: return 0;
0;
never executed: return 0;
0
106 }-
107-
108 cipher = c;-
109-
110-
111-
112-
113 ctx->engine = impl;-
114 }
executed 757 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
757
115 ctx->engine =
executed 3224519 times by 2 tests: ctx->engine = ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3224519
116 ((void *)0)
executed 3224519 times by 2 tests: ctx->engine = ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3224519
117 ;
executed 3224519 times by 2 tests: ctx->engine = ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3224519
118-
119-
120 ctx->cipher = cipher;-
121 if (ctx->cipher->ctx_size
ctx->cipher->ctx_sizeDescription
TRUEevaluated 3217950 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 6724 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
6724-3217950
122 ctx->cipher_data = CRYPTO_zalloc(ctx->cipher->ctx_size, __FILE__, 128);-
123 if (ctx->cipher_data ==
ctx->cipher_da...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 3198603 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-3198603
124 ((void *)0)
ctx->cipher_da...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 3198603 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
0-3198603
125 ) {-
126 ctx->cipher = -
127 ((void *)0)-
128 ;-
129 ERR_put_error(6,(123),((1|64)),__FILE__,131);-
130 return
never executed: return 0;
0;
never executed: return 0;
0
131 }-
132 }
executed 3185841 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else {
3185841
133 ctx->cipher_data = -
134 ((void *)0)-
135 ;-
136 }
executed 6724 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
6724
137 ctx->key_len = cipher->key_len;-
138-
139 ctx->flags &= 0x1;-
140 if (ctx->cipher->flags & 0x40
ctx->cipher->flags & 0x40Description
TRUEevaluated 15840 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3236914 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
15840-3236914
141 if (!EVP_CIPHER_CTX_ctrl(ctx, 0x0, 0,
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15840 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15840
142 ((void *)0)
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15840 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15840
143 )
!EVP_CIPHER_CT... ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 15840 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-15840
144 ctx->cipher = -
145 ((void *)0)-
146 ;-
147 ERR_put_error(6,(123),(134),__FILE__,143);-
148 return
never executed: return 0;
0;
never executed: return 0;
0
149 }-
150 }
executed 15840 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
15840
151 }
executed 3262368 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
else if (!ctx->cipher
!ctx->cipherDescription
TRUEnever evaluated
FALSEevaluated 44958 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-3262368
152 ERR_put_error(6,(123),(131),__FILE__,148);-
153 return
never executed: return 0;
0;
never executed: return 0;
0
154 }-
155-
156 skip_to_init:
code before this statement executed 3291146 times by 2 tests: skip_to_init:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3291146
157-
158-
159 (void)((ctx->cipher->block_size == 1 || ctx->cipher->block_size == 8 || ctx->cipher->block_size == 16) ? 0 : (OPENSSL_die("assertion failed: " "ctx->cipher->block_size == 1 || ctx->cipher->block_size == 8 || ctx->cipher->block_size == 16",-
160-
161 __FILE__-
162 ,-
163-
164 157-
165 ), 1))-
166-
167 ;-
168-
169 if (!(ctx->flags & 0x1)
!(ctx->flags & 0x1)Description
TRUEevaluated 3270346 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 12378 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
12378-3270346
170 && (
(EVP_CIPHER_fl...07) == 0x10002Description
TRUEnever evaluated
FALSEevaluated 3284593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0xF0007) == 0x10002
(EVP_CIPHER_fl...07) == 0x10002Description
TRUEnever evaluated
FALSEevaluated 3284593 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-3284593
171 ERR_put_error(6,(123),(170),__FILE__,161);-
172 return
never executed: return 0;
0;
never executed: return 0;
0
173 }-
174-
175 if (!(EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0x10)
!(EVP_CIPHER_f...(ctx)) & 0x10)Description
TRUEevaluated 3240148 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 64194 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
64194-3240148
176 switch ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0xF0007)) {-
177-
178 case
executed 391 times by 1 test: case 0x0:
Executed by:
  • libcrypto.so.1.1
0x0:
executed 391 times by 1 test: case 0x0:
Executed by:
  • libcrypto.so.1.1
391
179 case
executed 3214221 times by 2 tests: case 0x1:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
0x1:
executed 3214221 times by 2 tests: case 0x1:
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3214221
180 break;
executed 3204513 times by 2 tests: break;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3204513
181-
182 case
executed 8004 times by 1 test: case 0x3:
Executed by:
  • libcrypto.so.1.1
0x3:
executed 8004 times by 1 test: case 0x3:
Executed by:
  • libcrypto.so.1.1
8004
183 case
executed 7652 times by 1 test: case 0x4:
Executed by:
  • libcrypto.so.1.1
0x4:
executed 7652 times by 1 test: case 0x4:
Executed by:
  • libcrypto.so.1.1
7652
184-
185 ctx->num = 0;-
186-
187-
188 case
executed 12951 times by 1 test: case 0x2:
Executed by:
  • libcrypto.so.1.1
0x2:
executed 12951 times by 1 test: case 0x2:
Executed by:
  • libcrypto.so.1.1
code before this statement executed 15656 times by 1 test: case 0x2:
Executed by:
  • libcrypto.so.1.1
12951-15656
189-
190 (void)((EVP_CIPHER_CTX_iv_length(ctx) <= (int)sizeof(ctx->iv)) ? 0 : (OPENSSL_die("assertion failed: " "EVP_CIPHER_CTX_iv_length(ctx) <= (int)sizeof(ctx->iv)",-
191 __FILE__-
192 ,-
193 181-
194 ), 1))-
195 ;-
196 if (iv
ivDescription
TRUEevaluated 16621 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11986 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
11986-16621
197 memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
executed 16621 times by 1 test: memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
Executed by:
  • libcrypto.so.1.1
16621
198 memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));-
199 break;
executed 28607 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
28607
200-
201 case
executed 6884 times by 1 test: case 0x5:
Executed by:
  • libcrypto.so.1.1
0x5:
executed 6884 times by 1 test: case 0x5:
Executed by:
  • libcrypto.so.1.1
6884
202 ctx->num = 0;-
203-
204 if (iv
ivDescription
TRUEevaluated 3442 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3442 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
3442
205 memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx));
executed 3442 times by 1 test: memcpy(ctx->iv, iv, EVP_CIPHER_CTX_iv_length(ctx));
Executed by:
  • libcrypto.so.1.1
3442
206 break;
executed 6884 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
6884
207-
208 default
never executed: default:
:
never executed: default:
0
209 return
never executed: return 0;
0;
never executed: return 0;
0
210 }-
211 }-
212-
213 if (key
keyDescription
TRUEevaluated 3257506 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 46296 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(ctx->cipher->flags & 0x20)Description
TRUEevaluated 41763 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4533 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
ctx->cipher->flags & 0x20)
(ctx->cipher->flags & 0x20)Description
TRUEevaluated 41763 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4533 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
4533-3257506
214 if (!ctx->cipher->init(ctx, key, iv, enc)
!ctx->cipher->... key, iv, enc)Description
TRUEnever evaluated
FALSEevaluated 3221972 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-3221972
215 return
never executed: return 0;
0;
never executed: return 0;
0
216 }
executed 3223980 times by 2 tests: end of block
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3223980
217 ctx->buf_len = 0;-
218 ctx->final_used = 0;-
219 ctx->block_mask = ctx->cipher->block_size - 1;-
220 return
executed 3201095 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 3201095 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
3201095
221}-
222-
223int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,-
224 const unsigned char *in, int inl)-
225{-
226 if (ctx->encrypt
ctx->encryptDescription
TRUEevaluated 28719072 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 107643 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
107643-28719072
227 return
executed 28549154 times by 2 tests: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
EVP_EncryptUpdate(ctx, out, outl, in, inl);
executed 28549154 times by 2 tests: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
28549154
228 else-
229 return
executed 107643 times by 1 test: return EVP_DecryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.1.1
EVP_DecryptUpdate(ctx, out, outl, in, inl);
executed 107643 times by 1 test: return EVP_DecryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.1.1
107643
230}-
231-
232int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
233{-
234 if (ctx->encrypt
ctx->encryptDescription
TRUEevaluated 34482 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 43062 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
34482-43062
235 return
executed 34482 times by 1 test: return EVP_EncryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.1.1
EVP_EncryptFinal_ex(ctx, out, outl);
executed 34482 times by 1 test: return EVP_EncryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.1.1
34482
236 else-
237 return
executed 43062 times by 1 test: return EVP_DecryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.1.1
EVP_DecryptFinal_ex(ctx, out, outl);
executed 43062 times by 1 test: return EVP_DecryptFinal_ex(ctx, out, outl);
Executed by:
  • libcrypto.so.1.1
43062
238}-
239-
240int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
241{-
242 if (ctx->encrypt
ctx->encryptDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
243 return
never executed: return EVP_EncryptFinal(ctx, out, outl);
EVP_EncryptFinal(ctx, out, outl);
never executed: return EVP_EncryptFinal(ctx, out, outl);
0
244 else-
245 return
never executed: return EVP_DecryptFinal(ctx, out, outl);
EVP_DecryptFinal(ctx, out, outl);
never executed: return EVP_DecryptFinal(ctx, out, outl);
0
246}-
247-
248int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
249 const unsigned char *key, const unsigned char *iv)-
250{-
251 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
252}-
253-
254int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
255 ENGINE *impl, const unsigned char *key,-
256 const unsigned char *iv)-
257{-
258 return
executed 1774 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
Executed by:
  • libcrypto.so.1.1
EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
executed 1774 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
Executed by:
  • libcrypto.so.1.1
1774
259}-
260-
261int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
262 const unsigned char *key, const unsigned char *iv)-
263{-
264 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
265}-
266-
267int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,-
268 ENGINE *impl, const unsigned char *key,-
269 const unsigned char *iv)-
270{-
271 return
executed 223 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
Executed by:
  • libcrypto.so.1.1
EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
executed 223 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
Executed by:
  • libcrypto.so.1.1
223
272}-
273int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)-
274{-
275 size_t diff = (size_t)ptr1-(size_t)ptr2;-
276-
277-
278-
279-
280-
281 int overlapped = (len > 0) & (diff != 0) & ((diff < (size_t)len) |-
282 (diff > (0 - (size_t)len)));-
283-
284 return
executed 30073570 times by 2 tests: return overlapped;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
overlapped;
executed 30073570 times by 2 tests: return overlapped;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
30073570
285}-
286-
287int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,-
288 const unsigned char *in, int inl)-
289{-
290 int i, j, bl, cmpl = inl;-
291-
292 if (EVP_CIPHER_CTX_test_flags(ctx, 0x2000)
EVP_CIPHER_CTX...s(ctx, 0x2000)Description
TRUEnever evaluated
FALSEevaluated 28299335 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
)
0-28299335
293 cmpl = (cmpl + 7) / 8;
never executed: cmpl = (cmpl + 7) / 8;
0
294-
295 bl = ctx->cipher->block_size;-
296-
297 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEevaluated 36373 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 29385530 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
36373-29385530
298-
299 if (bl == 1
bl == 1Description
TRUEevaluated 35423 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 950 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& is_partially_overlapping(out, in, cmpl)
is_partially_o...out, in, cmpl)Description
TRUEnever evaluated
FALSEevaluated 35423 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-35423
300 ERR_put_error(6,(167),(162),__FILE__,310);-
301 return
never executed: return 0;
0;
never executed: return 0;
0
302 }-
303-
304 i = ctx->cipher->do_cipher(ctx, out, in, inl);-
305 if (i < 0
i < 0Description
TRUEnever evaluated
FALSEevaluated 36373 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-36373
306 return
never executed: return 0;
0;
never executed: return 0;
0
307 else-
308 *
executed 36373 times by 1 test: *outl = i;
Executed by:
  • libcrypto.so.1.1
outl = i;
executed 36373 times by 1 test: *outl = i;
Executed by:
  • libcrypto.so.1.1
36373
309 return
executed 36373 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 36373 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
36373
310 }-
311-
312 if (inl <= 0
inl <= 0Description
TRUEnever evaluated
FALSEevaluated 30027432 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-30027432
313 *outl = 0;-
314 return
never executed: return inl == 0;
inl == 0;
never executed: return inl == 0;
0
315 }-
316 if (is_partially_overlapping(out + ctx->buf_len, in, cmpl)
is_partially_o...len, in, cmpl)Description
TRUEnever evaluated
FALSEevaluated 30006938 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
) {
0-30006938
317 ERR_put_error(6,(167),(162),__FILE__,327);-
318 return
never executed: return 0;
0;
never executed: return 0;
0
319 }-
320-
321 if (ctx->buf_len == 0
ctx->buf_len == 0Description
TRUEevaluated 28971308 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 12738 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& (
(inl & (ctx->block_mask)) == 0Description
TRUEevaluated 29413053 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 7007 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
inl & (ctx->block_mask)) == 0
(inl & (ctx->block_mask)) == 0Description
TRUEevaluated 29413053 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 7007 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
7007-29413053
322 if (ctx->cipher->do_cipher(ctx, out, in, inl)
ctx->cipher->d... out, in, inl)Description
TRUEevaluated 28321037 times by 2 tests
Evaluated by:
  • libcrypto.so.1.1
  • sm2_internal_test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-28321037
323 *outl = inl;-
324 return
executed 28209791 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
1;
executed 28209791 times by 2 tests: return 1;
Executed by:
  • libcrypto.so.1.1
  • sm2_internal_test
28209791
325 } else {-
326 *outl = 0;-
327 return
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1
328 }-
329 }-
330 i = ctx->buf_len;-
331 (void)((bl <= (int)sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "bl <= (int)sizeof(ctx->buf)", __FILE__, 341), 1));-
332 if (i != 0
i != 0Description
TRUEevaluated 12738 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 7007 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
7007-12738
333 if (bl - i > inl
bl - i > inlDescription
TRUEevaluated 898 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 11840 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
898-11840
334 memcpy(&(ctx->buf[i]), in, inl);-
335 ctx->buf_len += inl;-
336 *outl = 0;-
337 return
executed 898 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 898 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
898
338 } else {-
339 j = bl - i;-
340 memcpy(&(ctx->buf[i]), in, j);-
341 inl -= j;-
342 in += j;-
343 if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl)
!ctx->cipher->... ctx->buf, bl)Description
TRUEnever evaluated
FALSEevaluated 11840 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-11840
344 return
never executed: return 0;
0;
never executed: return 0;
0
345 out += bl;-
346 *outl = bl;-
347 }
executed 11840 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
11840
348 } else-
349 *
executed 7007 times by 1 test: *outl = 0;
Executed by:
  • libcrypto.so.1.1
outl = 0;
executed 7007 times by 1 test: *outl = 0;
Executed by:
  • libcrypto.so.1.1
7007
350 i = inl & (bl - 1);-
351 inl -= i;-
352 if (inl > 0
inl > 0Description
TRUEevaluated 16691 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2156 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2156-16691
353 if (!ctx->cipher->do_cipher(ctx, out, in, inl)
!ctx->cipher->... out, in, inl)Description
TRUEnever evaluated
FALSEevaluated 16691 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-16691
354 return
never executed: return 0;
0;
never executed: return 0;
0
355 *outl += inl;-
356 }
executed 16691 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
16691
357-
358 if (i != 0
i != 0Description
TRUEevaluated 13675 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5172 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
5172-13675
359 memcpy(ctx->buf, &(in[inl]), i);
executed 13675 times by 1 test: memcpy(ctx->buf, &(in[inl]), i);
Executed by:
  • libcrypto.so.1.1
13675
360 ctx->buf_len = i;-
361 return
executed 18847 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 18847 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
18847
362}-
363-
364int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
365{-
366 int ret;-
367 ret = EVP_EncryptFinal_ex(ctx, out, outl);-
368 return
executed 1750 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 1750 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1750
369}-
370-
371int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
372{-
373 int n, ret;-
374 unsigned int i, b, bl;-
375-
376 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEevaluated 16244 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 19989 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
16244-19989
377 ret = ctx->cipher->do_cipher(ctx, out, -
378 ((void *)0)-
379 , 0);-
380 if (ret < 0
ret < 0Description
TRUEnever evaluated
FALSEevaluated 16244 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-16244
381 return
never executed: return 0;
0;
never executed: return 0;
0
382 else-
383 *
executed 16244 times by 1 test: *outl = ret;
Executed by:
  • libcrypto.so.1.1
outl = ret;
executed 16244 times by 1 test: *outl = ret;
Executed by:
  • libcrypto.so.1.1
16244
384 return
executed 16244 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 16244 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
16244
385 }-
386-
387 b = ctx->cipher->block_size;-
388 (void)((b <= sizeof(ctx->buf)) ? 0 : (OPENSSL_die("assertion failed: " "b <= sizeof(ctx->buf)", __FILE__, 396), 1));-
389 if (b == 1
b == 1Description
TRUEevaluated 13935 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 6054 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
6054-13935
390 *outl = 0;-
391 return
executed 13935 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 13935 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
13935
392 }-
393 bl = ctx->buf_len;-
394 if (ctx->flags & 0x100
ctx->flags & 0x100Description
TRUEevaluated 996 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5058 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
996-5058
395 if (bl
blDescription
TRUEnever evaluated
FALSEevaluated 996 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-996
396 ERR_put_error(6,(127),(138),__FILE__,405)-
397 ;-
398 return
never executed: return 0;
0;
never executed: return 0;
0
399 }-
400 *outl = 0;-
401 return
executed 996 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 996 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
996
402 }-
403-
404 n = b - bl;-
405 for (i = bl; i < b
i < bDescription
TRUEevaluated 62228 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5058 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
5058-62228
406 ctx->buf[i] = n;
executed 62228 times by 1 test: ctx->buf[i] = n;
Executed by:
  • libcrypto.so.1.1
62228
407 ret = ctx->cipher->do_cipher(ctx, out, ctx->buf, b);-
408-
409 if (ret
retDescription
TRUEevaluated 5058 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
)
0-5058
410 *
executed 5058 times by 1 test: *outl = b;
Executed by:
  • libcrypto.so.1.1
outl = b;
executed 5058 times by 1 test: *outl = b;
Executed by:
  • libcrypto.so.1.1
5058
411-
412 return
executed 5058 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 5058 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
5058
413}-
414-
415int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,-
416 const unsigned char *in, int inl)-
417{-
418 int fix_len, cmpl = inl;-
419 unsigned int b;-
420-
421 b = ctx->cipher->block_size;-
422-
423 if (EVP_CIPHER_CTX_test_flags(ctx, 0x2000)
EVP_CIPHER_CTX...s(ctx, 0x2000)Description
TRUEnever evaluated
FALSEevaluated 107860 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-107860
424 cmpl = (cmpl + 7) / 8;
never executed: cmpl = (cmpl + 7) / 8;
0
425-
426 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEevaluated 54303 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 53557 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
53557-54303
427 if (b == 1
b == 1Description
TRUEevaluated 53352 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 951 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& is_partially_overlapping(out, in, cmpl)
is_partially_o...out, in, cmpl)Description
TRUEnever evaluated
FALSEevaluated 53352 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-53352
428 ERR_put_error(6,(166),(162),__FILE__,436);-
429 return
never executed: return 0;
0;
never executed: return 0;
0
430 }-
431-
432 fix_len = ctx->cipher->do_cipher(ctx, out, in, inl);-
433 if (fix_len < 0
fix_len < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 54301 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-54301
434 *outl = 0;-
435 return
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
2
436 } else-
437 *
executed 54301 times by 1 test: *outl = fix_len;
Executed by:
  • libcrypto.so.1.1
outl = fix_len;
executed 54301 times by 1 test: *outl = fix_len;
Executed by:
  • libcrypto.so.1.1
54301
438 return
executed 54301 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 54301 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
54301
439 }-
440-
441 if (inl <= 0
inl <= 0Description
TRUEnever evaluated
FALSEevaluated 53557 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-53557
442 *outl = 0;-
443 return
never executed: return inl == 0;
inl == 0;
never executed: return inl == 0;
0
444 }-
445-
446 if (ctx->flags & 0x100
ctx->flags & 0x100Description
TRUEevaluated 4032 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 49525 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
4032-49525
447 return
executed 4032 times by 1 test: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.1.1
EVP_EncryptUpdate(ctx, out, outl, in, inl);
executed 4032 times by 1 test: return EVP_EncryptUpdate(ctx, out, outl, in, inl);
Executed by:
  • libcrypto.so.1.1
4032
448-
449 (void)((b <= sizeof(ctx->final)) ? 0 : (OPENSSL_die("assertion failed: " "b <= sizeof(ctx->final)", __FILE__, 457), 1));-
450-
451 if (ctx->final_used
ctx->final_usedDescription
TRUEevaluated 2900 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 46625 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2900-46625
452-
453 if (((
((size_t)out == (size_t)in)Description
TRUEnever evaluated
FALSEevaluated 2900 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
size_t)out == (size_t)in)
((size_t)out == (size_t)in)Description
TRUEnever evaluated
FALSEevaluated 2900 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2900
454 || is_partially_overlapping(out, in, b)
is_partially_o...ng(out, in, b)Description
TRUEnever evaluated
FALSEevaluated 2900 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2900
455 ERR_put_error(6,(166),(162),__FILE__,463);-
456 return
never executed: return 0;
0;
never executed: return 0;
0
457 }-
458 memcpy(out, ctx->final, b);-
459 out += b;-
460 fix_len = 1;-
461 }
executed 2900 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
2900
462 fix_len = 0;
executed 46625 times by 1 test: fix_len = 0;
Executed by:
  • libcrypto.so.1.1
46625
463-
464 if (!EVP_EncryptUpdate(ctx, out, outl, in, inl)
!EVP_EncryptUp...outl, in, inl)Description
TRUEnever evaluated
FALSEevaluated 49525 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-49525
465 return
never executed: return 0;
0;
never executed: return 0;
0
466-
467-
468-
469-
470-
471 if (b > 1
b > 1Description
TRUEevaluated 11630 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 37895 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !ctx->buf_len
!ctx->buf_lenDescription
TRUEevaluated 6422 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5208 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
5208-37895
472 *outl -= b;-
473 ctx->final_used = 1;-
474 memcpy(ctx->final, &out[*outl], b);-
475 }
executed 6422 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
6422
476 ctx->final_used = 0;
executed 43103 times by 1 test: ctx->final_used = 0;
Executed by:
  • libcrypto.so.1.1
43103
477-
478 if (fix_len
fix_lenDescription
TRUEevaluated 2900 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 46625 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2900-46625
479 *
executed 2900 times by 1 test: *outl += b;
Executed by:
  • libcrypto.so.1.1
outl += b;
executed 2900 times by 1 test: *outl += b;
Executed by:
  • libcrypto.so.1.1
2900
480-
481 return
executed 49525 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 49525 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
49525
482}-
483-
484int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
485{-
486 int ret;-
487 ret = EVP_DecryptFinal_ex(ctx, out, outl);-
488 return
executed 213 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 213 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
213
489}-
490-
491int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)-
492{-
493 int i, n;-
494 unsigned int b;-
495 *outl = 0;-
496-
497 if (ctx->cipher->flags & 0x100000
ctx->cipher->flags & 0x100000Description
TRUEevaluated 25210 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18069 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
18069-25210
498 i = ctx->cipher->do_cipher(ctx, out, -
499 ((void *)0)-
500 , 0);-
501 if (i < 0
i < 0Description
TRUEevaluated 10601 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14609 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
10601-14609
502 return
executed 10601 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 10601 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
10601
503 else-
504 *
executed 14609 times by 1 test: *outl = i;
Executed by:
  • libcrypto.so.1.1
outl = i;
executed 14609 times by 1 test: *outl = i;
Executed by:
  • libcrypto.so.1.1
14609
505 return
executed 14609 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 14609 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
14609
506 }-
507-
508 b = ctx->cipher->block_size;-
509 if (ctx->flags & 0x100
ctx->flags & 0x100Description
TRUEevaluated 2112 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 15957 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2112-15957
510 if (ctx->buf_len
ctx->buf_lenDescription
TRUEnever evaluated
FALSEevaluated 2112 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2112
511 ERR_put_error(6,(101),(138),__FILE__,518)-
512 ;-
513 return
never executed: return 0;
0;
never executed: return 0;
0
514 }-
515 *outl = 0;-
516 return
executed 2112 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 2112 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2112
517 }-
518 if (b > 1
b > 1Description
TRUEevaluated 3526 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 12431 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
3526-12431
519 if (ctx->buf_len
ctx->buf_lenDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3524 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| !ctx->final_used
!ctx->final_usedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3522 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-3524
520 ERR_put_error(6,(101),(109),__FILE__,526);-
521 return
executed 4 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 4 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
4
522 }-
523 (void)((b <= sizeof(ctx->final)) ? 0 : (OPENSSL_die("assertion failed: " "b <= sizeof(ctx->final)", __FILE__, 529), 1));-
524-
525-
526-
527-
528-
529 n = ctx->final[b - 1];-
530 if (n == 0
n == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3521 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| n > (int)b
n > (int)bDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3519 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
1-3521
531 ERR_put_error(6,(101),(100),__FILE__,537);-
532 return
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 3 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
3
533 }-
534 for (i = 0; i < n
i < nDescription
TRUEevaluated 52177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3515 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++) {
3515-52177
535 if (ctx->final[--b] != n
ctx->final[--b] != nDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 52173 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
4-52173
536 ERR_put_error(6,(101),(100),__FILE__,542);-
537 return
executed 4 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 4 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
4
538 }-
539 }
executed 52173 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
52173
540 n = ctx->cipher->block_size - n;-
541 for (i = 0; i < n
i < nDescription
TRUEevaluated 3302 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3515 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; i++)
3302-3515
542 out[i] = ctx->final[i];
executed 3302 times by 1 test: out[i] = ctx->final[i];
Executed by:
  • libcrypto.so.1.1
3302
543 *outl = n;-
544 }
executed 3515 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
else
3515
545 *
executed 12431 times by 1 test: *outl = 0;
Executed by:
  • libcrypto.so.1.1
outl = 0;
executed 12431 times by 1 test: *outl = 0;
Executed by:
  • libcrypto.so.1.1
12431
546 return
executed 15946 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 15946 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
15946
547}-
548-
549int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen)-
550{-
551 if (c->cipher->flags & 0x80
c->cipher->flags & 0x80Description
TRUEnever evaluated
FALSEevaluated 6185 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-6185
552 return
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
EVP_CIPHER_CTX_ctrl(c, 0x1, keylen,
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
553 ((void *)0)
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
554 );
never executed: return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) );
0
555 if (c->key_len == keylen
c->key_len == keylenDescription
TRUEevaluated 6183 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
2-6183
556 return
executed 6183 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 6183 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
6183
557 if ((
(keylen > 0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
keylen > 0)
(keylen > 0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& (
(c->cipher->flags & 0x8)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
c->cipher->flags & 0x8)
(c->cipher->flags & 0x8)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-2
558 c->key_len = keylen;-
559 return
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 2 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2
560 }-
561 ERR_put_error(6,(122),(130),__FILE__,565);-
562 return
never executed: return 0;
0;
never executed: return 0;
0
563}-
564-
565int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)-
566{-
567 if (pad
padDescription
TRUEnever evaluated
FALSEevaluated 6176 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-6176
568 ctx->flags &= ~0x100;
never executed: ctx->flags &= ~0x100;
0
569 else-
570 ctx->flags |= 0x100;
executed 6176 times by 1 test: ctx->flags |= 0x100;
Executed by:
  • libcrypto.so.1.1
6176
571 return
executed 6176 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 6176 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
6176
572}-
573-
574int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)-
575{-
576 int ret;-
577-
578 if (!ctx->cipher
!ctx->cipherDescription
TRUEnever evaluated
FALSEevaluated 72983 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-72983
579 ERR_put_error(6,(124),(131),__FILE__,583);-
580 return
never executed: return 0;
0;
never executed: return 0;
0
581 }-
582-
583 if (!ctx->cipher->ctrl
!ctx->cipher->ctrlDescription
TRUEnever evaluated
FALSEevaluated 72983 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-72983
584 ERR_put_error(6,(124),(132),__FILE__,588);-
585 return
never executed: return 0;
0;
never executed: return 0;
0
586 }-
587-
588 ret = ctx->cipher->ctrl(ctx, type, arg, ptr);-
589 if (ret == -1
ret == -1Description
TRUEnever evaluated
FALSEevaluated 72983 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-72983
590 ERR_put_error(6,(124),(133),__FILE__,595)-
591 ;-
592 return
never executed: return 0;
0;
never executed: return 0;
0
593 }-
594 return
executed 72983 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
ret;
executed 72983 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
72983
595}-
596-
597int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)-
598{-
599 if (ctx->cipher->flags & 0x200
ctx->cipher->flags & 0x200Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
22-31
600 return
executed 31 times by 1 test: return EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);
Executed by:
  • libcrypto.so.1.1
EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);
executed 31 times by 1 test: return EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);
Executed by:
  • libcrypto.so.1.1
31
601 if (RAND_priv_bytes(key, ctx->key_len) <= 0
RAND_priv_byte...>key_len) <= 0Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-22
602 return
never executed: return 0;
0;
never executed: return 0;
0
603 return
executed 22 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 22 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
22
604}-
605-
606int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in)-
607{-
608 if ((
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
in ==
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
609 ((void *)0)
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
610 )
(in == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
|| (
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
in->cipher ==
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
611 ((void *)0)
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
612 )
(in->cipher == ((void *)0) )Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-8
613 ERR_put_error(6,(163),(111),__FILE__,613);-
614 return
never executed: return 0;
0;
never executed: return 0;
0
615 }-
616-
617-
618 if (in->engine
in->engineDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
&& !ENGINE_init(in->engine)
!ENGINE_init(in->engine)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-8
619 ERR_put_error(6,(163),(38),__FILE__,619);-
620 return
never executed: return 0;
0;
never executed: return 0;
0
621 }-
622-
623-
624 EVP_CIPHER_CTX_reset(out);-
625 memcpy(out, in, sizeof(*out));-
626-
627 if (in->cipher_data
in->cipher_dataDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& in->cipher->ctx_size
in->cipher->ctx_sizeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-8
628 out->cipher_data = CRYPTO_malloc(in->cipher->ctx_size, __FILE__, 628);-
629 if (out->cipher_data ==
out->cipher_da...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
630 ((void *)0)
out->cipher_da...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
631 ) {-
632 out->cipher = -
633 ((void *)0)-
634 ;-
635 ERR_put_error(6,(163),((1|64)),__FILE__,631);-
636 return
never executed: return 0;
0;
never executed: return 0;
0
637 }-
638 memcpy(out->cipher_data, in->cipher_data, in->cipher->ctx_size);-
639 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
640-
641 if (in->cipher->flags & 0x400
in->cipher->flags & 0x400Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-8
642 if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, 0x8, 0, out)
!in->cipher->c..., 0x8, 0, out)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
643 out->cipher = -
644 ((void *)0)-
645 ;-
646 ERR_put_error(6,(163),(134),__FILE__,640);-
647 return
never executed: return 0;
0;
never executed: return 0;
0
648 }-
649 return
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
8
650}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2