Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/evp_enc.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c) | - | ||||||||||||||||||||||||
4 | { | - | ||||||||||||||||||||||||
5 | if (c ==
| 8965-3259726 | ||||||||||||||||||||||||
6 | ((void *)0)
| 8965-3259726 | ||||||||||||||||||||||||
7 | ) | - | ||||||||||||||||||||||||
8 | return executed 8965 times by 1 test: 1;return 1; Executed by:
executed 8965 times by 1 test: return 1; Executed by:
| 8965 | ||||||||||||||||||||||||
9 | if (c->cipher !=
| 13304-3252687 | ||||||||||||||||||||||||
10 | ((void *)0)
| 13304-3252687 | ||||||||||||||||||||||||
11 | ) { | - | ||||||||||||||||||||||||
12 | if (c->cipher->cleanup
| 0-3232397 | ||||||||||||||||||||||||
13 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | if (c->cipher_data
| 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:
| 3253969 | ||||||||||||||||||||||||
17 | } executed 3274767 times by 2 tests: end of block Executed by:
| 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: 1;return 1; Executed by:
executed 3267094 times by 2 tests: return 1; Executed by:
| 3267094 | ||||||||||||||||||||||||
24 | } | - | ||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||
26 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) | - | ||||||||||||||||||||||||
27 | { | - | ||||||||||||||||||||||||
28 | return executed 78927 times by 2 tests: CRYPTO_zalloc(sizeof(EVP_CIPHER_CTX), __FILE__, 42);return CRYPTO_zalloc(sizeof(EVP_CIPHER_CTX), __FILE__, 42); Executed by:
executed 78927 times by 2 tests: return CRYPTO_zalloc(sizeof(EVP_CIPHER_CTX), __FILE__, 42); Executed by:
| 78927 | ||||||||||||||||||||||||
29 | } | - | ||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||
31 | void 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:
| 87892 | ||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||
37 | int 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 !=
| 0 | ||||||||||||||||||||||||
41 | ((void *)0)
| 0 | ||||||||||||||||||||||||
42 | ) | - | ||||||||||||||||||||||||
43 | EVP_CIPHER_CTX_reset(ctx); never executed: EVP_CIPHER_CTX_reset(ctx); | 0 | ||||||||||||||||||||||||
44 | return never executed: EVP_CipherInit_ex(ctx, cipher, return EVP_CipherInit_ex(ctx, cipher, ((void *)0) , key, iv, enc); 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 | - | |||||||||||||||||||||||||
49 | int 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
| 11850-3268282 | ||||||||||||||||||||||||
54 | enc = ctx->encrypt; executed 11850 times by 1 test: enc = ctx->encrypt; Executed by:
| 11850 | ||||||||||||||||||||||||
55 | else { | - | ||||||||||||||||||||||||
56 | if (enc
| 48724-3212285 | ||||||||||||||||||||||||
57 | enc = 1; executed 3207314 times by 2 tests: enc = 1; Executed by:
| 3207314 | ||||||||||||||||||||||||
58 | ctx->encrypt = enc; | - | ||||||||||||||||||||||||
59 | } executed 3270978 times by 2 tests: end of block Executed by:
| 3270978 | ||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | if (ctx->engine
| 0-3268681 | ||||||||||||||||||||||||
68 | && (cipher ==
| 0-1338 | ||||||||||||||||||||||||
69 | ((void *)0)
| 0-1338 | ||||||||||||||||||||||||
70 | || cipher->nid == ctx->cipher->nid
| 0 | ||||||||||||||||||||||||
71 | goto executed 1338 times by 1 test: skip_to_init;goto skip_to_init; Executed by:
executed 1338 times by 1 test: goto skip_to_init; Executed by:
| 1338 | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | if (cipher
| 44958-3246307 | ||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||
79 | if (ctx->cipher
| 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:
| 3149954 | ||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | if (impl
| 6-3198085 | ||||||||||||||||||||||||
88 | if (!ENGINE_init(impl)
| 0-6 | ||||||||||||||||||||||||
89 | ERR_put_error(6,(123),(134),__FILE__,97); | - | ||||||||||||||||||||||||
90 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
91 | } | - | ||||||||||||||||||||||||
92 | } executed 6 times by 1 test: elseend of block Executed by:
| 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:
| 3210132 | ||||||||||||||||||||||||
95 | if (impl
| 757-3200483 | ||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||
97 | const EVP_CIPHER *c = ENGINE_get_cipher(impl, cipher->nid); | - | ||||||||||||||||||||||||
98 | if (!c
| 0-757 | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||
104 | ERR_put_error(6,(123),(134),__FILE__,112); | - | ||||||||||||||||||||||||
105 | return never executed: 0;return 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: elseend of block Executed by:
| 757 | ||||||||||||||||||||||||
115 | ctx->engine = executed 3224519 times by 2 tests: ctx->engine = ((void *)0) ; Executed by:
| 3224519 | ||||||||||||||||||||||||
116 | ((void *)0) executed 3224519 times by 2 tests: ctx->engine = ((void *)0) ; Executed by:
| 3224519 | ||||||||||||||||||||||||
117 | ; executed 3224519 times by 2 tests: ctx->engine = ((void *)0) ; Executed by:
| 3224519 | ||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||
120 | ctx->cipher = cipher; | - | ||||||||||||||||||||||||
121 | if (ctx->cipher->ctx_size
| 6724-3217950 | ||||||||||||||||||||||||
122 | ctx->cipher_data = CRYPTO_zalloc(ctx->cipher->ctx_size, __FILE__, 128); | - | ||||||||||||||||||||||||
123 | if (ctx->cipher_data ==
| 0-3198603 | ||||||||||||||||||||||||
124 | ((void *)0)
| 0-3198603 | ||||||||||||||||||||||||
125 | ) { | - | ||||||||||||||||||||||||
126 | ctx->cipher = | - | ||||||||||||||||||||||||
127 | ((void *)0) | - | ||||||||||||||||||||||||
128 | ; | - | ||||||||||||||||||||||||
129 | ERR_put_error(6,(123),((1|64)),__FILE__,131); | - | ||||||||||||||||||||||||
130 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
131 | } | - | ||||||||||||||||||||||||
132 | } executed 3185841 times by 2 tests: else {end of block Executed by:
| 3185841 | ||||||||||||||||||||||||
133 | ctx->cipher_data = | - | ||||||||||||||||||||||||
134 | ((void *)0) | - | ||||||||||||||||||||||||
135 | ; | - | ||||||||||||||||||||||||
136 | } executed 6724 times by 1 test: end of block Executed by:
| 6724 | ||||||||||||||||||||||||
137 | ctx->key_len = cipher->key_len; | - | ||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||
139 | ctx->flags &= 0x1; | - | ||||||||||||||||||||||||
140 | if (ctx->cipher->flags & 0x40
| 15840-3236914 | ||||||||||||||||||||||||
141 | if (!EVP_CIPHER_CTX_ctrl(ctx, 0x0, 0,
| 0-15840 | ||||||||||||||||||||||||
142 | ((void *)0)
| 0-15840 | ||||||||||||||||||||||||
143 | )
| 0-15840 | ||||||||||||||||||||||||
144 | ctx->cipher = | - | ||||||||||||||||||||||||
145 | ((void *)0) | - | ||||||||||||||||||||||||
146 | ; | - | ||||||||||||||||||||||||
147 | ERR_put_error(6,(123),(134),__FILE__,143); | - | ||||||||||||||||||||||||
148 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
149 | } | - | ||||||||||||||||||||||||
150 | } executed 15840 times by 1 test: end of block Executed by:
| 15840 | ||||||||||||||||||||||||
151 | } executed 3262368 times by 2 tests: else if (!ctx->cipherend of block Executed by:
| 0-3262368 | ||||||||||||||||||||||||
152 | ERR_put_error(6,(123),(131),__FILE__,148); | - | ||||||||||||||||||||||||
153 | return never executed: 0;return 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:
| 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)
| 12378-3270346 | ||||||||||||||||||||||||
170 | && (
| 0-3284593 | ||||||||||||||||||||||||
171 | ERR_put_error(6,(123),(170),__FILE__,161); | - | ||||||||||||||||||||||||
172 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
173 | } | - | ||||||||||||||||||||||||
174 | - | |||||||||||||||||||||||||
175 | if (!(EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0x10)
| 64194-3240148 | ||||||||||||||||||||||||
176 | switch ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0xF0007)) { | - | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | case executed 391 times by 1 test: 0x0:case 0x0: Executed by:
executed 391 times by 1 test: case 0x0: Executed by:
| 391 | ||||||||||||||||||||||||
179 | case executed 3214221 times by 2 tests: 0x1:case 0x1: Executed by:
executed 3214221 times by 2 tests: case 0x1: Executed by:
| 3214221 | ||||||||||||||||||||||||
180 | break; executed 3204513 times by 2 tests: break; Executed by:
| 3204513 | ||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||
182 | case executed 8004 times by 1 test: 0x3:case 0x3: Executed by:
executed 8004 times by 1 test: case 0x3: Executed by:
| 8004 | ||||||||||||||||||||||||
183 | case executed 7652 times by 1 test: 0x4:case 0x4: Executed by:
executed 7652 times by 1 test: case 0x4: Executed by:
| 7652 | ||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||
185 | ctx->num = 0; | - | ||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||
188 | case executed 12951 times by 1 test: 0x2:case 0x2: Executed by:
executed 12951 times by 1 test: case 0x2: Executed by:
code before this statement executed 15656 times by 1 test: case 0x2: Executed by:
| 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
| 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:
| 16621 | ||||||||||||||||||||||||
198 | memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx)); | - | ||||||||||||||||||||||||
199 | break; executed 28607 times by 1 test: break; Executed by:
| 28607 | ||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||
201 | case executed 6884 times by 1 test: 0x5:case 0x5: Executed by:
executed 6884 times by 1 test: case 0x5: Executed by:
| 6884 | ||||||||||||||||||||||||
202 | ctx->num = 0; | - | ||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | if (iv
| 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:
| 3442 | ||||||||||||||||||||||||
206 | break; executed 6884 times by 1 test: break; Executed by:
| 6884 | ||||||||||||||||||||||||
207 | - | |||||||||||||||||||||||||
208 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
209 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
210 | } | - | ||||||||||||||||||||||||
211 | } | - | ||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||
213 | if (key
| 4533-3257506 | ||||||||||||||||||||||||
214 | if (!ctx->cipher->init(ctx, key, iv, enc)
| 0-3221972 | ||||||||||||||||||||||||
215 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
216 | } executed 3223980 times by 2 tests: end of block Executed by:
| 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: 1;return 1; Executed by:
executed 3201095 times by 2 tests: return 1; Executed by:
| 3201095 | ||||||||||||||||||||||||
221 | } | - | ||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||
223 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, | - | ||||||||||||||||||||||||
224 | const unsigned char *in, int inl) | - | ||||||||||||||||||||||||
225 | { | - | ||||||||||||||||||||||||
226 | if (ctx->encrypt
| 107643-28719072 | ||||||||||||||||||||||||
227 | return executed 28549154 times by 2 tests: EVP_EncryptUpdate(ctx, out, outl, in, inl);return EVP_EncryptUpdate(ctx, out, outl, in, inl); Executed by:
executed 28549154 times by 2 tests: return EVP_EncryptUpdate(ctx, out, outl, in, inl); Executed by:
| 28549154 | ||||||||||||||||||||||||
228 | else | - | ||||||||||||||||||||||||
229 | return executed 107643 times by 1 test: EVP_DecryptUpdate(ctx, out, outl, in, inl);return EVP_DecryptUpdate(ctx, out, outl, in, inl); Executed by:
executed 107643 times by 1 test: return EVP_DecryptUpdate(ctx, out, outl, in, inl); Executed by:
| 107643 | ||||||||||||||||||||||||
230 | } | - | ||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||
232 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | - | ||||||||||||||||||||||||
233 | { | - | ||||||||||||||||||||||||
234 | if (ctx->encrypt
| 34482-43062 | ||||||||||||||||||||||||
235 | return executed 34482 times by 1 test: EVP_EncryptFinal_ex(ctx, out, outl);return EVP_EncryptFinal_ex(ctx, out, outl); Executed by:
executed 34482 times by 1 test: return EVP_EncryptFinal_ex(ctx, out, outl); Executed by:
| 34482 | ||||||||||||||||||||||||
236 | else | - | ||||||||||||||||||||||||
237 | return executed 43062 times by 1 test: EVP_DecryptFinal_ex(ctx, out, outl);return EVP_DecryptFinal_ex(ctx, out, outl); Executed by:
executed 43062 times by 1 test: return EVP_DecryptFinal_ex(ctx, out, outl); Executed by:
| 43062 | ||||||||||||||||||||||||
238 | } | - | ||||||||||||||||||||||||
239 | - | |||||||||||||||||||||||||
240 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | - | ||||||||||||||||||||||||
241 | { | - | ||||||||||||||||||||||||
242 | if (ctx->encrypt
| 0 | ||||||||||||||||||||||||
243 | return never executed: EVP_EncryptFinal(ctx, out, outl);return EVP_EncryptFinal(ctx, out, outl); never executed: return EVP_EncryptFinal(ctx, out, outl); | 0 | ||||||||||||||||||||||||
244 | else | - | ||||||||||||||||||||||||
245 | return never executed: EVP_DecryptFinal(ctx, out, outl);return EVP_DecryptFinal(ctx, out, outl); never executed: return EVP_DecryptFinal(ctx, out, outl); | 0 | ||||||||||||||||||||||||
246 | } | - | ||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||
248 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | - | ||||||||||||||||||||||||
249 | const unsigned char *key, const unsigned char *iv) | - | ||||||||||||||||||||||||
250 | { | - | ||||||||||||||||||||||||
251 | return never executed: EVP_CipherInit(ctx, cipher, key, iv, 1);return EVP_CipherInit(ctx, cipher, key, iv, 1); never executed: return EVP_CipherInit(ctx, cipher, key, iv, 1); | 0 | ||||||||||||||||||||||||
252 | } | - | ||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | int 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: EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1); Executed by:
executed 1774 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1); Executed by:
| 1774 | ||||||||||||||||||||||||
259 | } | - | ||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | - | ||||||||||||||||||||||||
262 | const unsigned char *key, const unsigned char *iv) | - | ||||||||||||||||||||||||
263 | { | - | ||||||||||||||||||||||||
264 | return never executed: EVP_CipherInit(ctx, cipher, key, iv, 0);return EVP_CipherInit(ctx, cipher, key, iv, 0); never executed: return EVP_CipherInit(ctx, cipher, key, iv, 0); | 0 | ||||||||||||||||||||||||
265 | } | - | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | int 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: EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0); Executed by:
executed 223 times by 1 test: return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0); Executed by:
| 223 | ||||||||||||||||||||||||
272 | } | - | ||||||||||||||||||||||||
273 | int 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: overlapped;return overlapped; Executed by:
executed 30073570 times by 2 tests: return overlapped; Executed by:
| 30073570 | ||||||||||||||||||||||||
285 | } | - | ||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||
287 | int 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)
| 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
| 36373-29385530 | ||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||
299 | if (bl == 1
| 0-35423 | ||||||||||||||||||||||||
300 | ERR_put_error(6,(167),(162),__FILE__,310); | - | ||||||||||||||||||||||||
301 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
302 | } | - | ||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||
304 | i = ctx->cipher->do_cipher(ctx, out, in, inl); | - | ||||||||||||||||||||||||
305 | if (i < 0
| 0-36373 | ||||||||||||||||||||||||
306 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
307 | else | - | ||||||||||||||||||||||||
308 | * executed 36373 times by 1 test: outl = i;*outl = i; Executed by:
executed 36373 times by 1 test: *outl = i; Executed by:
| 36373 | ||||||||||||||||||||||||
309 | return executed 36373 times by 1 test: 1;return 1; Executed by:
executed 36373 times by 1 test: return 1; Executed by:
| 36373 | ||||||||||||||||||||||||
310 | } | - | ||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||
312 | if (inl <= 0
| 0-30027432 | ||||||||||||||||||||||||
313 | *outl = 0; | - | ||||||||||||||||||||||||
314 | return never executed: inl == 0;return inl == 0; never executed: return inl == 0; | 0 | ||||||||||||||||||||||||
315 | } | - | ||||||||||||||||||||||||
316 | if (is_partially_overlapping(out + ctx->buf_len, in, cmpl)
| 0-30006938 | ||||||||||||||||||||||||
317 | ERR_put_error(6,(167),(162),__FILE__,327); | - | ||||||||||||||||||||||||
318 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
319 | } | - | ||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||
321 | if (ctx->buf_len == 0
| 7007-29413053 | ||||||||||||||||||||||||
322 | if (ctx->cipher->do_cipher(ctx, out, in, inl)
| 1-28321037 | ||||||||||||||||||||||||
323 | *outl = inl; | - | ||||||||||||||||||||||||
324 | return executed 28209791 times by 2 tests: 1;return 1; Executed by:
executed 28209791 times by 2 tests: return 1; Executed by:
| 28209791 | ||||||||||||||||||||||||
325 | } else { | - | ||||||||||||||||||||||||
326 | *outl = 0; | - | ||||||||||||||||||||||||
327 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 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
| 7007-12738 | ||||||||||||||||||||||||
333 | if (bl - i > inl
| 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: 1;return 1; Executed by:
executed 898 times by 1 test: return 1; Executed by:
| 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)
| 0-11840 | ||||||||||||||||||||||||
344 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
345 | out += bl; | - | ||||||||||||||||||||||||
346 | *outl = bl; | - | ||||||||||||||||||||||||
347 | } executed 11840 times by 1 test: end of block Executed by:
| 11840 | ||||||||||||||||||||||||
348 | } else | - | ||||||||||||||||||||||||
349 | * executed 7007 times by 1 test: outl = 0;*outl = 0; Executed by:
executed 7007 times by 1 test: *outl = 0; Executed by:
| 7007 | ||||||||||||||||||||||||
350 | i = inl & (bl - 1); | - | ||||||||||||||||||||||||
351 | inl -= i; | - | ||||||||||||||||||||||||
352 | if (inl > 0
| 2156-16691 | ||||||||||||||||||||||||
353 | if (!ctx->cipher->do_cipher(ctx, out, in, inl)
| 0-16691 | ||||||||||||||||||||||||
354 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
355 | *outl += inl; | - | ||||||||||||||||||||||||
356 | } executed 16691 times by 1 test: end of block Executed by:
| 16691 | ||||||||||||||||||||||||
357 | - | |||||||||||||||||||||||||
358 | if (i != 0
| 5172-13675 | ||||||||||||||||||||||||
359 | memcpy(ctx->buf, &(in[inl]), i); executed 13675 times by 1 test: memcpy(ctx->buf, &(in[inl]), i); Executed by:
| 13675 | ||||||||||||||||||||||||
360 | ctx->buf_len = i; | - | ||||||||||||||||||||||||
361 | return executed 18847 times by 1 test: 1;return 1; Executed by:
executed 18847 times by 1 test: return 1; Executed by:
| 18847 | ||||||||||||||||||||||||
362 | } | - | ||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||
364 | int 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: ret;return ret; Executed by:
executed 1750 times by 1 test: return ret; Executed by:
| 1750 | ||||||||||||||||||||||||
369 | } | - | ||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||
371 | int 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
| 16244-19989 | ||||||||||||||||||||||||
377 | ret = ctx->cipher->do_cipher(ctx, out, | - | ||||||||||||||||||||||||
378 | ((void *)0) | - | ||||||||||||||||||||||||
379 | , 0); | - | ||||||||||||||||||||||||
380 | if (ret < 0
| 0-16244 | ||||||||||||||||||||||||
381 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
382 | else | - | ||||||||||||||||||||||||
383 | * executed 16244 times by 1 test: outl = ret;*outl = ret; Executed by:
executed 16244 times by 1 test: *outl = ret; Executed by:
| 16244 | ||||||||||||||||||||||||
384 | return executed 16244 times by 1 test: 1;return 1; Executed by:
executed 16244 times by 1 test: return 1; Executed by:
| 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
| 6054-13935 | ||||||||||||||||||||||||
390 | *outl = 0; | - | ||||||||||||||||||||||||
391 | return executed 13935 times by 1 test: 1;return 1; Executed by:
executed 13935 times by 1 test: return 1; Executed by:
| 13935 | ||||||||||||||||||||||||
392 | } | - | ||||||||||||||||||||||||
393 | bl = ctx->buf_len; | - | ||||||||||||||||||||||||
394 | if (ctx->flags & 0x100
| 996-5058 | ||||||||||||||||||||||||
395 | if (bl
| 0-996 | ||||||||||||||||||||||||
396 | ERR_put_error(6,(127),(138),__FILE__,405) | - | ||||||||||||||||||||||||
397 | ; | - | ||||||||||||||||||||||||
398 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
399 | } | - | ||||||||||||||||||||||||
400 | *outl = 0; | - | ||||||||||||||||||||||||
401 | return executed 996 times by 1 test: 1;return 1; Executed by:
executed 996 times by 1 test: return 1; Executed by:
| 996 | ||||||||||||||||||||||||
402 | } | - | ||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | n = b - bl; | - | ||||||||||||||||||||||||
405 | for (i = bl; i < b
| 5058-62228 | ||||||||||||||||||||||||
406 | ctx->buf[i] = n; executed 62228 times by 1 test: ctx->buf[i] = n; Executed by:
| 62228 | ||||||||||||||||||||||||
407 | ret = ctx->cipher->do_cipher(ctx, out, ctx->buf, b); | - | ||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
409 | if (ret
| 0-5058 | ||||||||||||||||||||||||
410 | * executed 5058 times by 1 test: outl = b;*outl = b; Executed by:
executed 5058 times by 1 test: *outl = b; Executed by:
| 5058 | ||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||
412 | return executed 5058 times by 1 test: ret;return ret; Executed by:
executed 5058 times by 1 test: return ret; Executed by:
| 5058 | ||||||||||||||||||||||||
413 | } | - | ||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||
415 | int 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)
| 0-107860 | ||||||||||||||||||||||||
424 | cmpl = (cmpl + 7) / 8; never executed: cmpl = (cmpl + 7) / 8; | 0 | ||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | if (ctx->cipher->flags & 0x100000
| 53557-54303 | ||||||||||||||||||||||||
427 | if (b == 1
| 0-53352 | ||||||||||||||||||||||||
428 | ERR_put_error(6,(166),(162),__FILE__,436); | - | ||||||||||||||||||||||||
429 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
430 | } | - | ||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||
432 | fix_len = ctx->cipher->do_cipher(ctx, out, in, inl); | - | ||||||||||||||||||||||||
433 | if (fix_len < 0
| 2-54301 | ||||||||||||||||||||||||
434 | *outl = 0; | - | ||||||||||||||||||||||||
435 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
436 | } else | - | ||||||||||||||||||||||||
437 | * executed 54301 times by 1 test: outl = fix_len;*outl = fix_len; Executed by:
executed 54301 times by 1 test: *outl = fix_len; Executed by:
| 54301 | ||||||||||||||||||||||||
438 | return executed 54301 times by 1 test: 1;return 1; Executed by:
executed 54301 times by 1 test: return 1; Executed by:
| 54301 | ||||||||||||||||||||||||
439 | } | - | ||||||||||||||||||||||||
440 | - | |||||||||||||||||||||||||
441 | if (inl <= 0
| 0-53557 | ||||||||||||||||||||||||
442 | *outl = 0; | - | ||||||||||||||||||||||||
443 | return never executed: inl == 0;return inl == 0; never executed: return inl == 0; | 0 | ||||||||||||||||||||||||
444 | } | - | ||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||
446 | if (ctx->flags & 0x100
| 4032-49525 | ||||||||||||||||||||||||
447 | return executed 4032 times by 1 test: EVP_EncryptUpdate(ctx, out, outl, in, inl);return EVP_EncryptUpdate(ctx, out, outl, in, inl); Executed by:
executed 4032 times by 1 test: return EVP_EncryptUpdate(ctx, out, outl, in, inl); Executed by:
| 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
| 2900-46625 | ||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | if (((
| 0-2900 | ||||||||||||||||||||||||
454 | || is_partially_overlapping(out, in, b)
| 0-2900 | ||||||||||||||||||||||||
455 | ERR_put_error(6,(166),(162),__FILE__,463); | - | ||||||||||||||||||||||||
456 | return never executed: 0;return 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: elseend of block Executed by:
| 2900 | ||||||||||||||||||||||||
462 | fix_len = 0; executed 46625 times by 1 test: fix_len = 0; Executed by:
| 46625 | ||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||
464 | if (!EVP_EncryptUpdate(ctx, out, outl, in, inl)
| 0-49525 | ||||||||||||||||||||||||
465 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | - | |||||||||||||||||||||||||
468 | - | |||||||||||||||||||||||||
469 | - | |||||||||||||||||||||||||
470 | - | |||||||||||||||||||||||||
471 | if (b > 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: elseend of block Executed by:
| 6422 | ||||||||||||||||||||||||
476 | ctx->final_used = 0; executed 43103 times by 1 test: ctx->final_used = 0; Executed by:
| 43103 | ||||||||||||||||||||||||
477 | - | |||||||||||||||||||||||||
478 | if (fix_len
| 2900-46625 | ||||||||||||||||||||||||
479 | * executed 2900 times by 1 test: outl += b;*outl += b; Executed by:
executed 2900 times by 1 test: *outl += b; Executed by:
| 2900 | ||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||
481 | return executed 49525 times by 1 test: 1;return 1; Executed by:
executed 49525 times by 1 test: return 1; Executed by:
| 49525 | ||||||||||||||||||||||||
482 | } | - | ||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||
484 | int 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: ret;return ret; Executed by:
executed 213 times by 1 test: return ret; Executed by:
| 213 | ||||||||||||||||||||||||
489 | } | - | ||||||||||||||||||||||||
490 | - | |||||||||||||||||||||||||
491 | int 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
| 18069-25210 | ||||||||||||||||||||||||
498 | i = ctx->cipher->do_cipher(ctx, out, | - | ||||||||||||||||||||||||
499 | ((void *)0) | - | ||||||||||||||||||||||||
500 | , 0); | - | ||||||||||||||||||||||||
501 | if (i < 0
| 10601-14609 | ||||||||||||||||||||||||
502 | return executed 10601 times by 1 test: 0;return 0; Executed by:
executed 10601 times by 1 test: return 0; Executed by:
| 10601 | ||||||||||||||||||||||||
503 | else | - | ||||||||||||||||||||||||
504 | * executed 14609 times by 1 test: outl = i;*outl = i; Executed by:
executed 14609 times by 1 test: *outl = i; Executed by:
| 14609 | ||||||||||||||||||||||||
505 | return executed 14609 times by 1 test: 1;return 1; Executed by:
executed 14609 times by 1 test: return 1; Executed by:
| 14609 | ||||||||||||||||||||||||
506 | } | - | ||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||
508 | b = ctx->cipher->block_size; | - | ||||||||||||||||||||||||
509 | if (ctx->flags & 0x100
| 2112-15957 | ||||||||||||||||||||||||
510 | if (ctx->buf_len
| 0-2112 | ||||||||||||||||||||||||
511 | ERR_put_error(6,(101),(138),__FILE__,518) | - | ||||||||||||||||||||||||
512 | ; | - | ||||||||||||||||||||||||
513 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
514 | } | - | ||||||||||||||||||||||||
515 | *outl = 0; | - | ||||||||||||||||||||||||
516 | return executed 2112 times by 1 test: 1;return 1; Executed by:
executed 2112 times by 1 test: return 1; Executed by:
| 2112 | ||||||||||||||||||||||||
517 | } | - | ||||||||||||||||||||||||
518 | if (b > 1
| 3526-12431 | ||||||||||||||||||||||||
519 | if (ctx->buf_len
| 2-3524 | ||||||||||||||||||||||||
520 | ERR_put_error(6,(101),(109),__FILE__,526); | - | ||||||||||||||||||||||||
521 | return executed 4 times by 1 test: 0;return 0; Executed by:
executed 4 times by 1 test: return 0; Executed by:
| 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
| 1-3521 | ||||||||||||||||||||||||
531 | ERR_put_error(6,(101),(100),__FILE__,537); | - | ||||||||||||||||||||||||
532 | return executed 3 times by 1 test: 0;return 0; Executed by:
executed 3 times by 1 test: return 0; Executed by:
| 3 | ||||||||||||||||||||||||
533 | } | - | ||||||||||||||||||||||||
534 | for (i = 0; i < n
| 3515-52177 | ||||||||||||||||||||||||
535 | if (ctx->final[--b] != n
| 4-52173 | ||||||||||||||||||||||||
536 | ERR_put_error(6,(101),(100),__FILE__,542); | - | ||||||||||||||||||||||||
537 | return executed 4 times by 1 test: 0;return 0; Executed by:
executed 4 times by 1 test: return 0; Executed by:
| 4 | ||||||||||||||||||||||||
538 | } | - | ||||||||||||||||||||||||
539 | } executed 52173 times by 1 test: end of block Executed by:
| 52173 | ||||||||||||||||||||||||
540 | n = ctx->cipher->block_size - n; | - | ||||||||||||||||||||||||
541 | for (i = 0; i < n
| 3302-3515 | ||||||||||||||||||||||||
542 | out[i] = ctx->final[i]; executed 3302 times by 1 test: out[i] = ctx->final[i]; Executed by:
| 3302 | ||||||||||||||||||||||||
543 | *outl = n; | - | ||||||||||||||||||||||||
544 | } executed 3515 times by 1 test: elseend of block Executed by:
| 3515 | ||||||||||||||||||||||||
545 | * executed 12431 times by 1 test: outl = 0;*outl = 0; Executed by:
executed 12431 times by 1 test: *outl = 0; Executed by:
| 12431 | ||||||||||||||||||||||||
546 | return executed 15946 times by 1 test: 1;return 1; Executed by:
executed 15946 times by 1 test: return 1; Executed by:
| 15946 | ||||||||||||||||||||||||
547 | } | - | ||||||||||||||||||||||||
548 | - | |||||||||||||||||||||||||
549 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) | - | ||||||||||||||||||||||||
550 | { | - | ||||||||||||||||||||||||
551 | if (c->cipher->flags & 0x80
| 0-6185 | ||||||||||||||||||||||||
552 | return never executed: EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, return EVP_CIPHER_CTX_ctrl(c, 0x1, keylen, ((void *)0) ); 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
| 2-6183 | ||||||||||||||||||||||||
556 | return executed 6183 times by 1 test: 1;return 1; Executed by:
executed 6183 times by 1 test: return 1; Executed by:
| 6183 | ||||||||||||||||||||||||
557 | if ((
| 0-2 | ||||||||||||||||||||||||
558 | c->key_len = keylen; | - | ||||||||||||||||||||||||
559 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
560 | } | - | ||||||||||||||||||||||||
561 | ERR_put_error(6,(122),(130),__FILE__,565); | - | ||||||||||||||||||||||||
562 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
563 | } | - | ||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) | - | ||||||||||||||||||||||||
566 | { | - | ||||||||||||||||||||||||
567 | if (pad
| 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:
| 6176 | ||||||||||||||||||||||||
571 | return executed 6176 times by 1 test: 1;return 1; Executed by:
executed 6176 times by 1 test: return 1; Executed by:
| 6176 | ||||||||||||||||||||||||
572 | } | - | ||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||
574 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | - | ||||||||||||||||||||||||
575 | { | - | ||||||||||||||||||||||||
576 | int ret; | - | ||||||||||||||||||||||||
577 | - | |||||||||||||||||||||||||
578 | if (!ctx->cipher
| 0-72983 | ||||||||||||||||||||||||
579 | ERR_put_error(6,(124),(131),__FILE__,583); | - | ||||||||||||||||||||||||
580 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
581 | } | - | ||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | if (!ctx->cipher->ctrl
| 0-72983 | ||||||||||||||||||||||||
584 | ERR_put_error(6,(124),(132),__FILE__,588); | - | ||||||||||||||||||||||||
585 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
586 | } | - | ||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||
588 | ret = ctx->cipher->ctrl(ctx, type, arg, ptr); | - | ||||||||||||||||||||||||
589 | if (ret == -1
| 0-72983 | ||||||||||||||||||||||||
590 | ERR_put_error(6,(124),(133),__FILE__,595) | - | ||||||||||||||||||||||||
591 | ; | - | ||||||||||||||||||||||||
592 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
593 | } | - | ||||||||||||||||||||||||
594 | return executed 72983 times by 1 test: ret;return ret; Executed by:
executed 72983 times by 1 test: return ret; Executed by:
| 72983 | ||||||||||||||||||||||||
595 | } | - | ||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||
597 | int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) | - | ||||||||||||||||||||||||
598 | { | - | ||||||||||||||||||||||||
599 | if (ctx->cipher->flags & 0x200
| 22-31 | ||||||||||||||||||||||||
600 | return executed 31 times by 1 test: EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key);return EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key); Executed by:
executed 31 times by 1 test: return EVP_CIPHER_CTX_ctrl(ctx, 0x6, 0, key); Executed by:
| 31 | ||||||||||||||||||||||||
601 | if (RAND_priv_bytes(key, ctx->key_len) <= 0
| 0-22 | ||||||||||||||||||||||||
602 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
603 | return executed 22 times by 1 test: 1;return 1; Executed by:
executed 22 times by 1 test: return 1; Executed by:
| 22 | ||||||||||||||||||||||||
604 | } | - | ||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||
606 | int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) | - | ||||||||||||||||||||||||
607 | { | - | ||||||||||||||||||||||||
608 | if ((
| 0-8 | ||||||||||||||||||||||||
609 | ((void *)0)
| 0-8 | ||||||||||||||||||||||||
610 | )
| 0-8 | ||||||||||||||||||||||||
611 | ((void *)0)
| 0-8 | ||||||||||||||||||||||||
612 | )
| 0-8 | ||||||||||||||||||||||||
613 | ERR_put_error(6,(163),(111),__FILE__,613); | - | ||||||||||||||||||||||||
614 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
615 | } | - | ||||||||||||||||||||||||
616 | - | |||||||||||||||||||||||||
617 | - | |||||||||||||||||||||||||
618 | if (in->engine
| 0-8 | ||||||||||||||||||||||||
619 | ERR_put_error(6,(163),(38),__FILE__,619); | - | ||||||||||||||||||||||||
620 | return never executed: 0;return 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
| 0-8 | ||||||||||||||||||||||||
628 | out->cipher_data = CRYPTO_malloc(in->cipher->ctx_size, __FILE__, 628); | - | ||||||||||||||||||||||||
629 | if (out->cipher_data ==
| 0-8 | ||||||||||||||||||||||||
630 | ((void *)0)
| 0-8 | ||||||||||||||||||||||||
631 | ) { | - | ||||||||||||||||||||||||
632 | out->cipher = | - | ||||||||||||||||||||||||
633 | ((void *)0) | - | ||||||||||||||||||||||||
634 | ; | - | ||||||||||||||||||||||||
635 | ERR_put_error(6,(163),((1|64)),__FILE__,631); | - | ||||||||||||||||||||||||
636 | return never executed: 0;return 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:
| 8 | ||||||||||||||||||||||||
640 | - | |||||||||||||||||||||||||
641 | if (in->cipher->flags & 0x400
| 0-8 | ||||||||||||||||||||||||
642 | if (!in->cipher->ctrl((EVP_CIPHER_CTX *)in, 0x8, 0, out)
| 0 | ||||||||||||||||||||||||
643 | out->cipher = | - | ||||||||||||||||||||||||
644 | ((void *)0) | - | ||||||||||||||||||||||||
645 | ; | - | ||||||||||||||||||||||||
646 | ERR_put_error(6,(163),(134),__FILE__,640); | - | ||||||||||||||||||||||||
647 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
648 | } | - | ||||||||||||||||||||||||
649 | return executed 8 times by 1 test: 1;return 1; Executed by:
executed 8 times by 1 test: return 1; Executed by:
| 8 | ||||||||||||||||||||||||
650 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |