Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/e_aes.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | typedef struct { | - | ||||||||||||||||||||||||
3 | union { | - | ||||||||||||||||||||||||
4 | double align; | - | ||||||||||||||||||||||||
5 | AES_KEY ks; | - | ||||||||||||||||||||||||
6 | } ks; | - | ||||||||||||||||||||||||
7 | block128_f block; | - | ||||||||||||||||||||||||
8 | union { | - | ||||||||||||||||||||||||
9 | cbc128_f cbc; | - | ||||||||||||||||||||||||
10 | ctr128_f ctr; | - | ||||||||||||||||||||||||
11 | } stream; | - | ||||||||||||||||||||||||
12 | } EVP_AES_KEY; | - | ||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||
14 | typedef struct { | - | ||||||||||||||||||||||||
15 | union { | - | ||||||||||||||||||||||||
16 | double align; | - | ||||||||||||||||||||||||
17 | AES_KEY ks; | - | ||||||||||||||||||||||||
18 | } ks; | - | ||||||||||||||||||||||||
19 | int key_set; | - | ||||||||||||||||||||||||
20 | int iv_set; | - | ||||||||||||||||||||||||
21 | GCM128_CONTEXT gcm; | - | ||||||||||||||||||||||||
22 | unsigned char *iv; | - | ||||||||||||||||||||||||
23 | int ivlen; | - | ||||||||||||||||||||||||
24 | int taglen; | - | ||||||||||||||||||||||||
25 | int iv_gen; | - | ||||||||||||||||||||||||
26 | int tls_aad_len; | - | ||||||||||||||||||||||||
27 | uint64_t tls_enc_records; | - | ||||||||||||||||||||||||
28 | ctr128_f ctr; | - | ||||||||||||||||||||||||
29 | } EVP_AES_GCM_CTX; | - | ||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||
31 | typedef struct { | - | ||||||||||||||||||||||||
32 | union { | - | ||||||||||||||||||||||||
33 | double align; | - | ||||||||||||||||||||||||
34 | AES_KEY ks; | - | ||||||||||||||||||||||||
35 | } ks1, ks2; | - | ||||||||||||||||||||||||
36 | XTS128_CONTEXT xts; | - | ||||||||||||||||||||||||
37 | void (*stream) (const unsigned char *in, | - | ||||||||||||||||||||||||
38 | unsigned char *out, size_t length, | - | ||||||||||||||||||||||||
39 | const AES_KEY *key1, const AES_KEY *key2, | - | ||||||||||||||||||||||||
40 | const unsigned char iv[16]); | - | ||||||||||||||||||||||||
41 | } EVP_AES_XTS_CTX; | - | ||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||
43 | typedef struct { | - | ||||||||||||||||||||||||
44 | union { | - | ||||||||||||||||||||||||
45 | double align; | - | ||||||||||||||||||||||||
46 | AES_KEY ks; | - | ||||||||||||||||||||||||
47 | } ks; | - | ||||||||||||||||||||||||
48 | int key_set; | - | ||||||||||||||||||||||||
49 | int iv_set; | - | ||||||||||||||||||||||||
50 | int tag_set; | - | ||||||||||||||||||||||||
51 | int len_set; | - | ||||||||||||||||||||||||
52 | int L, M; | - | ||||||||||||||||||||||||
53 | int tls_aad_len; | - | ||||||||||||||||||||||||
54 | CCM128_CONTEXT ccm; | - | ||||||||||||||||||||||||
55 | ccm128_f str; | - | ||||||||||||||||||||||||
56 | } EVP_AES_CCM_CTX; | - | ||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||
59 | typedef struct { | - | ||||||||||||||||||||||||
60 | union { | - | ||||||||||||||||||||||||
61 | double align; | - | ||||||||||||||||||||||||
62 | AES_KEY ks; | - | ||||||||||||||||||||||||
63 | } ksenc; | - | ||||||||||||||||||||||||
64 | union { | - | ||||||||||||||||||||||||
65 | double align; | - | ||||||||||||||||||||||||
66 | AES_KEY ks; | - | ||||||||||||||||||||||||
67 | } ksdec; | - | ||||||||||||||||||||||||
68 | int key_set; | - | ||||||||||||||||||||||||
69 | int iv_set; | - | ||||||||||||||||||||||||
70 | OCB128_CONTEXT ocb; | - | ||||||||||||||||||||||||
71 | unsigned char *iv; | - | ||||||||||||||||||||||||
72 | unsigned char tag[16]; | - | ||||||||||||||||||||||||
73 | unsigned char data_buf[16]; | - | ||||||||||||||||||||||||
74 | unsigned char aad_buf[16]; | - | ||||||||||||||||||||||||
75 | int data_buf_len; | - | ||||||||||||||||||||||||
76 | int aad_buf_len; | - | ||||||||||||||||||||||||
77 | int ivlen; | - | ||||||||||||||||||||||||
78 | int taglen; | - | ||||||||||||||||||||||||
79 | } EVP_AES_OCB_CTX; | - | ||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||
85 | int vpaes_set_encrypt_key(const unsigned char *userKey, int bits, | - | ||||||||||||||||||||||||
86 | AES_KEY *key); | - | ||||||||||||||||||||||||
87 | int vpaes_set_decrypt_key(const unsigned char *userKey, int bits, | - | ||||||||||||||||||||||||
88 | AES_KEY *key); | - | ||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||
90 | void vpaes_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
91 | const AES_KEY *key); | - | ||||||||||||||||||||||||
92 | void vpaes_decrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
93 | const AES_KEY *key); | - | ||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||
95 | void vpaes_cbc_encrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
96 | unsigned char *out, | - | ||||||||||||||||||||||||
97 | size_t length, | - | ||||||||||||||||||||||||
98 | const AES_KEY *key, unsigned char *ivec, int enc); | - | ||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||
101 | void bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
102 | size_t length, const AES_KEY *key, | - | ||||||||||||||||||||||||
103 | unsigned char ivec[16], int enc); | - | ||||||||||||||||||||||||
104 | void bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
105 | size_t len, const AES_KEY *key, | - | ||||||||||||||||||||||||
106 | const unsigned char ivec[16]); | - | ||||||||||||||||||||||||
107 | void bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out, | - | ||||||||||||||||||||||||
108 | size_t len, const AES_KEY *key1, | - | ||||||||||||||||||||||||
109 | const AES_KEY *key2, const unsigned char iv[16]); | - | ||||||||||||||||||||||||
110 | void bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out, | - | ||||||||||||||||||||||||
111 | size_t len, const AES_KEY *key1, | - | ||||||||||||||||||||||||
112 | const AES_KEY *key2, const unsigned char iv[16]); | - | ||||||||||||||||||||||||
113 | static void ctr64_inc(unsigned char *counter) | - | ||||||||||||||||||||||||
114 | { | - | ||||||||||||||||||||||||
115 | int n = 8; | - | ||||||||||||||||||||||||
116 | unsigned char c; | - | ||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | do { | - | ||||||||||||||||||||||||
119 | --n; | - | ||||||||||||||||||||||||
120 | c = counter[n]; | - | ||||||||||||||||||||||||
121 | ++c; | - | ||||||||||||||||||||||||
122 | counter[n] = c; | - | ||||||||||||||||||||||||
123 | if (c
| 9-2743 | ||||||||||||||||||||||||
124 | return; executed 2743 times by 1 test: return; Executed by:
| 2743 | ||||||||||||||||||||||||
125 | } executed 9 times by 1 test: while (nend of block Executed by:
| 0-9 | ||||||||||||||||||||||||
126 | } never executed: end of block | 0 | ||||||||||||||||||||||||
127 | extern unsigned int OPENSSL_ia32cap_P[]; | - | ||||||||||||||||||||||||
128 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | - | ||||||||||||||||||||||||
129 | AES_KEY *key); | - | ||||||||||||||||||||||||
130 | int aesni_set_decrypt_key(const unsigned char *userKey, int bits, | - | ||||||||||||||||||||||||
131 | AES_KEY *key); | - | ||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||
133 | void aesni_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
134 | const AES_KEY *key); | - | ||||||||||||||||||||||||
135 | void aesni_decrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
136 | const AES_KEY *key); | - | ||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||
138 | void aesni_ecb_encrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
139 | unsigned char *out, | - | ||||||||||||||||||||||||
140 | size_t length, const AES_KEY *key, int enc); | - | ||||||||||||||||||||||||
141 | void aesni_cbc_encrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
142 | unsigned char *out, | - | ||||||||||||||||||||||||
143 | size_t length, | - | ||||||||||||||||||||||||
144 | const AES_KEY *key, unsigned char *ivec, int enc); | - | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | void aesni_ctr32_encrypt_blocks(const unsigned char *in, | - | ||||||||||||||||||||||||
147 | unsigned char *out, | - | ||||||||||||||||||||||||
148 | size_t blocks, | - | ||||||||||||||||||||||||
149 | const void *key, const unsigned char *ivec); | - | ||||||||||||||||||||||||
150 | - | |||||||||||||||||||||||||
151 | void aesni_xts_encrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
152 | unsigned char *out, | - | ||||||||||||||||||||||||
153 | size_t length, | - | ||||||||||||||||||||||||
154 | const AES_KEY *key1, const AES_KEY *key2, | - | ||||||||||||||||||||||||
155 | const unsigned char iv[16]); | - | ||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||
157 | void aesni_xts_decrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
158 | unsigned char *out, | - | ||||||||||||||||||||||||
159 | size_t length, | - | ||||||||||||||||||||||||
160 | const AES_KEY *key1, const AES_KEY *key2, | - | ||||||||||||||||||||||||
161 | const unsigned char iv[16]); | - | ||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||
163 | void aesni_ccm64_encrypt_blocks(const unsigned char *in, | - | ||||||||||||||||||||||||
164 | unsigned char *out, | - | ||||||||||||||||||||||||
165 | size_t blocks, | - | ||||||||||||||||||||||||
166 | const void *key, | - | ||||||||||||||||||||||||
167 | const unsigned char ivec[16], | - | ||||||||||||||||||||||||
168 | unsigned char cmac[16]); | - | ||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||
170 | void aesni_ccm64_decrypt_blocks(const unsigned char *in, | - | ||||||||||||||||||||||||
171 | unsigned char *out, | - | ||||||||||||||||||||||||
172 | size_t blocks, | - | ||||||||||||||||||||||||
173 | const void *key, | - | ||||||||||||||||||||||||
174 | const unsigned char ivec[16], | - | ||||||||||||||||||||||||
175 | unsigned char cmac[16]); | - | ||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | size_t aesni_gcm_encrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
179 | unsigned char *out, | - | ||||||||||||||||||||||||
180 | size_t len, | - | ||||||||||||||||||||||||
181 | const void *key, unsigned char ivec[16], u64 *Xi); | - | ||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||
183 | size_t aesni_gcm_decrypt(const unsigned char *in, | - | ||||||||||||||||||||||||
184 | unsigned char *out, | - | ||||||||||||||||||||||||
185 | size_t len, | - | ||||||||||||||||||||||||
186 | const void *key, unsigned char ivec[16], u64 *Xi); | - | ||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||
188 | void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, | - | ||||||||||||||||||||||||
189 | size_t len); | - | ||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||
192 | - | |||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||
197 | static int aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
198 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
199 | { | - | ||||||||||||||||||||||||
200 | int ret, mode; | - | ||||||||||||||||||||||||
201 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||
203 | mode = (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0xF0007); | - | ||||||||||||||||||||||||
204 | if ((mode == 0x1
| 0 | ||||||||||||||||||||||||
205 | && !enc
| 0 | ||||||||||||||||||||||||
206 | ret = aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
207 | &dat->ks.ks); | - | ||||||||||||||||||||||||
208 | dat->block = (block128_f) aesni_decrypt; | - | ||||||||||||||||||||||||
209 | dat->stream.cbc = mode == 0x2
| 0 | ||||||||||||||||||||||||
210 | (cbc128_f) aesni_cbc_encrypt : | - | ||||||||||||||||||||||||
211 | ((void *)0) | - | ||||||||||||||||||||||||
212 | ; | - | ||||||||||||||||||||||||
213 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
214 | ret = aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
215 | &dat->ks.ks); | - | ||||||||||||||||||||||||
216 | dat->block = (block128_f) aesni_encrypt; | - | ||||||||||||||||||||||||
217 | if (mode == 0x2
| 0 | ||||||||||||||||||||||||
218 | dat->stream.cbc = (cbc128_f) aesni_cbc_encrypt; never executed: dat->stream.cbc = (cbc128_f) aesni_cbc_encrypt; | 0 | ||||||||||||||||||||||||
219 | else if (mode == 0x5
| 0 | ||||||||||||||||||||||||
220 | dat->stream.ctr = (ctr128_f) aesni_ctr32_encrypt_blocks; never executed: dat->stream.ctr = (ctr128_f) aesni_ctr32_encrypt_blocks; | 0 | ||||||||||||||||||||||||
221 | else | - | ||||||||||||||||||||||||
222 | dat->stream.cbc = never executed: dat->stream.cbc = ((void *)0) ; | 0 | ||||||||||||||||||||||||
223 | ((void *)0) never executed: dat->stream.cbc = ((void *)0) ; | 0 | ||||||||||||||||||||||||
224 | ; never executed: dat->stream.cbc = ((void *)0) ; | 0 | ||||||||||||||||||||||||
225 | } | - | ||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | if (ret < 0
| 0 | ||||||||||||||||||||||||
228 | ERR_put_error(6,(165),(143),__FILE__,295); | - | ||||||||||||||||||||||||
229 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
230 | } | - | ||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||
232 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
233 | } | - | ||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | static int aesni_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
236 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
237 | { | - | ||||||||||||||||||||||||
238 | aesni_cbc_encrypt(in, out, len, &((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks, | - | ||||||||||||||||||||||||
239 | EVP_CIPHER_CTX_iv_noconst(ctx), | - | ||||||||||||||||||||||||
240 | EVP_CIPHER_CTX_encrypting(ctx)); | - | ||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||
242 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
243 | } | - | ||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | static int aesni_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
246 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
247 | { | - | ||||||||||||||||||||||||
248 | size_t bl = EVP_CIPHER_CTX_block_size(ctx); | - | ||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | if (len < bl
| 0 | ||||||||||||||||||||||||
251 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | aesni_ecb_encrypt(in, out, len, &((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))->ks.ks, | - | ||||||||||||||||||||||||
254 | EVP_CIPHER_CTX_encrypting(ctx)); | - | ||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
257 | } | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||
260 | static int aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
261 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||
264 | static int aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
265 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | static int aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
269 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
270 | - | |||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||
272 | static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
273 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | static int aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
277 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||
279 | static int aesni_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
280 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
281 | { | - | ||||||||||||||||||||||||
282 | EVP_AES_GCM_CTX *gctx = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
283 | if (!iv
| 0 | ||||||||||||||||||||||||
284 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
285 | if (key
| 0 | ||||||||||||||||||||||||
286 | aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
287 | &gctx->ks.ks); | - | ||||||||||||||||||||||||
288 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f) aesni_encrypt); | - | ||||||||||||||||||||||||
289 | gctx->ctr = (ctr128_f) aesni_ctr32_encrypt_blocks; | - | ||||||||||||||||||||||||
290 | - | |||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | if (iv ==
| 0 | ||||||||||||||||||||||||
294 | ((void *)0)
| 0 | ||||||||||||||||||||||||
295 | && gctx->iv_set
| 0 | ||||||||||||||||||||||||
296 | iv = gctx->iv; never executed: iv = gctx->iv; | 0 | ||||||||||||||||||||||||
297 | if (iv
| 0 | ||||||||||||||||||||||||
298 | CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); | - | ||||||||||||||||||||||||
299 | gctx->iv_set = 1; | - | ||||||||||||||||||||||||
300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
301 | gctx->key_set = 1; | - | ||||||||||||||||||||||||
302 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||
304 | if (gctx->key_set
| 0 | ||||||||||||||||||||||||
305 | CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); never executed: CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); | 0 | ||||||||||||||||||||||||
306 | else | - | ||||||||||||||||||||||||
307 | memcpy(gctx->iv, iv, gctx->ivlen); never executed: memcpy(gctx->iv, iv, gctx->ivlen); | 0 | ||||||||||||||||||||||||
308 | gctx->iv_set = 1; | - | ||||||||||||||||||||||||
309 | gctx->iv_gen = 0; | - | ||||||||||||||||||||||||
310 | } never executed: end of block | 0 | ||||||||||||||||||||||||
311 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
312 | } | - | ||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | - | |||||||||||||||||||||||||
315 | static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
316 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | static int aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
319 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
320 | { | - | ||||||||||||||||||||||||
321 | EVP_AES_XTS_CTX *xctx = ((EVP_AES_XTS_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
322 | if (!iv
| 0 | ||||||||||||||||||||||||
323 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
324 | - | |||||||||||||||||||||||||
325 | if (key
| 0 | ||||||||||||||||||||||||
326 | - | |||||||||||||||||||||||||
327 | if (enc
| 0 | ||||||||||||||||||||||||
328 | aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
329 | &xctx->ks1.ks); | - | ||||||||||||||||||||||||
330 | xctx->xts.block1 = (block128_f) aesni_encrypt; | - | ||||||||||||||||||||||||
331 | xctx->stream = aesni_xts_encrypt; | - | ||||||||||||||||||||||||
332 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
333 | aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
334 | &xctx->ks1.ks); | - | ||||||||||||||||||||||||
335 | xctx->xts.block1 = (block128_f) aesni_decrypt; | - | ||||||||||||||||||||||||
336 | xctx->stream = aesni_xts_decrypt; | - | ||||||||||||||||||||||||
337 | } never executed: end of block | 0 | ||||||||||||||||||||||||
338 | - | |||||||||||||||||||||||||
339 | aesni_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2, | - | ||||||||||||||||||||||||
340 | EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
341 | &xctx->ks2.ks); | - | ||||||||||||||||||||||||
342 | xctx->xts.block2 = (block128_f) aesni_encrypt; | - | ||||||||||||||||||||||||
343 | - | |||||||||||||||||||||||||
344 | xctx->xts.key1 = &xctx->ks1; | - | ||||||||||||||||||||||||
345 | } never executed: end of block | 0 | ||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | if (iv
| 0 | ||||||||||||||||||||||||
348 | xctx->xts.key2 = &xctx->ks2; | - | ||||||||||||||||||||||||
349 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 16); | - | ||||||||||||||||||||||||
350 | } never executed: end of block | 0 | ||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
353 | } | - | ||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||
356 | static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
357 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
358 | - | |||||||||||||||||||||||||
359 | static int aesni_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
360 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
361 | { | - | ||||||||||||||||||||||||
362 | EVP_AES_CCM_CTX *cctx = ((EVP_AES_CCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
363 | if (!iv
| 0 | ||||||||||||||||||||||||
364 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
365 | if (key
| 0 | ||||||||||||||||||||||||
366 | aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
367 | &cctx->ks.ks); | - | ||||||||||||||||||||||||
368 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | - | ||||||||||||||||||||||||
369 | &cctx->ks, (block128_f) aesni_encrypt); | - | ||||||||||||||||||||||||
370 | cctx->str = enc
| 0 | ||||||||||||||||||||||||
371 | (ccm128_f) aesni_ccm64_decrypt_blocks; | - | ||||||||||||||||||||||||
372 | cctx->key_set = 1; | - | ||||||||||||||||||||||||
373 | } never executed: end of block | 0 | ||||||||||||||||||||||||
374 | if (iv
| 0 | ||||||||||||||||||||||||
375 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 15 - cctx->L); | - | ||||||||||||||||||||||||
376 | cctx->iv_set = 1; | - | ||||||||||||||||||||||||
377 | } never executed: end of block | 0 | ||||||||||||||||||||||||
378 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
379 | } | - | ||||||||||||||||||||||||
380 | - | |||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
383 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||
385 | - | |||||||||||||||||||||||||
386 | void aesni_ocb_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
387 | size_t blocks, const void *key, | - | ||||||||||||||||||||||||
388 | size_t start_block_num, | - | ||||||||||||||||||||||||
389 | unsigned char offset_i[16], | - | ||||||||||||||||||||||||
390 | const unsigned char L_[][16], | - | ||||||||||||||||||||||||
391 | unsigned char checksum[16]); | - | ||||||||||||||||||||||||
392 | void aesni_ocb_decrypt(const unsigned char *in, unsigned char *out, | - | ||||||||||||||||||||||||
393 | size_t blocks, const void *key, | - | ||||||||||||||||||||||||
394 | size_t start_block_num, | - | ||||||||||||||||||||||||
395 | unsigned char offset_i[16], | - | ||||||||||||||||||||||||
396 | const unsigned char L_[][16], | - | ||||||||||||||||||||||||
397 | unsigned char checksum[16]); | - | ||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||
399 | static int aesni_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
400 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
401 | { | - | ||||||||||||||||||||||||
402 | EVP_AES_OCB_CTX *octx = ((EVP_AES_OCB_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
403 | if (!iv
| 0 | ||||||||||||||||||||||||
404 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
405 | if (key
| 0 | ||||||||||||||||||||||||
406 | do { | - | ||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||
410 | - | |||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||
412 | aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
413 | &octx->ksenc.ks); | - | ||||||||||||||||||||||||
414 | aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
415 | &octx->ksdec.ks); | - | ||||||||||||||||||||||||
416 | if (!CRYPTO_ocb128_init(&octx->ocb,
| 0 | ||||||||||||||||||||||||
417 | &octx->ksenc.ks, &octx->ksdec.ks,
| 0 | ||||||||||||||||||||||||
418 | (block128_f) aesni_encrypt,
| 0 | ||||||||||||||||||||||||
419 | (block128_f) aesni_decrypt,
| 0 | ||||||||||||||||||||||||
420 | enc ? aesni_ocb_encrypt
| 0 | ||||||||||||||||||||||||
421 | : aesni_ocb_decrypt)
| 0 | ||||||||||||||||||||||||
422 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
423 | } | - | ||||||||||||||||||||||||
424 | while (0); | - | ||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||
427 | - | |||||||||||||||||||||||||
428 | - | |||||||||||||||||||||||||
429 | if (iv ==
| 0 | ||||||||||||||||||||||||
430 | ((void *)0)
| 0 | ||||||||||||||||||||||||
431 | && octx->iv_set
| 0 | ||||||||||||||||||||||||
432 | iv = octx->iv; never executed: iv = octx->iv; | 0 | ||||||||||||||||||||||||
433 | if (iv
| 0 | ||||||||||||||||||||||||
434 | if (CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen)
| 0 | ||||||||||||||||||||||||
435 | != 1
| 0 | ||||||||||||||||||||||||
436 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
437 | octx->iv_set = 1; | - | ||||||||||||||||||||||||
438 | } never executed: end of block | 0 | ||||||||||||||||||||||||
439 | octx->key_set = 1; | - | ||||||||||||||||||||||||
440 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||
442 | if (octx->key_set
| 0 | ||||||||||||||||||||||||
443 | CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen); never executed: CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen); | 0 | ||||||||||||||||||||||||
444 | else | - | ||||||||||||||||||||||||
445 | memcpy(octx->iv, iv, octx->ivlen); never executed: memcpy(octx->iv, iv, octx->ivlen); | 0 | ||||||||||||||||||||||||
446 | octx->iv_set = 1; | - | ||||||||||||||||||||||||
447 | } never executed: end of block | 0 | ||||||||||||||||||||||||
448 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
449 | } | - | ||||||||||||||||||||||||
450 | - | |||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||
452 | static int aes_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
453 | const unsigned char *in, size_t len); | - | ||||||||||||||||||||||||
454 | static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
455 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
456 | { | - | ||||||||||||||||||||||||
457 | int ret, mode; | - | ||||||||||||||||||||||||
458 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||
460 | mode = (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & 0xF0007); | - | ||||||||||||||||||||||||
461 | if ((mode == 0x1
| 10821-3163388 | ||||||||||||||||||||||||
462 | && !enc
| 4787-3182228 | ||||||||||||||||||||||||
463 | if ((
| 0-4787 | ||||||||||||||||||||||||
464 | ret = AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
465 | &dat->ks.ks); | - | ||||||||||||||||||||||||
466 | dat->block = (block128_f) AES_decrypt; | - | ||||||||||||||||||||||||
467 | dat->stream.cbc = (cbc128_f) bsaes_cbc_encrypt; | - | ||||||||||||||||||||||||
468 | } executed 4622 times by 1 test: elseend of block Executed by:
| 4622 | ||||||||||||||||||||||||
469 | - | |||||||||||||||||||||||||
470 | - | |||||||||||||||||||||||||
471 | if ((
| 0-165 | ||||||||||||||||||||||||
472 | ret = vpaes_set_decrypt_key(key, | - | ||||||||||||||||||||||||
473 | EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
474 | &dat->ks.ks); | - | ||||||||||||||||||||||||
475 | dat->block = (block128_f) vpaes_decrypt; | - | ||||||||||||||||||||||||
476 | dat->stream.cbc = mode == 0x2
| 0-165 | ||||||||||||||||||||||||
477 | (cbc128_f) vpaes_cbc_encrypt : | - | ||||||||||||||||||||||||
478 | ((void *)0) | - | ||||||||||||||||||||||||
479 | ; | - | ||||||||||||||||||||||||
480 | } executed 165 times by 1 test: elseend of block Executed by:
| 165 | ||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||
482 | { | - | ||||||||||||||||||||||||
483 | ret = AES_set_decrypt_key(key, | - | ||||||||||||||||||||||||
484 | EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
485 | &dat->ks.ks); | - | ||||||||||||||||||||||||
486 | dat->block = (block128_f) AES_decrypt; | - | ||||||||||||||||||||||||
487 | dat->stream.cbc = mode == 0x2
| 0 | ||||||||||||||||||||||||
488 | (cbc128_f) AES_cbc_encrypt : | - | ||||||||||||||||||||||||
489 | ((void *)0) | - | ||||||||||||||||||||||||
490 | ; | - | ||||||||||||||||||||||||
491 | } never executed: end of block | 0 | ||||||||||||||||||||||||
492 | } else | - | ||||||||||||||||||||||||
493 | if ((
| 0-3198543 | ||||||||||||||||||||||||
494 | ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
495 | &dat->ks.ks); | - | ||||||||||||||||||||||||
496 | dat->block = (block128_f) AES_encrypt; | - | ||||||||||||||||||||||||
497 | dat->stream.ctr = (ctr128_f) bsaes_ctr32_encrypt_blocks; | - | ||||||||||||||||||||||||
498 | } executed 6278 times by 1 test: elseend of block Executed by:
| 6278 | ||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | - | |||||||||||||||||||||||||
501 | if ((
| 0-3162861 | ||||||||||||||||||||||||
502 | ret = vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
503 | &dat->ks.ks); | - | ||||||||||||||||||||||||
504 | dat->block = (block128_f) vpaes_encrypt; | - | ||||||||||||||||||||||||
505 | dat->stream.cbc = mode == 0x2
| 6199-3123098 | ||||||||||||||||||||||||
506 | (cbc128_f) vpaes_cbc_encrypt : | - | ||||||||||||||||||||||||
507 | ((void *)0) | - | ||||||||||||||||||||||||
508 | ; | - | ||||||||||||||||||||||||
509 | } executed 3118051 times by 2 tests: elseend of block Executed by:
| 3118051 | ||||||||||||||||||||||||
510 | - | |||||||||||||||||||||||||
511 | { | - | ||||||||||||||||||||||||
512 | ret = AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
513 | &dat->ks.ks); | - | ||||||||||||||||||||||||
514 | dat->block = (block128_f) AES_encrypt; | - | ||||||||||||||||||||||||
515 | dat->stream.cbc = mode == 0x2
| 0 | ||||||||||||||||||||||||
516 | (cbc128_f) AES_cbc_encrypt : | - | ||||||||||||||||||||||||
517 | ((void *)0) | - | ||||||||||||||||||||||||
518 | ; | - | ||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||
521 | - | |||||||||||||||||||||||||
522 | - | |||||||||||||||||||||||||
523 | } never executed: end of block | 0 | ||||||||||||||||||||||||
524 | - | |||||||||||||||||||||||||
525 | if (ret < 0
| 0-3128826 | ||||||||||||||||||||||||
526 | ERR_put_error(6,(133),(143),__FILE__,2676); | - | ||||||||||||||||||||||||
527 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
528 | } | - | ||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||
530 | return executed 3144895 times by 2 tests: 1;return 1; Executed by:
executed 3144895 times by 2 tests: return 1; Executed by:
| 3144895 | ||||||||||||||||||||||||
531 | } | - | ||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||
533 | static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
534 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
535 | { | - | ||||||||||||||||||||||||
536 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
537 | - | |||||||||||||||||||||||||
538 | if (dat->stream.cbc
| 0-45300 | ||||||||||||||||||||||||
539 | (* executed 45300 times by 1 test: dat->stream.cbc) (in, out, len, &dat->ks,(*dat->stream.cbc) (in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx)); Executed by:
executed 45300 times by 1 test: (*dat->stream.cbc) (in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx)); Executed by:
| 45300 | ||||||||||||||||||||||||
540 | EVP_CIPHER_CTX_iv_noconst(ctx), executed 45300 times by 1 test: (*dat->stream.cbc) (in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx)); Executed by:
| 45300 | ||||||||||||||||||||||||
541 | EVP_CIPHER_CTX_encrypting(ctx)); executed 45300 times by 1 test: (*dat->stream.cbc) (in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_encrypting(ctx)); Executed by:
| 45300 | ||||||||||||||||||||||||
542 | else if (EVP_CIPHER_CTX_encrypting(ctx)
| 0 | ||||||||||||||||||||||||
543 | CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, never executed: CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), dat->block); | 0 | ||||||||||||||||||||||||
544 | EVP_CIPHER_CTX_iv_noconst(ctx), dat->block); never executed: CRYPTO_cbc128_encrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), dat->block); | 0 | ||||||||||||||||||||||||
545 | else | - | ||||||||||||||||||||||||
546 | CRYPTO_cbc128_decrypt(in, out, len, &dat->ks, never executed: CRYPTO_cbc128_decrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), dat->block); | 0 | ||||||||||||||||||||||||
547 | EVP_CIPHER_CTX_iv_noconst(ctx), dat->block); never executed: CRYPTO_cbc128_decrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), dat->block); | 0 | ||||||||||||||||||||||||
548 | - | |||||||||||||||||||||||||
549 | return executed 45300 times by 1 test: 1;return 1; Executed by:
executed 45300 times by 1 test: return 1; Executed by:
| 45300 | ||||||||||||||||||||||||
550 | } | - | ||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||
552 | static int aes_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
553 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
554 | { | - | ||||||||||||||||||||||||
555 | size_t bl = EVP_CIPHER_CTX_block_size(ctx); | - | ||||||||||||||||||||||||
556 | size_t i; | - | ||||||||||||||||||||||||
557 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
558 | - | |||||||||||||||||||||||||
559 | if (len < bl
| 0-27767782 | ||||||||||||||||||||||||
560 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||
562 | for (i = 0, len -= bl; i <= len
| 27479641-28589899 | ||||||||||||||||||||||||
563 | (* executed 27404611 times by 2 tests: dat->block) (in + i, out + i, &dat->ks);(*dat->block) (in + i, out + i, &dat->ks); Executed by:
executed 27404611 times by 2 tests: (*dat->block) (in + i, out + i, &dat->ks); Executed by:
| 27404611 | ||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | return executed 28560056 times by 2 tests: 1;return 1; Executed by:
executed 28560056 times by 2 tests: return 1; Executed by:
| 28560056 | ||||||||||||||||||||||||
566 | } | - | ||||||||||||||||||||||||
567 | - | |||||||||||||||||||||||||
568 | static int aes_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
569 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
570 | { | - | ||||||||||||||||||||||||
571 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
572 | - | |||||||||||||||||||||||||
573 | int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
574 | CRYPTO_ofb128_encrypt(in, out, len, &dat->ks, | - | ||||||||||||||||||||||||
575 | EVP_CIPHER_CTX_iv_noconst(ctx), &num, dat->block); | - | ||||||||||||||||||||||||
576 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
577 | return executed 18990 times by 1 test: 1;return 1; Executed by:
executed 18990 times by 1 test: return 1; Executed by:
| 18990 | ||||||||||||||||||||||||
578 | } | - | ||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||
580 | static int aes_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
581 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
582 | { | - | ||||||||||||||||||||||||
583 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||
585 | int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
586 | CRYPTO_cfb128_encrypt(in, out, len, &dat->ks, | - | ||||||||||||||||||||||||
587 | EVP_CIPHER_CTX_iv_noconst(ctx), &num, | - | ||||||||||||||||||||||||
588 | EVP_CIPHER_CTX_encrypting(ctx), dat->block); | - | ||||||||||||||||||||||||
589 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
590 | return executed 18990 times by 1 test: 1;return 1; Executed by:
executed 18990 times by 1 test: return 1; Executed by:
| 18990 | ||||||||||||||||||||||||
591 | } | - | ||||||||||||||||||||||||
592 | - | |||||||||||||||||||||||||
593 | static int aes_cfb8_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
594 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
595 | { | - | ||||||||||||||||||||||||
596 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||
598 | int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
599 | CRYPTO_cfb128_8_encrypt(in, out, len, &dat->ks, | - | ||||||||||||||||||||||||
600 | EVP_CIPHER_CTX_iv_noconst(ctx), &num, | - | ||||||||||||||||||||||||
601 | EVP_CIPHER_CTX_encrypting(ctx), dat->block); | - | ||||||||||||||||||||||||
602 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
603 | return executed 6 times by 1 test: 1;return 1; Executed by:
executed 6 times by 1 test: return 1; Executed by:
| 6 | ||||||||||||||||||||||||
604 | } | - | ||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||
606 | static int aes_cfb1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
607 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
608 | { | - | ||||||||||||||||||||||||
609 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
610 | - | |||||||||||||||||||||||||
611 | if (EVP_CIPHER_CTX_test_flags(ctx, 0x2000)
| 0-6 | ||||||||||||||||||||||||
612 | int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
613 | CRYPTO_cfb128_1_encrypt(in, out, len, &dat->ks, | - | ||||||||||||||||||||||||
614 | EVP_CIPHER_CTX_iv_noconst(ctx), &num, | - | ||||||||||||||||||||||||
615 | EVP_CIPHER_CTX_encrypting(ctx), dat->block); | - | ||||||||||||||||||||||||
616 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
617 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
618 | } | - | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | while (len >= ((size_t)1<<(sizeof(size_t)*8-4))
| 0-6 | ||||||||||||||||||||||||
621 | int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
622 | CRYPTO_cfb128_1_encrypt(in, out, ((size_t)1<<(sizeof(size_t)*8-4)) * 8, &dat->ks, | - | ||||||||||||||||||||||||
623 | EVP_CIPHER_CTX_iv_noconst(ctx), &num, | - | ||||||||||||||||||||||||
624 | EVP_CIPHER_CTX_encrypting(ctx), dat->block); | - | ||||||||||||||||||||||||
625 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
626 | len -= ((size_t)1<<(sizeof(size_t)*8-4)); | - | ||||||||||||||||||||||||
627 | out += ((size_t)1<<(sizeof(size_t)*8-4)); | - | ||||||||||||||||||||||||
628 | in += ((size_t)1<<(sizeof(size_t)*8-4)); | - | ||||||||||||||||||||||||
629 | } never executed: end of block | 0 | ||||||||||||||||||||||||
630 | if (len
| 0-6 | ||||||||||||||||||||||||
631 | int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
632 | CRYPTO_cfb128_1_encrypt(in, out, len * 8, &dat->ks, | - | ||||||||||||||||||||||||
633 | EVP_CIPHER_CTX_iv_noconst(ctx), &num, | - | ||||||||||||||||||||||||
634 | EVP_CIPHER_CTX_encrypting(ctx), dat->block); | - | ||||||||||||||||||||||||
635 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
636 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||
638 | return executed 6 times by 1 test: 1;return 1; Executed by:
executed 6 times by 1 test: return 1; Executed by:
| 6 | ||||||||||||||||||||||||
639 | } | - | ||||||||||||||||||||||||
640 | - | |||||||||||||||||||||||||
641 | static int aes_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
642 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
643 | { | - | ||||||||||||||||||||||||
644 | unsigned int num = EVP_CIPHER_CTX_num(ctx); | - | ||||||||||||||||||||||||
645 | EVP_AES_KEY *dat = ((EVP_AES_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
646 | - | |||||||||||||||||||||||||
647 | if (dat->stream.ctr
| 0-18678 | ||||||||||||||||||||||||
648 | CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, executed 18678 times by 1 test: CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->stream.ctr); Executed by:
| 18678 | ||||||||||||||||||||||||
649 | EVP_CIPHER_CTX_iv_noconst(ctx), executed 18678 times by 1 test: CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->stream.ctr); Executed by:
| 18678 | ||||||||||||||||||||||||
650 | EVP_CIPHER_CTX_buf_noconst(ctx), executed 18678 times by 1 test: CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->stream.ctr); Executed by:
| 18678 | ||||||||||||||||||||||||
651 | &num, dat->stream.ctr); executed 18678 times by 1 test: CRYPTO_ctr128_encrypt_ctr32(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->stream.ctr); Executed by:
| 18678 | ||||||||||||||||||||||||
652 | else | - | ||||||||||||||||||||||||
653 | CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, never executed: CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->block); | 0 | ||||||||||||||||||||||||
654 | EVP_CIPHER_CTX_iv_noconst(ctx), never executed: CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->block); | 0 | ||||||||||||||||||||||||
655 | EVP_CIPHER_CTX_buf_noconst(ctx), &num, never executed: CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->block); | 0 | ||||||||||||||||||||||||
656 | dat->block); never executed: CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, EVP_CIPHER_CTX_iv_noconst(ctx), EVP_CIPHER_CTX_buf_noconst(ctx), &num, dat->block); | 0 | ||||||||||||||||||||||||
657 | EVP_CIPHER_CTX_set_num(ctx, num); | - | ||||||||||||||||||||||||
658 | return executed 18678 times by 1 test: 1;return 1; Executed by:
executed 18678 times by 1 test: return 1; Executed by:
| 18678 | ||||||||||||||||||||||||
659 | } | - | ||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||
661 | static const EVP_CIPHER aesni_128_cbc = { 419,16,128/8,16, 0|0x1000|0x2, aesni_init_key, aesni_cbc_cipher, | - | ||||||||||||||||||||||||
662 | ((void *)0) | - | ||||||||||||||||||||||||
663 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
664 | ((void *)0) | - | ||||||||||||||||||||||||
665 | , | - | ||||||||||||||||||||||||
666 | ((void *)0) | - | ||||||||||||||||||||||||
667 | , | - | ||||||||||||||||||||||||
668 | ((void *)0) | - | ||||||||||||||||||||||||
669 | , | - | ||||||||||||||||||||||||
670 | ((void *)0) | - | ||||||||||||||||||||||||
671 | }; static const EVP_CIPHER aes_128_cbc = { 419,16, 128/8,16, 0|0x1000|0x2, aes_init_key, aes_cbc_cipher, | - | ||||||||||||||||||||||||
672 | ((void *)0) | - | ||||||||||||||||||||||||
673 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
674 | ((void *)0) | - | ||||||||||||||||||||||||
675 | , | - | ||||||||||||||||||||||||
676 | ((void *)0) | - | ||||||||||||||||||||||||
677 | , | - | ||||||||||||||||||||||||
678 | ((void *)0) | - | ||||||||||||||||||||||||
679 | , | - | ||||||||||||||||||||||||
680 | ((void *)0) | - | ||||||||||||||||||||||||
681 | }; const EVP_CIPHER *EVP_aes_128_cbc(void) { return executed 5105 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cbc:&aes_128_cbc; Executed by:
executed 5105 times by 1 test: } static const EVP_CIPHER aesni_128_ecb = { 418,16,128/8,0, 0|0x1000|0x1, aesni_init_key, aesni_ecb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cbc:&aes_128_cbc; Executed by:
| 0-5105 | ||||||||||||||||||||||||
682 | ((void *)0) | - | ||||||||||||||||||||||||
683 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
684 | ((void *)0) | - | ||||||||||||||||||||||||
685 | , | - | ||||||||||||||||||||||||
686 | ((void *)0) | - | ||||||||||||||||||||||||
687 | , | - | ||||||||||||||||||||||||
688 | ((void *)0) | - | ||||||||||||||||||||||||
689 | , | - | ||||||||||||||||||||||||
690 | ((void *)0) | - | ||||||||||||||||||||||||
691 | }; static const EVP_CIPHER aes_128_ecb = { 418,16, 128/8,0, 0|0x1000|0x1, aes_init_key, aes_ecb_cipher, | - | ||||||||||||||||||||||||
692 | ((void *)0) | - | ||||||||||||||||||||||||
693 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
694 | ((void *)0) | - | ||||||||||||||||||||||||
695 | , | - | ||||||||||||||||||||||||
696 | ((void *)0) | - | ||||||||||||||||||||||||
697 | , | - | ||||||||||||||||||||||||
698 | ((void *)0) | - | ||||||||||||||||||||||||
699 | , | - | ||||||||||||||||||||||||
700 | ((void *)0) | - | ||||||||||||||||||||||||
701 | }; const EVP_CIPHER *EVP_aes_128_ecb(void) { return executed 6294 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ecb:&aes_128_ecb; Executed by:
executed 6294 times by 1 test: } static const EVP_CIPHER aesni_128_ofb = { 420,1,128/8,16, 0|0x1000|0x4, aesni_init_key, aes_ofb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ecb:&aes_128_ecb; Executed by:
| 0-6294 | ||||||||||||||||||||||||
702 | ((void *)0) | - | ||||||||||||||||||||||||
703 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
704 | ((void *)0) | - | ||||||||||||||||||||||||
705 | , | - | ||||||||||||||||||||||||
706 | ((void *)0) | - | ||||||||||||||||||||||||
707 | , | - | ||||||||||||||||||||||||
708 | ((void *)0) | - | ||||||||||||||||||||||||
709 | , | - | ||||||||||||||||||||||||
710 | ((void *)0) | - | ||||||||||||||||||||||||
711 | }; static const EVP_CIPHER aes_128_ofb = { 420,1, 128/8,16, 0|0x1000|0x4, aes_init_key, aes_ofb_cipher, | - | ||||||||||||||||||||||||
712 | ((void *)0) | - | ||||||||||||||||||||||||
713 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
714 | ((void *)0) | - | ||||||||||||||||||||||||
715 | , | - | ||||||||||||||||||||||||
716 | ((void *)0) | - | ||||||||||||||||||||||||
717 | , | - | ||||||||||||||||||||||||
718 | ((void *)0) | - | ||||||||||||||||||||||||
719 | , | - | ||||||||||||||||||||||||
720 | ((void *)0) | - | ||||||||||||||||||||||||
721 | }; const EVP_CIPHER *EVP_aes_128_ofb(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ofb:&aes_128_ofb; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_128_cfb = { 421,1,128/8,16, 0|0x1000|0x3, aesni_init_key, aes_cfb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ofb:&aes_128_ofb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
722 | ((void *)0) | - | ||||||||||||||||||||||||
723 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
724 | ((void *)0) | - | ||||||||||||||||||||||||
725 | , | - | ||||||||||||||||||||||||
726 | ((void *)0) | - | ||||||||||||||||||||||||
727 | , | - | ||||||||||||||||||||||||
728 | ((void *)0) | - | ||||||||||||||||||||||||
729 | , | - | ||||||||||||||||||||||||
730 | ((void *)0) | - | ||||||||||||||||||||||||
731 | }; static const EVP_CIPHER aes_128_cfb = { 421,1, 128/8,16, 0|0x1000|0x3, aes_init_key, aes_cfb_cipher, | - | ||||||||||||||||||||||||
732 | ((void *)0) | - | ||||||||||||||||||||||||
733 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
734 | ((void *)0) | - | ||||||||||||||||||||||||
735 | , | - | ||||||||||||||||||||||||
736 | ((void *)0) | - | ||||||||||||||||||||||||
737 | , | - | ||||||||||||||||||||||||
738 | ((void *)0) | - | ||||||||||||||||||||||||
739 | , | - | ||||||||||||||||||||||||
740 | ((void *)0) | - | ||||||||||||||||||||||||
741 | }; const EVP_CIPHER *EVP_aes_128_cfb128(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cfb:&aes_128_cfb; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_128_cfb1 = { 650,1,128/8,16, 0|0x3, aesni_init_key, aes_cfb1_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cfb:&aes_128_cfb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
742 | ((void *)0) | - | ||||||||||||||||||||||||
743 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
744 | ((void *)0) | - | ||||||||||||||||||||||||
745 | , | - | ||||||||||||||||||||||||
746 | ((void *)0) | - | ||||||||||||||||||||||||
747 | , | - | ||||||||||||||||||||||||
748 | ((void *)0) | - | ||||||||||||||||||||||||
749 | , | - | ||||||||||||||||||||||||
750 | ((void *)0) | - | ||||||||||||||||||||||||
751 | }; static const EVP_CIPHER aes_128_cfb1 = { 650,1, 128/8,16, 0|0x3, aes_init_key, aes_cfb1_cipher, | - | ||||||||||||||||||||||||
752 | ((void *)0) | - | ||||||||||||||||||||||||
753 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
754 | ((void *)0) | - | ||||||||||||||||||||||||
755 | , | - | ||||||||||||||||||||||||
756 | ((void *)0) | - | ||||||||||||||||||||||||
757 | , | - | ||||||||||||||||||||||||
758 | ((void *)0) | - | ||||||||||||||||||||||||
759 | , | - | ||||||||||||||||||||||||
760 | ((void *)0) | - | ||||||||||||||||||||||||
761 | }; const EVP_CIPHER *EVP_aes_128_cfb1(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cfb1:&aes_128_cfb1; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_128_cfb8 = { 653,1,128/8,16, 0|0x3, aesni_init_key, aes_cfb8_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cfb1:&aes_128_cfb1; Executed by:
| 0-1962 | ||||||||||||||||||||||||
762 | ((void *)0) | - | ||||||||||||||||||||||||
763 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
764 | ((void *)0) | - | ||||||||||||||||||||||||
765 | , | - | ||||||||||||||||||||||||
766 | ((void *)0) | - | ||||||||||||||||||||||||
767 | , | - | ||||||||||||||||||||||||
768 | ((void *)0) | - | ||||||||||||||||||||||||
769 | , | - | ||||||||||||||||||||||||
770 | ((void *)0) | - | ||||||||||||||||||||||||
771 | }; static const EVP_CIPHER aes_128_cfb8 = { 653,1, 128/8,16, 0|0x3, aes_init_key, aes_cfb8_cipher, | - | ||||||||||||||||||||||||
772 | ((void *)0) | - | ||||||||||||||||||||||||
773 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
774 | ((void *)0) | - | ||||||||||||||||||||||||
775 | , | - | ||||||||||||||||||||||||
776 | ((void *)0) | - | ||||||||||||||||||||||||
777 | , | - | ||||||||||||||||||||||||
778 | ((void *)0) | - | ||||||||||||||||||||||||
779 | , | - | ||||||||||||||||||||||||
780 | ((void *)0) | - | ||||||||||||||||||||||||
781 | }; const EVP_CIPHER *EVP_aes_128_cfb8(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cfb8:&aes_128_cfb8; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_128_ctr = { 904,1,128/8,16, 0|0x5, aesni_init_key, aes_ctr_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_cfb8:&aes_128_cfb8; Executed by:
| 0-1962 | ||||||||||||||||||||||||
782 | ((void *)0) | - | ||||||||||||||||||||||||
783 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
784 | ((void *)0) | - | ||||||||||||||||||||||||
785 | , | - | ||||||||||||||||||||||||
786 | ((void *)0) | - | ||||||||||||||||||||||||
787 | , | - | ||||||||||||||||||||||||
788 | ((void *)0) | - | ||||||||||||||||||||||||
789 | , | - | ||||||||||||||||||||||||
790 | ((void *)0) | - | ||||||||||||||||||||||||
791 | }; static const EVP_CIPHER aes_128_ctr = { 904,1, 128/8,16, 0|0x5, aes_init_key, aes_ctr_cipher, | - | ||||||||||||||||||||||||
792 | ((void *)0) | - | ||||||||||||||||||||||||
793 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
794 | ((void *)0) | - | ||||||||||||||||||||||||
795 | , | - | ||||||||||||||||||||||||
796 | ((void *)0) | - | ||||||||||||||||||||||||
797 | , | - | ||||||||||||||||||||||||
798 | ((void *)0) | - | ||||||||||||||||||||||||
799 | , | - | ||||||||||||||||||||||||
800 | ((void *)0) | - | ||||||||||||||||||||||||
801 | }; const EVP_CIPHER *EVP_aes_128_ctr(void) { return executed 1964 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ctr:&aes_128_ctr; Executed by:
executed 1964 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ctr:&aes_128_ctr; Executed by:
| 0-1964 | ||||||||||||||||||||||||
802 | static const EVP_CIPHER aesni_192_cbc = { 423,16,192/8,16, 0|0x1000|0x2, aesni_init_key, aesni_cbc_cipher, | - | ||||||||||||||||||||||||
803 | ((void *)0) | - | ||||||||||||||||||||||||
804 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
805 | ((void *)0) | - | ||||||||||||||||||||||||
806 | , | - | ||||||||||||||||||||||||
807 | ((void *)0) | - | ||||||||||||||||||||||||
808 | , | - | ||||||||||||||||||||||||
809 | ((void *)0) | - | ||||||||||||||||||||||||
810 | , | - | ||||||||||||||||||||||||
811 | ((void *)0) | - | ||||||||||||||||||||||||
812 | }; static const EVP_CIPHER aes_192_cbc = { 423,16, 192/8,16, 0|0x1000|0x2, aes_init_key, aes_cbc_cipher, | - | ||||||||||||||||||||||||
813 | ((void *)0) | - | ||||||||||||||||||||||||
814 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
815 | ((void *)0) | - | ||||||||||||||||||||||||
816 | , | - | ||||||||||||||||||||||||
817 | ((void *)0) | - | ||||||||||||||||||||||||
818 | , | - | ||||||||||||||||||||||||
819 | ((void *)0) | - | ||||||||||||||||||||||||
820 | , | - | ||||||||||||||||||||||||
821 | ((void *)0) | - | ||||||||||||||||||||||||
822 | }; const EVP_CIPHER *EVP_aes_192_cbc(void) { return executed 3921 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cbc:&aes_192_cbc; Executed by:
executed 3921 times by 1 test: } static const EVP_CIPHER aesni_192_ecb = { 422,16,192/8,0, 0|0x1000|0x1, aesni_init_key, aesni_ecb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cbc:&aes_192_cbc; Executed by:
| 0-3921 | ||||||||||||||||||||||||
823 | ((void *)0) | - | ||||||||||||||||||||||||
824 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
825 | ((void *)0) | - | ||||||||||||||||||||||||
826 | , | - | ||||||||||||||||||||||||
827 | ((void *)0) | - | ||||||||||||||||||||||||
828 | , | - | ||||||||||||||||||||||||
829 | ((void *)0) | - | ||||||||||||||||||||||||
830 | , | - | ||||||||||||||||||||||||
831 | ((void *)0) | - | ||||||||||||||||||||||||
832 | }; static const EVP_CIPHER aes_192_ecb = { 422,16, 192/8,0, 0|0x1000|0x1, aes_init_key, aes_ecb_cipher, | - | ||||||||||||||||||||||||
833 | ((void *)0) | - | ||||||||||||||||||||||||
834 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
835 | ((void *)0) | - | ||||||||||||||||||||||||
836 | , | - | ||||||||||||||||||||||||
837 | ((void *)0) | - | ||||||||||||||||||||||||
838 | , | - | ||||||||||||||||||||||||
839 | ((void *)0) | - | ||||||||||||||||||||||||
840 | , | - | ||||||||||||||||||||||||
841 | ((void *)0) | - | ||||||||||||||||||||||||
842 | }; const EVP_CIPHER *EVP_aes_192_ecb(void) { return executed 6294 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ecb:&aes_192_ecb; Executed by:
executed 6294 times by 1 test: } static const EVP_CIPHER aesni_192_ofb = { 424,1,192/8,16, 0|0x1000|0x4, aesni_init_key, aes_ofb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ecb:&aes_192_ecb; Executed by:
| 0-6294 | ||||||||||||||||||||||||
843 | ((void *)0) | - | ||||||||||||||||||||||||
844 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
845 | ((void *)0) | - | ||||||||||||||||||||||||
846 | , | - | ||||||||||||||||||||||||
847 | ((void *)0) | - | ||||||||||||||||||||||||
848 | , | - | ||||||||||||||||||||||||
849 | ((void *)0) | - | ||||||||||||||||||||||||
850 | , | - | ||||||||||||||||||||||||
851 | ((void *)0) | - | ||||||||||||||||||||||||
852 | }; static const EVP_CIPHER aes_192_ofb = { 424,1, 192/8,16, 0|0x1000|0x4, aes_init_key, aes_ofb_cipher, | - | ||||||||||||||||||||||||
853 | ((void *)0) | - | ||||||||||||||||||||||||
854 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
855 | ((void *)0) | - | ||||||||||||||||||||||||
856 | , | - | ||||||||||||||||||||||||
857 | ((void *)0) | - | ||||||||||||||||||||||||
858 | , | - | ||||||||||||||||||||||||
859 | ((void *)0) | - | ||||||||||||||||||||||||
860 | , | - | ||||||||||||||||||||||||
861 | ((void *)0) | - | ||||||||||||||||||||||||
862 | }; const EVP_CIPHER *EVP_aes_192_ofb(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ofb:&aes_192_ofb; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_192_cfb = { 425,1,192/8,16, 0|0x1000|0x3, aesni_init_key, aes_cfb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ofb:&aes_192_ofb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
863 | ((void *)0) | - | ||||||||||||||||||||||||
864 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
865 | ((void *)0) | - | ||||||||||||||||||||||||
866 | , | - | ||||||||||||||||||||||||
867 | ((void *)0) | - | ||||||||||||||||||||||||
868 | , | - | ||||||||||||||||||||||||
869 | ((void *)0) | - | ||||||||||||||||||||||||
870 | , | - | ||||||||||||||||||||||||
871 | ((void *)0) | - | ||||||||||||||||||||||||
872 | }; static const EVP_CIPHER aes_192_cfb = { 425,1, 192/8,16, 0|0x1000|0x3, aes_init_key, aes_cfb_cipher, | - | ||||||||||||||||||||||||
873 | ((void *)0) | - | ||||||||||||||||||||||||
874 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
875 | ((void *)0) | - | ||||||||||||||||||||||||
876 | , | - | ||||||||||||||||||||||||
877 | ((void *)0) | - | ||||||||||||||||||||||||
878 | , | - | ||||||||||||||||||||||||
879 | ((void *)0) | - | ||||||||||||||||||||||||
880 | , | - | ||||||||||||||||||||||||
881 | ((void *)0) | - | ||||||||||||||||||||||||
882 | }; const EVP_CIPHER *EVP_aes_192_cfb128(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cfb:&aes_192_cfb; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_192_cfb1 = { 651,1,192/8,16, 0|0x3, aesni_init_key, aes_cfb1_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cfb:&aes_192_cfb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
883 | ((void *)0) | - | ||||||||||||||||||||||||
884 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
885 | ((void *)0) | - | ||||||||||||||||||||||||
886 | , | - | ||||||||||||||||||||||||
887 | ((void *)0) | - | ||||||||||||||||||||||||
888 | , | - | ||||||||||||||||||||||||
889 | ((void *)0) | - | ||||||||||||||||||||||||
890 | , | - | ||||||||||||||||||||||||
891 | ((void *)0) | - | ||||||||||||||||||||||||
892 | }; static const EVP_CIPHER aes_192_cfb1 = { 651,1, 192/8,16, 0|0x3, aes_init_key, aes_cfb1_cipher, | - | ||||||||||||||||||||||||
893 | ((void *)0) | - | ||||||||||||||||||||||||
894 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
895 | ((void *)0) | - | ||||||||||||||||||||||||
896 | , | - | ||||||||||||||||||||||||
897 | ((void *)0) | - | ||||||||||||||||||||||||
898 | , | - | ||||||||||||||||||||||||
899 | ((void *)0) | - | ||||||||||||||||||||||||
900 | , | - | ||||||||||||||||||||||||
901 | ((void *)0) | - | ||||||||||||||||||||||||
902 | }; const EVP_CIPHER *EVP_aes_192_cfb1(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cfb1:&aes_192_cfb1; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_192_cfb8 = { 654,1,192/8,16, 0|0x3, aesni_init_key, aes_cfb8_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cfb1:&aes_192_cfb1; Executed by:
| 0-1962 | ||||||||||||||||||||||||
903 | ((void *)0) | - | ||||||||||||||||||||||||
904 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
905 | ((void *)0) | - | ||||||||||||||||||||||||
906 | , | - | ||||||||||||||||||||||||
907 | ((void *)0) | - | ||||||||||||||||||||||||
908 | , | - | ||||||||||||||||||||||||
909 | ((void *)0) | - | ||||||||||||||||||||||||
910 | , | - | ||||||||||||||||||||||||
911 | ((void *)0) | - | ||||||||||||||||||||||||
912 | }; static const EVP_CIPHER aes_192_cfb8 = { 654,1, 192/8,16, 0|0x3, aes_init_key, aes_cfb8_cipher, | - | ||||||||||||||||||||||||
913 | ((void *)0) | - | ||||||||||||||||||||||||
914 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
915 | ((void *)0) | - | ||||||||||||||||||||||||
916 | , | - | ||||||||||||||||||||||||
917 | ((void *)0) | - | ||||||||||||||||||||||||
918 | , | - | ||||||||||||||||||||||||
919 | ((void *)0) | - | ||||||||||||||||||||||||
920 | , | - | ||||||||||||||||||||||||
921 | ((void *)0) | - | ||||||||||||||||||||||||
922 | }; const EVP_CIPHER *EVP_aes_192_cfb8(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cfb8:&aes_192_cfb8; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_192_ctr = { 905,1,192/8,16, 0|0x5, aesni_init_key, aes_ctr_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_cfb8:&aes_192_cfb8; Executed by:
| 0-1962 | ||||||||||||||||||||||||
923 | ((void *)0) | - | ||||||||||||||||||||||||
924 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
925 | ((void *)0) | - | ||||||||||||||||||||||||
926 | , | - | ||||||||||||||||||||||||
927 | ((void *)0) | - | ||||||||||||||||||||||||
928 | , | - | ||||||||||||||||||||||||
929 | ((void *)0) | - | ||||||||||||||||||||||||
930 | , | - | ||||||||||||||||||||||||
931 | ((void *)0) | - | ||||||||||||||||||||||||
932 | }; static const EVP_CIPHER aes_192_ctr = { 905,1, 192/8,16, 0|0x5, aes_init_key, aes_ctr_cipher, | - | ||||||||||||||||||||||||
933 | ((void *)0) | - | ||||||||||||||||||||||||
934 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
935 | ((void *)0) | - | ||||||||||||||||||||||||
936 | , | - | ||||||||||||||||||||||||
937 | ((void *)0) | - | ||||||||||||||||||||||||
938 | , | - | ||||||||||||||||||||||||
939 | ((void *)0) | - | ||||||||||||||||||||||||
940 | , | - | ||||||||||||||||||||||||
941 | ((void *)0) | - | ||||||||||||||||||||||||
942 | }; const EVP_CIPHER *EVP_aes_192_ctr(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ctr:&aes_192_ctr; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ctr:&aes_192_ctr; Executed by:
| 0-1962 | ||||||||||||||||||||||||
943 | static const EVP_CIPHER aesni_256_cbc = { 427,16,256/8,16, 0|0x1000|0x2, aesni_init_key, aesni_cbc_cipher, | - | ||||||||||||||||||||||||
944 | ((void *)0) | - | ||||||||||||||||||||||||
945 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
946 | ((void *)0) | - | ||||||||||||||||||||||||
947 | , | - | ||||||||||||||||||||||||
948 | ((void *)0) | - | ||||||||||||||||||||||||
949 | , | - | ||||||||||||||||||||||||
950 | ((void *)0) | - | ||||||||||||||||||||||||
951 | , | - | ||||||||||||||||||||||||
952 | ((void *)0) | - | ||||||||||||||||||||||||
953 | }; static const EVP_CIPHER aes_256_cbc = { 427,16, 256/8,16, 0|0x1000|0x2, aes_init_key, aes_cbc_cipher, | - | ||||||||||||||||||||||||
954 | ((void *)0) | - | ||||||||||||||||||||||||
955 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
956 | ((void *)0) | - | ||||||||||||||||||||||||
957 | , | - | ||||||||||||||||||||||||
958 | ((void *)0) | - | ||||||||||||||||||||||||
959 | , | - | ||||||||||||||||||||||||
960 | ((void *)0) | - | ||||||||||||||||||||||||
961 | , | - | ||||||||||||||||||||||||
962 | ((void *)0) | - | ||||||||||||||||||||||||
963 | }; const EVP_CIPHER *EVP_aes_256_cbc(void) { return executed 5881 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cbc:&aes_256_cbc; Executed by:
executed 5881 times by 1 test: } static const EVP_CIPHER aesni_256_ecb = { 426,16,256/8,0, 0|0x1000|0x1, aesni_init_key, aesni_ecb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cbc:&aes_256_cbc; Executed by:
| 0-5881 | ||||||||||||||||||||||||
964 | ((void *)0) | - | ||||||||||||||||||||||||
965 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
966 | ((void *)0) | - | ||||||||||||||||||||||||
967 | , | - | ||||||||||||||||||||||||
968 | ((void *)0) | - | ||||||||||||||||||||||||
969 | , | - | ||||||||||||||||||||||||
970 | ((void *)0) | - | ||||||||||||||||||||||||
971 | , | - | ||||||||||||||||||||||||
972 | ((void *)0) | - | ||||||||||||||||||||||||
973 | }; static const EVP_CIPHER aes_256_ecb = { 426,16, 256/8,0, 0|0x1000|0x1, aes_init_key, aes_ecb_cipher, | - | ||||||||||||||||||||||||
974 | ((void *)0) | - | ||||||||||||||||||||||||
975 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
976 | ((void *)0) | - | ||||||||||||||||||||||||
977 | , | - | ||||||||||||||||||||||||
978 | ((void *)0) | - | ||||||||||||||||||||||||
979 | , | - | ||||||||||||||||||||||||
980 | ((void *)0) | - | ||||||||||||||||||||||||
981 | , | - | ||||||||||||||||||||||||
982 | ((void *)0) | - | ||||||||||||||||||||||||
983 | }; const EVP_CIPHER *EVP_aes_256_ecb(void) { return executed 8095 times by 2 tests: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ecb:&aes_256_ecb; Executed by:
executed 8095 times by 2 tests: } static const EVP_CIPHER aesni_256_ofb = { 428,1,256/8,16, 0|0x1000|0x4, aesni_init_key, aes_ofb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ecb:&aes_256_ecb; Executed by:
| 0-8095 | ||||||||||||||||||||||||
984 | ((void *)0) | - | ||||||||||||||||||||||||
985 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
986 | ((void *)0) | - | ||||||||||||||||||||||||
987 | , | - | ||||||||||||||||||||||||
988 | ((void *)0) | - | ||||||||||||||||||||||||
989 | , | - | ||||||||||||||||||||||||
990 | ((void *)0) | - | ||||||||||||||||||||||||
991 | , | - | ||||||||||||||||||||||||
992 | ((void *)0) | - | ||||||||||||||||||||||||
993 | }; static const EVP_CIPHER aes_256_ofb = { 428,1, 256/8,16, 0|0x1000|0x4, aes_init_key, aes_ofb_cipher, | - | ||||||||||||||||||||||||
994 | ((void *)0) | - | ||||||||||||||||||||||||
995 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
996 | ((void *)0) | - | ||||||||||||||||||||||||
997 | , | - | ||||||||||||||||||||||||
998 | ((void *)0) | - | ||||||||||||||||||||||||
999 | , | - | ||||||||||||||||||||||||
1000 | ((void *)0) | - | ||||||||||||||||||||||||
1001 | , | - | ||||||||||||||||||||||||
1002 | ((void *)0) | - | ||||||||||||||||||||||||
1003 | }; const EVP_CIPHER *EVP_aes_256_ofb(void) { return executed 1964 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ofb:&aes_256_ofb; Executed by:
executed 1964 times by 1 test: } static const EVP_CIPHER aesni_256_cfb = { 429,1,256/8,16, 0|0x1000|0x3, aesni_init_key, aes_cfb_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ofb:&aes_256_ofb; Executed by:
| 0-1964 | ||||||||||||||||||||||||
1004 | ((void *)0) | - | ||||||||||||||||||||||||
1005 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1006 | ((void *)0) | - | ||||||||||||||||||||||||
1007 | , | - | ||||||||||||||||||||||||
1008 | ((void *)0) | - | ||||||||||||||||||||||||
1009 | , | - | ||||||||||||||||||||||||
1010 | ((void *)0) | - | ||||||||||||||||||||||||
1011 | , | - | ||||||||||||||||||||||||
1012 | ((void *)0) | - | ||||||||||||||||||||||||
1013 | }; static const EVP_CIPHER aes_256_cfb = { 429,1, 256/8,16, 0|0x1000|0x3, aes_init_key, aes_cfb_cipher, | - | ||||||||||||||||||||||||
1014 | ((void *)0) | - | ||||||||||||||||||||||||
1015 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1016 | ((void *)0) | - | ||||||||||||||||||||||||
1017 | , | - | ||||||||||||||||||||||||
1018 | ((void *)0) | - | ||||||||||||||||||||||||
1019 | , | - | ||||||||||||||||||||||||
1020 | ((void *)0) | - | ||||||||||||||||||||||||
1021 | , | - | ||||||||||||||||||||||||
1022 | ((void *)0) | - | ||||||||||||||||||||||||
1023 | }; const EVP_CIPHER *EVP_aes_256_cfb128(void) { return executed 1964 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cfb:&aes_256_cfb; Executed by:
executed 1964 times by 1 test: } static const EVP_CIPHER aesni_256_cfb1 = { 652,1,256/8,16, 0|0x3, aesni_init_key, aes_cfb1_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cfb:&aes_256_cfb; Executed by:
| 0-1964 | ||||||||||||||||||||||||
1024 | ((void *)0) | - | ||||||||||||||||||||||||
1025 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1026 | ((void *)0) | - | ||||||||||||||||||||||||
1027 | , | - | ||||||||||||||||||||||||
1028 | ((void *)0) | - | ||||||||||||||||||||||||
1029 | , | - | ||||||||||||||||||||||||
1030 | ((void *)0) | - | ||||||||||||||||||||||||
1031 | , | - | ||||||||||||||||||||||||
1032 | ((void *)0) | - | ||||||||||||||||||||||||
1033 | }; static const EVP_CIPHER aes_256_cfb1 = { 652,1, 256/8,16, 0|0x3, aes_init_key, aes_cfb1_cipher, | - | ||||||||||||||||||||||||
1034 | ((void *)0) | - | ||||||||||||||||||||||||
1035 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1036 | ((void *)0) | - | ||||||||||||||||||||||||
1037 | , | - | ||||||||||||||||||||||||
1038 | ((void *)0) | - | ||||||||||||||||||||||||
1039 | , | - | ||||||||||||||||||||||||
1040 | ((void *)0) | - | ||||||||||||||||||||||||
1041 | , | - | ||||||||||||||||||||||||
1042 | ((void *)0) | - | ||||||||||||||||||||||||
1043 | }; const EVP_CIPHER *EVP_aes_256_cfb1(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cfb1:&aes_256_cfb1; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_256_cfb8 = { 655,1,256/8,16, 0|0x3, aesni_init_key, aes_cfb8_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cfb1:&aes_256_cfb1; Executed by:
| 0-1962 | ||||||||||||||||||||||||
1044 | ((void *)0) | - | ||||||||||||||||||||||||
1045 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1046 | ((void *)0) | - | ||||||||||||||||||||||||
1047 | , | - | ||||||||||||||||||||||||
1048 | ((void *)0) | - | ||||||||||||||||||||||||
1049 | , | - | ||||||||||||||||||||||||
1050 | ((void *)0) | - | ||||||||||||||||||||||||
1051 | , | - | ||||||||||||||||||||||||
1052 | ((void *)0) | - | ||||||||||||||||||||||||
1053 | }; static const EVP_CIPHER aes_256_cfb8 = { 655,1, 256/8,16, 0|0x3, aes_init_key, aes_cfb8_cipher, | - | ||||||||||||||||||||||||
1054 | ((void *)0) | - | ||||||||||||||||||||||||
1055 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1056 | ((void *)0) | - | ||||||||||||||||||||||||
1057 | , | - | ||||||||||||||||||||||||
1058 | ((void *)0) | - | ||||||||||||||||||||||||
1059 | , | - | ||||||||||||||||||||||||
1060 | ((void *)0) | - | ||||||||||||||||||||||||
1061 | , | - | ||||||||||||||||||||||||
1062 | ((void *)0) | - | ||||||||||||||||||||||||
1063 | }; const EVP_CIPHER *EVP_aes_256_cfb8(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cfb8:&aes_256_cfb8; Executed by:
executed 1962 times by 1 test: } static const EVP_CIPHER aesni_256_ctr = { 906,1,256/8,16, 0|0x5, aesni_init_key, aes_ctr_cipher, return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_cfb8:&aes_256_cfb8; Executed by:
| 0-1962 | ||||||||||||||||||||||||
1064 | ((void *)0) | - | ||||||||||||||||||||||||
1065 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1066 | ((void *)0) | - | ||||||||||||||||||||||||
1067 | , | - | ||||||||||||||||||||||||
1068 | ((void *)0) | - | ||||||||||||||||||||||||
1069 | , | - | ||||||||||||||||||||||||
1070 | ((void *)0) | - | ||||||||||||||||||||||||
1071 | , | - | ||||||||||||||||||||||||
1072 | ((void *)0) | - | ||||||||||||||||||||||||
1073 | }; static const EVP_CIPHER aes_256_ctr = { 906,1, 256/8,16, 0|0x5, aes_init_key, aes_ctr_cipher, | - | ||||||||||||||||||||||||
1074 | ((void *)0) | - | ||||||||||||||||||||||||
1075 | , sizeof(EVP_AES_KEY), | - | ||||||||||||||||||||||||
1076 | ((void *)0) | - | ||||||||||||||||||||||||
1077 | , | - | ||||||||||||||||||||||||
1078 | ((void *)0) | - | ||||||||||||||||||||||||
1079 | , | - | ||||||||||||||||||||||||
1080 | ((void *)0) | - | ||||||||||||||||||||||||
1081 | , | - | ||||||||||||||||||||||||
1082 | ((void *)0) | - | ||||||||||||||||||||||||
1083 | }; const EVP_CIPHER *EVP_aes_256_ctr(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ctr:&aes_256_ctr; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ctr:&aes_256_ctr; Executed by:
| 0-1962 | ||||||||||||||||||||||||
1084 | - | |||||||||||||||||||||||||
1085 | static int aes_gcm_cleanup(EVP_CIPHER_CTX *c) | - | ||||||||||||||||||||||||
1086 | { | - | ||||||||||||||||||||||||
1087 | EVP_AES_GCM_CTX *gctx = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(c)); | - | ||||||||||||||||||||||||
1088 | if (gctx ==
| 0-7313 | ||||||||||||||||||||||||
1089 | ((void *)0)
| 0-7313 | ||||||||||||||||||||||||
1090 | ) | - | ||||||||||||||||||||||||
1091 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1092 | OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm)); | - | ||||||||||||||||||||||||
1093 | if (gctx->iv != EVP_CIPHER_CTX_iv_noconst(c)
| 147-7166 | ||||||||||||||||||||||||
1094 | CRYPTO_free(gctx->iv, __FILE__, 2822); executed 147 times by 1 test: CRYPTO_free(gctx->iv, __FILE__, 2822); Executed by:
| 147 | ||||||||||||||||||||||||
1095 | return executed 7313 times by 1 test: 1;return 1; Executed by:
executed 7313 times by 1 test: return 1; Executed by:
| 7313 | ||||||||||||||||||||||||
1096 | } | - | ||||||||||||||||||||||||
1097 | - | |||||||||||||||||||||||||
1098 | static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | - | ||||||||||||||||||||||||
1099 | { | - | ||||||||||||||||||||||||
1100 | EVP_AES_GCM_CTX *gctx = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(c)); | - | ||||||||||||||||||||||||
1101 | switch (type) { | - | ||||||||||||||||||||||||
1102 | case executed 7763 times by 1 test: 0x0:case 0x0: Executed by:
executed 7763 times by 1 test: case 0x0: Executed by:
| 7763 | ||||||||||||||||||||||||
1103 | gctx->key_set = 0; | - | ||||||||||||||||||||||||
1104 | gctx->iv_set = 0; | - | ||||||||||||||||||||||||
1105 | gctx->ivlen = c->cipher->iv_len; | - | ||||||||||||||||||||||||
1106 | gctx->iv = c->iv; | - | ||||||||||||||||||||||||
1107 | gctx->taglen = -1; | - | ||||||||||||||||||||||||
1108 | gctx->iv_gen = 0; | - | ||||||||||||||||||||||||
1109 | gctx->tls_aad_len = -1; | - | ||||||||||||||||||||||||
1110 | return executed 7763 times by 1 test: 1;return 1; Executed by:
executed 7763 times by 1 test: return 1; Executed by:
| 7763 | ||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||
1112 | case executed 5838 times by 1 test: 0x9:case 0x9: Executed by:
executed 5838 times by 1 test: case 0x9: Executed by:
| 5838 | ||||||||||||||||||||||||
1113 | if (arg <= 0
| 0-5838 | ||||||||||||||||||||||||
1114 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1115 | - | |||||||||||||||||||||||||
1116 | if ((
| 0-5691 | ||||||||||||||||||||||||
1117 | if (gctx->iv != c->iv
| 0-147 | ||||||||||||||||||||||||
1118 | CRYPTO_free(gctx->iv, __FILE__, 2846); never executed: CRYPTO_free(gctx->iv, __FILE__, 2846); | 0 | ||||||||||||||||||||||||
1119 | if ((
| 0-147 | ||||||||||||||||||||||||
1120 | ((void *)0)
| 0-147 | ||||||||||||||||||||||||
1121 | ) { | - | ||||||||||||||||||||||||
1122 | ERR_put_error(6,(196),((1|64)),__FILE__,2848); | - | ||||||||||||||||||||||||
1123 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1124 | } | - | ||||||||||||||||||||||||
1125 | } executed 147 times by 1 test: end of block Executed by:
| 147 | ||||||||||||||||||||||||
1126 | gctx->ivlen = arg; | - | ||||||||||||||||||||||||
1127 | return executed 5838 times by 1 test: 1;return 1; Executed by:
executed 5838 times by 1 test: return 1; Executed by:
| 5838 | ||||||||||||||||||||||||
1128 | - | |||||||||||||||||||||||||
1129 | case executed 13652 times by 1 test: 0x11:case 0x11: Executed by:
executed 13652 times by 1 test: case 0x11: Executed by:
| 13652 | ||||||||||||||||||||||||
1130 | if (arg <= 0
| 0-13652 | ||||||||||||||||||||||||
1131 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1132 | memcpy(c->buf, ptr, arg); | - | ||||||||||||||||||||||||
1133 | gctx->taglen = arg; | - | ||||||||||||||||||||||||
1134 | return executed 13652 times by 1 test: 1;return 1; Executed by:
executed 13652 times by 1 test: return 1; Executed by:
| 13652 | ||||||||||||||||||||||||
1135 | - | |||||||||||||||||||||||||
1136 | case executed 12236 times by 1 test: 0x10:case 0x10: Executed by:
executed 12236 times by 1 test: case 0x10: Executed by:
| 12236 | ||||||||||||||||||||||||
1137 | if (arg <= 0
| 0-12236 | ||||||||||||||||||||||||
1138 | || gctx->taglen < 0
| 0-12236 | ||||||||||||||||||||||||
1139 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1140 | memcpy(ptr, c->buf, arg); | - | ||||||||||||||||||||||||
1141 | return executed 12236 times by 1 test: 1;return 1; Executed by:
executed 12236 times by 1 test: return 1; Executed by:
| 12236 | ||||||||||||||||||||||||
1142 | - | |||||||||||||||||||||||||
1143 | case executed 1911 times by 1 test: 0x12:case 0x12: Executed by:
executed 1911 times by 1 test: case 0x12: Executed by:
| 1911 | ||||||||||||||||||||||||
1144 | - | |||||||||||||||||||||||||
1145 | if (arg == -1
| 0-1911 | ||||||||||||||||||||||||
1146 | memcpy(gctx->iv, ptr, gctx->ivlen); | - | ||||||||||||||||||||||||
1147 | gctx->iv_gen = 1; | - | ||||||||||||||||||||||||
1148 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
1149 | } | - | ||||||||||||||||||||||||
1150 | - | |||||||||||||||||||||||||
1151 | - | |||||||||||||||||||||||||
1152 | - | |||||||||||||||||||||||||
1153 | - | |||||||||||||||||||||||||
1154 | if ((
| 0-1911 | ||||||||||||||||||||||||
1155 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1156 | if (arg
| 0-1911 | ||||||||||||||||||||||||
1157 | memcpy(gctx->iv, ptr, arg); executed 1911 times by 1 test: memcpy(gctx->iv, ptr, arg); Executed by:
| 1911 | ||||||||||||||||||||||||
1158 | if (c->encrypt
| 0-959 | ||||||||||||||||||||||||
1159 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1160 | gctx->iv_gen = 1; | - | ||||||||||||||||||||||||
1161 | return executed 1911 times by 1 test: 1;return 1; Executed by:
executed 1911 times by 1 test: return 1; Executed by:
| 1911 | ||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||
1163 | case executed 2743 times by 1 test: 0x13:case 0x13: Executed by:
executed 2743 times by 1 test: case 0x13: Executed by:
| 2743 | ||||||||||||||||||||||||
1164 | if (gctx->iv_gen == 0
| 0-2743 | ||||||||||||||||||||||||
1165 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1166 | CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen); | - | ||||||||||||||||||||||||
1167 | if (arg <= 0
| 0-2743 | ||||||||||||||||||||||||
1168 | arg = gctx->ivlen; never executed: arg = gctx->ivlen; | 0 | ||||||||||||||||||||||||
1169 | memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg); | - | ||||||||||||||||||||||||
1170 | - | |||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||
1172 | - | |||||||||||||||||||||||||
1173 | - | |||||||||||||||||||||||||
1174 | ctr64_inc(gctx->iv + gctx->ivlen - 8); | - | ||||||||||||||||||||||||
1175 | gctx->iv_set = 1; | - | ||||||||||||||||||||||||
1176 | return executed 2743 times by 1 test: 1;return 1; Executed by:
executed 2743 times by 1 test: return 1; Executed by:
| 2743 | ||||||||||||||||||||||||
1177 | - | |||||||||||||||||||||||||
1178 | case executed 2577 times by 1 test: 0x18:case 0x18: Executed by:
executed 2577 times by 1 test: case 0x18: Executed by:
| 2577 | ||||||||||||||||||||||||
1179 | if (gctx->iv_gen == 0
| 0-2577 | ||||||||||||||||||||||||
1180 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1181 | memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg); | - | ||||||||||||||||||||||||
1182 | CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen); | - | ||||||||||||||||||||||||
1183 | gctx->iv_set = 1; | - | ||||||||||||||||||||||||
1184 | return executed 2577 times by 1 test: 1;return 1; Executed by:
executed 2577 times by 1 test: return 1; Executed by:
| 2577 | ||||||||||||||||||||||||
1185 | - | |||||||||||||||||||||||||
1186 | case executed 5324 times by 1 test: 0x16:case 0x16: Executed by:
executed 5324 times by 1 test: case 0x16: Executed by:
| 5324 | ||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||
1188 | if (arg != 13
| 0-5324 | ||||||||||||||||||||||||
1189 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1190 | memcpy(c->buf, ptr, arg); | - | ||||||||||||||||||||||||
1191 | gctx->tls_aad_len = arg; | - | ||||||||||||||||||||||||
1192 | gctx->tls_enc_records = 0; | - | ||||||||||||||||||||||||
1193 | { | - | ||||||||||||||||||||||||
1194 | unsigned int len = c->buf[arg - 2] << 8 | c->buf[arg - 1]; | - | ||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||
1196 | if (len < 8
| 2-5322 | ||||||||||||||||||||||||
1197 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
1198 | len -= 8; | - | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | if (!c->encrypt
| 2579-2743 | ||||||||||||||||||||||||
1201 | if (len < 16
| 2-2577 | ||||||||||||||||||||||||
1202 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
1203 | len -= 16; | - | ||||||||||||||||||||||||
1204 | } executed 2577 times by 1 test: end of block Executed by:
| 2577 | ||||||||||||||||||||||||
1205 | c->buf[arg - 2] = len >> 8; | - | ||||||||||||||||||||||||
1206 | c->buf[arg - 1] = len & 0xff; | - | ||||||||||||||||||||||||
1207 | } | - | ||||||||||||||||||||||||
1208 | - | |||||||||||||||||||||||||
1209 | return executed 5320 times by 1 test: 16;return 16; Executed by:
executed 5320 times by 1 test: return 16; Executed by:
| 5320 | ||||||||||||||||||||||||
1210 | - | |||||||||||||||||||||||||
1211 | case never executed: 0x8:case 0x8: never executed: case 0x8: | 0 | ||||||||||||||||||||||||
1212 | { | - | ||||||||||||||||||||||||
1213 | EVP_CIPHER_CTX *out = ptr; | - | ||||||||||||||||||||||||
1214 | EVP_AES_GCM_CTX *gctx_out = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(out)); | - | ||||||||||||||||||||||||
1215 | if (gctx->gcm.key
| 0 | ||||||||||||||||||||||||
1216 | if (gctx->gcm.key != &gctx->ks
| 0 | ||||||||||||||||||||||||
1217 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1218 | gctx_out->gcm.key = &gctx_out->ks; | - | ||||||||||||||||||||||||
1219 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1220 | if (gctx->iv == c->iv
| 0 | ||||||||||||||||||||||||
1221 | gctx_out->iv = out->iv; never executed: gctx_out->iv = out->iv; | 0 | ||||||||||||||||||||||||
1222 | else { | - | ||||||||||||||||||||||||
1223 | if ((
| 0 | ||||||||||||||||||||||||
1224 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1225 | ) { | - | ||||||||||||||||||||||||
1226 | ERR_put_error(6,(196),((1|64)),__FILE__,2950); | - | ||||||||||||||||||||||||
1227 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1228 | } | - | ||||||||||||||||||||||||
1229 | memcpy(gctx_out->iv, gctx->iv, gctx->ivlen); | - | ||||||||||||||||||||||||
1230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1231 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
1232 | } | - | ||||||||||||||||||||||||
1233 | - | |||||||||||||||||||||||||
1234 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1235 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1236 | - | |||||||||||||||||||||||||
1237 | } | - | ||||||||||||||||||||||||
1238 | } | - | ||||||||||||||||||||||||
1239 | - | |||||||||||||||||||||||||
1240 | static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
1241 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
1242 | { | - | ||||||||||||||||||||||||
1243 | EVP_AES_GCM_CTX *gctx = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1244 | if (!iv
| 5838-25888 | ||||||||||||||||||||||||
1245 | return executed 5838 times by 1 test: 1;return 1; Executed by:
executed 5838 times by 1 test: return 1; Executed by:
| 5838 | ||||||||||||||||||||||||
1246 | if (key
| 7763-25237 | ||||||||||||||||||||||||
1247 | do { | - | ||||||||||||||||||||||||
1248 | if ((
| 0-7763 | ||||||||||||||||||||||||
1249 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks.ks); | - | ||||||||||||||||||||||||
1250 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, | - | ||||||||||||||||||||||||
1251 | (block128_f) AES_encrypt); | - | ||||||||||||||||||||||||
1252 | gctx->ctr = (ctr128_f) bsaes_ctr32_encrypt_blocks; | - | ||||||||||||||||||||||||
1253 | break; executed 7763 times by 1 test: break; Executed by:
| 7763 | ||||||||||||||||||||||||
1254 | } else | - | ||||||||||||||||||||||||
1255 | - | |||||||||||||||||||||||||
1256 | - | |||||||||||||||||||||||||
1257 | if ((
| 0 | ||||||||||||||||||||||||
1258 | vpaes_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks.ks); | - | ||||||||||||||||||||||||
1259 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, | - | ||||||||||||||||||||||||
1260 | (block128_f) vpaes_encrypt); | - | ||||||||||||||||||||||||
1261 | gctx->ctr = | - | ||||||||||||||||||||||||
1262 | ((void *)0) | - | ||||||||||||||||||||||||
1263 | ; | - | ||||||||||||||||||||||||
1264 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1265 | } else | - | ||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||
1267 | ( never executed: void)0;(void)0; never executed: (void)0; | 0 | ||||||||||||||||||||||||
1268 | - | |||||||||||||||||||||||||
1269 | AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks.ks); | - | ||||||||||||||||||||||||
1270 | CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, | - | ||||||||||||||||||||||||
1271 | (block128_f) AES_encrypt); | - | ||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||
1273 | - | |||||||||||||||||||||||||
1274 | - | |||||||||||||||||||||||||
1275 | gctx->ctr = | - | ||||||||||||||||||||||||
1276 | ((void *)0) | - | ||||||||||||||||||||||||
1277 | ; | - | ||||||||||||||||||||||||
1278 | - | |||||||||||||||||||||||||
1279 | } while (0); | - | ||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||
1281 | - | |||||||||||||||||||||||||
1282 | - | |||||||||||||||||||||||||
1283 | - | |||||||||||||||||||||||||
1284 | if (iv ==
| 651-7112 | ||||||||||||||||||||||||
1285 | ((void *)0)
| 651-7112 | ||||||||||||||||||||||||
1286 | && gctx->iv_set
| 0-7112 | ||||||||||||||||||||||||
1287 | iv = gctx->iv; never executed: iv = gctx->iv; | 0 | ||||||||||||||||||||||||
1288 | if (iv
| 651-7112 | ||||||||||||||||||||||||
1289 | CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); | - | ||||||||||||||||||||||||
1290 | gctx->iv_set = 1; | - | ||||||||||||||||||||||||
1291 | } executed 651 times by 1 test: end of block Executed by:
| 651 | ||||||||||||||||||||||||
1292 | gctx->key_set = 1; | - | ||||||||||||||||||||||||
1293 | } executed 7763 times by 1 test: else {end of block Executed by:
| 7763 | ||||||||||||||||||||||||
1294 | - | |||||||||||||||||||||||||
1295 | if (gctx->key_set
| 0-25237 | ||||||||||||||||||||||||
1296 | CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); executed 25237 times by 1 test: CRYPTO_gcm128_setiv(&gctx->gcm, iv, gctx->ivlen); Executed by:
| 25237 | ||||||||||||||||||||||||
1297 | else | - | ||||||||||||||||||||||||
1298 | memcpy(gctx->iv, iv, gctx->ivlen); never executed: memcpy(gctx->iv, iv, gctx->ivlen); | 0 | ||||||||||||||||||||||||
1299 | gctx->iv_set = 1; | - | ||||||||||||||||||||||||
1300 | gctx->iv_gen = 0; | - | ||||||||||||||||||||||||
1301 | } executed 25237 times by 1 test: end of block Executed by:
| 25237 | ||||||||||||||||||||||||
1302 | return executed 33000 times by 1 test: 1;return 1; Executed by:
executed 33000 times by 1 test: return 1; Executed by:
| 33000 | ||||||||||||||||||||||||
1303 | } | - | ||||||||||||||||||||||||
1304 | static int aes_gcm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
1305 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
1306 | { | - | ||||||||||||||||||||||||
1307 | EVP_AES_GCM_CTX *gctx = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1308 | int rv = -1; | - | ||||||||||||||||||||||||
1309 | - | |||||||||||||||||||||||||
1310 | if (out != in
| 0-5320 | ||||||||||||||||||||||||
1311 | || len < (8 + 16)
| 0-5320 | ||||||||||||||||||||||||
1312 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1313 | - | |||||||||||||||||||||||||
1314 | - | |||||||||||||||||||||||||
1315 | - | |||||||||||||||||||||||||
1316 | - | |||||||||||||||||||||||||
1317 | - | |||||||||||||||||||||||||
1318 | - | |||||||||||||||||||||||||
1319 | - | |||||||||||||||||||||||||
1320 | if (ctx->encrypt
| 0-2743 | ||||||||||||||||||||||||
1321 | ERR_put_error(6,(207),(183),__FILE__,3061); | - | ||||||||||||||||||||||||
1322 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1323 | } | - | ||||||||||||||||||||||||
1324 | - | |||||||||||||||||||||||||
1325 | - | |||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||
1327 | - | |||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||
1329 | if (EVP_CIPHER_CTX_ctrl(ctx, ctx->encrypt ? 0x13
| 0-5320 | ||||||||||||||||||||||||
1330 | : 0x18,
| 0-5320 | ||||||||||||||||||||||||
1331 | 8, out) <= 0
| 0-5320 | ||||||||||||||||||||||||
1332 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1333 | - | |||||||||||||||||||||||||
1334 | if (CRYPTO_gcm128_aad(&gctx->gcm, ctx->buf, gctx->tls_aad_len)
| 0-5320 | ||||||||||||||||||||||||
1335 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1336 | - | |||||||||||||||||||||||||
1337 | in += 8; | - | ||||||||||||||||||||||||
1338 | out += 8; | - | ||||||||||||||||||||||||
1339 | len -= 8 + 16; | - | ||||||||||||||||||||||||
1340 | if (ctx->encrypt
| 2577-2743 | ||||||||||||||||||||||||
1341 | - | |||||||||||||||||||||||||
1342 | if (gctx->ctr
| 0-2743 | ||||||||||||||||||||||||
1343 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||
1345 | if (len >= 32
| 0-1801 | ||||||||||||||||||||||||
1346 | if (CRYPTO_gcm128_encrypt(&gctx->gcm,
| 0 | ||||||||||||||||||||||||
1347 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1348 | ,
| 0 | ||||||||||||||||||||||||
1349 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1350 | , 0)
| 0 | ||||||||||||||||||||||||
1351 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1352 | - | |||||||||||||||||||||||||
1353 | bulk = aesni_gcm_encrypt(in, out, len, | - | ||||||||||||||||||||||||
1354 | gctx->gcm.key, | - | ||||||||||||||||||||||||
1355 | gctx->gcm.Yi.c, gctx->gcm.Xi.u); | - | ||||||||||||||||||||||||
1356 | gctx->gcm.len.u[1] += bulk; | - | ||||||||||||||||||||||||
1357 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1358 | - | |||||||||||||||||||||||||
1359 | if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
| 0-2743 | ||||||||||||||||||||||||
1360 | in + bulk,
| 0-2743 | ||||||||||||||||||||||||
1361 | out + bulk,
| 0-2743 | ||||||||||||||||||||||||
1362 | len - bulk, gctx->ctr)
| 0-2743 | ||||||||||||||||||||||||
1363 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1364 | } executed 2743 times by 1 test: else {end of block Executed by:
| 2743 | ||||||||||||||||||||||||
1365 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1366 | if (CRYPTO_gcm128_encrypt(&gctx->gcm,
| 0 | ||||||||||||||||||||||||
1367 | in + bulk, out + bulk, len - bulk)
| 0 | ||||||||||||||||||||||||
1368 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1369 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1370 | out += len; | - | ||||||||||||||||||||||||
1371 | - | |||||||||||||||||||||||||
1372 | CRYPTO_gcm128_tag(&gctx->gcm, out, 16); | - | ||||||||||||||||||||||||
1373 | rv = len + 8 + 16; | - | ||||||||||||||||||||||||
1374 | } executed 2743 times by 1 test: else {end of block Executed by:
| 2743 | ||||||||||||||||||||||||
1375 | - | |||||||||||||||||||||||||
1376 | if (gctx->ctr
| 0-2577 | ||||||||||||||||||||||||
1377 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1378 | - | |||||||||||||||||||||||||
1379 | if (len >= 16
| 0-1830 | ||||||||||||||||||||||||
1380 | if (CRYPTO_gcm128_decrypt(&gctx->gcm,
| 0 | ||||||||||||||||||||||||
1381 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1382 | ,
| 0 | ||||||||||||||||||||||||
1383 | ((void *)0)
| 0 | ||||||||||||||||||||||||
1384 | , 0)
| 0 | ||||||||||||||||||||||||
1385 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||
1387 | bulk = aesni_gcm_decrypt(in, out, len, | - | ||||||||||||||||||||||||
1388 | gctx->gcm.key, | - | ||||||||||||||||||||||||
1389 | gctx->gcm.Yi.c, gctx->gcm.Xi.u); | - | ||||||||||||||||||||||||
1390 | gctx->gcm.len.u[1] += bulk; | - | ||||||||||||||||||||||||
1391 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1392 | - | |||||||||||||||||||||||||
1393 | if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
| 0-2577 | ||||||||||||||||||||||||
1394 | in + bulk,
| 0-2577 | ||||||||||||||||||||||||
1395 | out + bulk,
| 0-2577 | ||||||||||||||||||||||||
1396 | len - bulk, gctx->ctr)
| 0-2577 | ||||||||||||||||||||||||
1397 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1398 | } executed 2577 times by 1 test: else {end of block Executed by:
| 2577 | ||||||||||||||||||||||||
1399 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1400 | if (CRYPTO_gcm128_decrypt(&gctx->gcm,
| 0 | ||||||||||||||||||||||||
1401 | in + bulk, out + bulk, len - bulk)
| 0 | ||||||||||||||||||||||||
1402 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
1403 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1404 | - | |||||||||||||||||||||||||
1405 | CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, 16); | - | ||||||||||||||||||||||||
1406 | - | |||||||||||||||||||||||||
1407 | if (CRYPTO_memcmp(ctx->buf, in + len, 16)
| 27-2550 | ||||||||||||||||||||||||
1408 | OPENSSL_cleanse(out, len); | - | ||||||||||||||||||||||||
1409 | goto executed 27 times by 1 test: err;goto err; Executed by:
executed 27 times by 1 test: goto err; Executed by:
| 27 | ||||||||||||||||||||||||
1410 | } | - | ||||||||||||||||||||||||
1411 | rv = len; | - | ||||||||||||||||||||||||
1412 | } executed 2550 times by 1 test: end of block Executed by:
| 2550 | ||||||||||||||||||||||||
1413 | - | |||||||||||||||||||||||||
1414 | err: code before this statement executed 5293 times by 1 test: err: Executed by:
| 5293 | ||||||||||||||||||||||||
1415 | gctx->iv_set = 0; | - | ||||||||||||||||||||||||
1416 | gctx->tls_aad_len = -1; | - | ||||||||||||||||||||||||
1417 | return executed 5320 times by 1 test: rv;return rv; Executed by:
executed 5320 times by 1 test: return rv; Executed by:
| 5320 | ||||||||||||||||||||||||
1418 | } | - | ||||||||||||||||||||||||
1419 | - | |||||||||||||||||||||||||
1420 | static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
1421 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
1422 | { | - | ||||||||||||||||||||||||
1423 | EVP_AES_GCM_CTX *gctx = ((EVP_AES_GCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1424 | - | |||||||||||||||||||||||||
1425 | if (!gctx->key_set
| 0-83560 | ||||||||||||||||||||||||
1426 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1427 | - | |||||||||||||||||||||||||
1428 | if (gctx->tls_aad_len >= 0
| 5320-78240 | ||||||||||||||||||||||||
1429 | return executed 5320 times by 1 test: aes_gcm_tls_cipher(ctx, out, in, len);return aes_gcm_tls_cipher(ctx, out, in, len); Executed by:
executed 5320 times by 1 test: return aes_gcm_tls_cipher(ctx, out, in, len); Executed by:
| 5320 | ||||||||||||||||||||||||
1430 | - | |||||||||||||||||||||||||
1431 | if (!gctx->iv_set
| 0-78240 | ||||||||||||||||||||||||
1432 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1433 | if (in
| 25888-52352 | ||||||||||||||||||||||||
1434 | if (out ==
| 25960-26392 | ||||||||||||||||||||||||
1435 | ((void *)0)
| 25960-26392 | ||||||||||||||||||||||||
1436 | ) { | - | ||||||||||||||||||||||||
1437 | if (CRYPTO_gcm128_aad(&gctx->gcm, in, len)
| 0-25960 | ||||||||||||||||||||||||
1438 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1439 | } executed 25960 times by 1 test: else if (ctx->encryptend of block Executed by:
| 12488-25960 | ||||||||||||||||||||||||
1440 | if (gctx->ctr
| 0-12488 | ||||||||||||||||||||||||
1441 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||
1443 | if (len >= 32
| 0-10213 | ||||||||||||||||||||||||
1444 | size_t res = (16 - gctx->gcm.mres) % 16; | - | ||||||||||||||||||||||||
1445 | - | |||||||||||||||||||||||||
1446 | if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, res)
| 0 | ||||||||||||||||||||||||
1447 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1448 | - | |||||||||||||||||||||||||
1449 | bulk = aesni_gcm_encrypt(in + res, | - | ||||||||||||||||||||||||
1450 | out + res, len - res, | - | ||||||||||||||||||||||||
1451 | gctx->gcm.key, gctx->gcm.Yi.c, | - | ||||||||||||||||||||||||
1452 | gctx->gcm.Xi.u); | - | ||||||||||||||||||||||||
1453 | gctx->gcm.len.u[1] += bulk; | - | ||||||||||||||||||||||||
1454 | bulk += res; | - | ||||||||||||||||||||||||
1455 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1456 | - | |||||||||||||||||||||||||
1457 | if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm,
| 0-12488 | ||||||||||||||||||||||||
1458 | in + bulk,
| 0-12488 | ||||||||||||||||||||||||
1459 | out + bulk,
| 0-12488 | ||||||||||||||||||||||||
1460 | len - bulk, gctx->ctr)
| 0-12488 | ||||||||||||||||||||||||
1461 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1462 | } executed 12488 times by 1 test: else {end of block Executed by:
| 12488 | ||||||||||||||||||||||||
1463 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1464 | if (CRYPTO_gcm128_encrypt(&gctx->gcm,
| 0 | ||||||||||||||||||||||||
1465 | in + bulk, out + bulk, len - bulk)
| 0 | ||||||||||||||||||||||||
1466 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1467 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1468 | } else { | - | ||||||||||||||||||||||||
1469 | if (gctx->ctr
| 0-13904 | ||||||||||||||||||||||||
1470 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1471 | - | |||||||||||||||||||||||||
1472 | if (len >= 16
| 0-9775 | ||||||||||||||||||||||||
1473 | size_t res = (16 - gctx->gcm.mres) % 16; | - | ||||||||||||||||||||||||
1474 | - | |||||||||||||||||||||||||
1475 | if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, res)
| 0 | ||||||||||||||||||||||||
1476 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1477 | - | |||||||||||||||||||||||||
1478 | bulk = aesni_gcm_decrypt(in + res, | - | ||||||||||||||||||||||||
1479 | out + res, len - res, | - | ||||||||||||||||||||||||
1480 | gctx->gcm.key, | - | ||||||||||||||||||||||||
1481 | gctx->gcm.Yi.c, gctx->gcm.Xi.u); | - | ||||||||||||||||||||||||
1482 | gctx->gcm.len.u[1] += bulk; | - | ||||||||||||||||||||||||
1483 | bulk += res; | - | ||||||||||||||||||||||||
1484 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1485 | - | |||||||||||||||||||||||||
1486 | if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
| 0-13904 | ||||||||||||||||||||||||
1487 | in + bulk,
| 0-13904 | ||||||||||||||||||||||||
1488 | out + bulk,
| 0-13904 | ||||||||||||||||||||||||
1489 | len - bulk, gctx->ctr)
| 0-13904 | ||||||||||||||||||||||||
1490 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1491 | } executed 13904 times by 1 test: else {end of block Executed by:
| 13904 | ||||||||||||||||||||||||
1492 | size_t bulk = 0; | - | ||||||||||||||||||||||||
1493 | if (CRYPTO_gcm128_decrypt(&gctx->gcm,
| 0 | ||||||||||||||||||||||||
1494 | in + bulk, out + bulk, len - bulk)
| 0 | ||||||||||||||||||||||||
1495 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1496 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1497 | } | - | ||||||||||||||||||||||||
1498 | return executed 52352 times by 1 test: len;return len; Executed by:
executed 52352 times by 1 test: return len; Executed by:
| 52352 | ||||||||||||||||||||||||
1499 | } else { | - | ||||||||||||||||||||||||
1500 | if (!ctx->encrypt
| 12236-13652 | ||||||||||||||||||||||||
1501 | if (gctx->taglen < 0
| 0-13652 | ||||||||||||||||||||||||
1502 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1503 | if (CRYPTO_gcm128_finish(&gctx->gcm, ctx->buf, gctx->taglen) != 0
| 2965-10687 | ||||||||||||||||||||||||
1504 | return executed 2965 times by 1 test: -1;return -1; Executed by:
executed 2965 times by 1 test: return -1; Executed by:
| 2965 | ||||||||||||||||||||||||
1505 | gctx->iv_set = 0; | - | ||||||||||||||||||||||||
1506 | return executed 10687 times by 1 test: 0;return 0; Executed by:
executed 10687 times by 1 test: return 0; Executed by:
| 10687 | ||||||||||||||||||||||||
1507 | } | - | ||||||||||||||||||||||||
1508 | CRYPTO_gcm128_tag(&gctx->gcm, ctx->buf, 16); | - | ||||||||||||||||||||||||
1509 | gctx->taglen = 16; | - | ||||||||||||||||||||||||
1510 | - | |||||||||||||||||||||||||
1511 | gctx->iv_set = 0; | - | ||||||||||||||||||||||||
1512 | return executed 12236 times by 1 test: 0;return 0; Executed by:
executed 12236 times by 1 test: return 0; Executed by:
| 12236 | ||||||||||||||||||||||||
1513 | } | - | ||||||||||||||||||||||||
1514 | - | |||||||||||||||||||||||||
1515 | } | - | ||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||
1520 | - | |||||||||||||||||||||||||
1521 | - | |||||||||||||||||||||||||
1522 | static const EVP_CIPHER aesni_128_gcm = { 895,1, (0x6==0x10001?2:1)*128/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x6, aesni_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup, sizeof(EVP_AES_GCM_CTX), | - | ||||||||||||||||||||||||
1523 | ((void *)0) | - | ||||||||||||||||||||||||
1524 | , | - | ||||||||||||||||||||||||
1525 | ((void *)0) | - | ||||||||||||||||||||||||
1526 | ,aes_gcm_ctrl, | - | ||||||||||||||||||||||||
1527 | ((void *)0) | - | ||||||||||||||||||||||||
1528 | }; static const EVP_CIPHER aes_128_gcm = { 895,1, (0x6==0x10001?2:1)*128/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x6, aes_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup, sizeof(EVP_AES_GCM_CTX), | - | ||||||||||||||||||||||||
1529 | ((void *)0) | - | ||||||||||||||||||||||||
1530 | , | - | ||||||||||||||||||||||||
1531 | ((void *)0) | - | ||||||||||||||||||||||||
1532 | ,aes_gcm_ctrl, | - | ||||||||||||||||||||||||
1533 | ((void *)0) | - | ||||||||||||||||||||||||
1534 | }; const EVP_CIPHER *EVP_aes_128_gcm(void) { return executed 10282 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_gcm:&aes_128_gcm; Executed by:
executed 10282 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_gcm:&aes_128_gcm; Executed by:
| 0-10282 | ||||||||||||||||||||||||
1535 | - | |||||||||||||||||||||||||
1536 | static const EVP_CIPHER aesni_192_gcm = { 898,1, (0x6==0x10001?2:1)*192/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x6, aesni_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup, sizeof(EVP_AES_GCM_CTX), | - | ||||||||||||||||||||||||
1537 | ((void *)0) | - | ||||||||||||||||||||||||
1538 | , | - | ||||||||||||||||||||||||
1539 | ((void *)0) | - | ||||||||||||||||||||||||
1540 | ,aes_gcm_ctrl, | - | ||||||||||||||||||||||||
1541 | ((void *)0) | - | ||||||||||||||||||||||||
1542 | }; static const EVP_CIPHER aes_192_gcm = { 898,1, (0x6==0x10001?2:1)*192/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x6, aes_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup, sizeof(EVP_AES_GCM_CTX), | - | ||||||||||||||||||||||||
1543 | ((void *)0) | - | ||||||||||||||||||||||||
1544 | , | - | ||||||||||||||||||||||||
1545 | ((void *)0) | - | ||||||||||||||||||||||||
1546 | ,aes_gcm_ctrl, | - | ||||||||||||||||||||||||
1547 | ((void *)0) | - | ||||||||||||||||||||||||
1548 | }; const EVP_CIPHER *EVP_aes_192_gcm(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_gcm:&aes_192_gcm; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_gcm:&aes_192_gcm; Executed by:
| 0-1962 | ||||||||||||||||||||||||
1549 | - | |||||||||||||||||||||||||
1550 | static const EVP_CIPHER aesni_256_gcm = { 901,1, (0x6==0x10001?2:1)*256/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x6, aesni_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup, sizeof(EVP_AES_GCM_CTX), | - | ||||||||||||||||||||||||
1551 | ((void *)0) | - | ||||||||||||||||||||||||
1552 | , | - | ||||||||||||||||||||||||
1553 | ((void *)0) | - | ||||||||||||||||||||||||
1554 | ,aes_gcm_ctrl, | - | ||||||||||||||||||||||||
1555 | ((void *)0) | - | ||||||||||||||||||||||||
1556 | }; static const EVP_CIPHER aes_256_gcm = { 901,1, (0x6==0x10001?2:1)*256/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x6, aes_gcm_init_key, aes_gcm_cipher, aes_gcm_cleanup, sizeof(EVP_AES_GCM_CTX), | - | ||||||||||||||||||||||||
1557 | ((void *)0) | - | ||||||||||||||||||||||||
1558 | , | - | ||||||||||||||||||||||||
1559 | ((void *)0) | - | ||||||||||||||||||||||||
1560 | ,aes_gcm_ctrl, | - | ||||||||||||||||||||||||
1561 | ((void *)0) | - | ||||||||||||||||||||||||
1562 | }; const EVP_CIPHER *EVP_aes_256_gcm(void) { return executed 3920 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_gcm:&aes_256_gcm; Executed by:
executed 3920 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_gcm:&aes_256_gcm; Executed by:
| 0-3920 | ||||||||||||||||||||||||
1563 | - | |||||||||||||||||||||||||
1564 | - | |||||||||||||||||||||||||
1565 | static int aes_xts_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | - | ||||||||||||||||||||||||
1566 | { | - | ||||||||||||||||||||||||
1567 | EVP_AES_XTS_CTX *xctx = ((EVP_AES_XTS_CTX *)EVP_CIPHER_CTX_get_cipher_data(c)); | - | ||||||||||||||||||||||||
1568 | if (type == 0x8
| 0-385 | ||||||||||||||||||||||||
1569 | EVP_CIPHER_CTX *out = ptr; | - | ||||||||||||||||||||||||
1570 | EVP_AES_XTS_CTX *xctx_out = ((EVP_AES_XTS_CTX *)EVP_CIPHER_CTX_get_cipher_data(out)); | - | ||||||||||||||||||||||||
1571 | if (xctx->xts.key1
| 0 | ||||||||||||||||||||||||
1572 | if (xctx->xts.key1 != &xctx->ks1
| 0 | ||||||||||||||||||||||||
1573 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1574 | xctx_out->xts.key1 = &xctx_out->ks1; | - | ||||||||||||||||||||||||
1575 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1576 | if (xctx->xts.key2
| 0 | ||||||||||||||||||||||||
1577 | if (xctx->xts.key2 != &xctx->ks2
| 0 | ||||||||||||||||||||||||
1578 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1579 | xctx_out->xts.key2 = &xctx_out->ks2; | - | ||||||||||||||||||||||||
1580 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1581 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
1582 | } else if (type != 0x0
| 0-385 | ||||||||||||||||||||||||
1583 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1584 | - | |||||||||||||||||||||||||
1585 | xctx->xts.key1 = | - | ||||||||||||||||||||||||
1586 | ((void *)0) | - | ||||||||||||||||||||||||
1587 | ; | - | ||||||||||||||||||||||||
1588 | xctx->xts.key2 = | - | ||||||||||||||||||||||||
1589 | ((void *)0) | - | ||||||||||||||||||||||||
1590 | ; | - | ||||||||||||||||||||||||
1591 | return executed 385 times by 1 test: 1;return 1; Executed by:
executed 385 times by 1 test: return 1; Executed by:
| 385 | ||||||||||||||||||||||||
1592 | } | - | ||||||||||||||||||||||||
1593 | - | |||||||||||||||||||||||||
1594 | static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
1595 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
1596 | { | - | ||||||||||||||||||||||||
1597 | EVP_AES_XTS_CTX *xctx = ((EVP_AES_XTS_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1598 | if (!iv
| 0-385 | ||||||||||||||||||||||||
1599 | return executed 385 times by 1 test: 1;return 1; Executed by:
executed 385 times by 1 test: return 1; Executed by:
| 385 | ||||||||||||||||||||||||
1600 | - | |||||||||||||||||||||||||
1601 | if (key
| 0-385 | ||||||||||||||||||||||||
1602 | do { | - | ||||||||||||||||||||||||
1603 | - | |||||||||||||||||||||||||
1604 | - | |||||||||||||||||||||||||
1605 | - | |||||||||||||||||||||||||
1606 | xctx->stream = | - | ||||||||||||||||||||||||
1607 | ((void *)0) | - | ||||||||||||||||||||||||
1608 | ; | - | ||||||||||||||||||||||||
1609 | if ((
| 0-385 | ||||||||||||||||||||||||
1610 | xctx->stream = enc
executed 385 times by 1 test: xctx->stream = enc ? bsaes_xts_encrypt : bsaes_xts_decrypt; Executed by:
| 192-385 | ||||||||||||||||||||||||
1611 | else | - | ||||||||||||||||||||||||
1612 | - | |||||||||||||||||||||||||
1613 | - | |||||||||||||||||||||||||
1614 | if ((
| 0 | ||||||||||||||||||||||||
1615 | if (enc
| 0 | ||||||||||||||||||||||||
1616 | vpaes_set_encrypt_key(key, | - | ||||||||||||||||||||||||
1617 | EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
1618 | &xctx->ks1.ks); | - | ||||||||||||||||||||||||
1619 | xctx->xts.block1 = (block128_f) vpaes_encrypt; | - | ||||||||||||||||||||||||
1620 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1621 | vpaes_set_decrypt_key(key, | - | ||||||||||||||||||||||||
1622 | EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
1623 | &xctx->ks1.ks); | - | ||||||||||||||||||||||||
1624 | xctx->xts.block1 = (block128_f) vpaes_decrypt; | - | ||||||||||||||||||||||||
1625 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1626 | - | |||||||||||||||||||||||||
1627 | vpaes_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2, | - | ||||||||||||||||||||||||
1628 | EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
1629 | &xctx->ks2.ks); | - | ||||||||||||||||||||||||
1630 | xctx->xts.block2 = (block128_f) vpaes_encrypt; | - | ||||||||||||||||||||||||
1631 | - | |||||||||||||||||||||||||
1632 | xctx->xts.key1 = &xctx->ks1; | - | ||||||||||||||||||||||||
1633 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1634 | } else | - | ||||||||||||||||||||||||
1635 | - | |||||||||||||||||||||||||
1636 | ( never executed: void)0;(void)0; never executed: (void)0; | 0 | ||||||||||||||||||||||||
1637 | - | |||||||||||||||||||||||||
1638 | if (enc
| 192-193 | ||||||||||||||||||||||||
1639 | AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
1640 | &xctx->ks1.ks); | - | ||||||||||||||||||||||||
1641 | xctx->xts.block1 = (block128_f) AES_encrypt; | - | ||||||||||||||||||||||||
1642 | } executed 193 times by 1 test: else {end of block Executed by:
| 193 | ||||||||||||||||||||||||
1643 | AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
1644 | &xctx->ks1.ks); | - | ||||||||||||||||||||||||
1645 | xctx->xts.block1 = (block128_f) AES_decrypt; | - | ||||||||||||||||||||||||
1646 | } executed 192 times by 1 test: end of block Executed by:
| 192 | ||||||||||||||||||||||||
1647 | - | |||||||||||||||||||||||||
1648 | AES_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2, | - | ||||||||||||||||||||||||
1649 | EVP_CIPHER_CTX_key_length(ctx) * 4, | - | ||||||||||||||||||||||||
1650 | &xctx->ks2.ks); | - | ||||||||||||||||||||||||
1651 | xctx->xts.block2 = (block128_f) AES_encrypt; | - | ||||||||||||||||||||||||
1652 | - | |||||||||||||||||||||||||
1653 | xctx->xts.key1 = &xctx->ks1; | - | ||||||||||||||||||||||||
1654 | } executed 385 times by 1 test: while (0);end of block Executed by:
| 385 | ||||||||||||||||||||||||
1655 | - | |||||||||||||||||||||||||
1656 | if (iv
| 0-385 | ||||||||||||||||||||||||
1657 | xctx->xts.key2 = &xctx->ks2; | - | ||||||||||||||||||||||||
1658 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 16); | - | ||||||||||||||||||||||||
1659 | } executed 385 times by 1 test: end of block Executed by:
| 385 | ||||||||||||||||||||||||
1660 | - | |||||||||||||||||||||||||
1661 | return executed 385 times by 1 test: 1;return 1; Executed by:
executed 385 times by 1 test: return 1; Executed by:
| 385 | ||||||||||||||||||||||||
1662 | } | - | ||||||||||||||||||||||||
1663 | - | |||||||||||||||||||||||||
1664 | static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
1665 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
1666 | { | - | ||||||||||||||||||||||||
1667 | EVP_AES_XTS_CTX *xctx = ((EVP_AES_XTS_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1668 | - | |||||||||||||||||||||||||
1669 | if (xctx->xts.key1 ==
| 0-385 | ||||||||||||||||||||||||
1670 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||
1671 | - | |||||||||||||||||||||||||
1672 | || xctx->xts.key2 ==
| 0-385 | ||||||||||||||||||||||||
1673 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||
1674 | - | |||||||||||||||||||||||||
1675 | || out ==
| 0-385 | ||||||||||||||||||||||||
1676 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||
1677 | - | |||||||||||||||||||||||||
1678 | || in ==
| 0-385 | ||||||||||||||||||||||||
1679 | ((void *)0)
| 0-385 | ||||||||||||||||||||||||
1680 | - | |||||||||||||||||||||||||
1681 | || len < 16
| 0-385 | ||||||||||||||||||||||||
1682 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1683 | if (CRYPTO_memcmp(xctx->xts.key1, xctx->xts.key2,
| 1-384 | ||||||||||||||||||||||||
1684 | EVP_CIPHER_CTX_key_length(ctx) / 2) == 0
| 1-384 | ||||||||||||||||||||||||
1685 | return executed 1 time by 1 test: 0;return 0; Executed by:
executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||||||||
1686 | - | |||||||||||||||||||||||||
1687 | if (xctx->stream
| 0-384 | ||||||||||||||||||||||||
1688 | (* executed 384 times by 1 test: xctx->stream) (in, out, len,(*xctx->stream) (in, out, len, xctx->xts.key1, xctx->xts.key2, EVP_CIPHER_CTX_iv_noconst(ctx)); Executed by:
executed 384 times by 1 test: (*xctx->stream) (in, out, len, xctx->xts.key1, xctx->xts.key2, EVP_CIPHER_CTX_iv_noconst(ctx)); Executed by:
| 384 | ||||||||||||||||||||||||
1689 | xctx->xts.key1, xctx->xts.key2, executed 384 times by 1 test: (*xctx->stream) (in, out, len, xctx->xts.key1, xctx->xts.key2, EVP_CIPHER_CTX_iv_noconst(ctx)); Executed by:
| 384 | ||||||||||||||||||||||||
1690 | EVP_CIPHER_CTX_iv_noconst(ctx)); executed 384 times by 1 test: (*xctx->stream) (in, out, len, xctx->xts.key1, xctx->xts.key2, EVP_CIPHER_CTX_iv_noconst(ctx)); Executed by:
| 384 | ||||||||||||||||||||||||
1691 | else if (CRYPTO_xts128_encrypt(&xctx->xts, EVP_CIPHER_CTX_iv_noconst(ctx),
| 0 | ||||||||||||||||||||||||
1692 | in, out, len,
| 0 | ||||||||||||||||||||||||
1693 | EVP_CIPHER_CTX_encrypting(ctx))
| 0 | ||||||||||||||||||||||||
1694 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1695 | return executed 384 times by 1 test: 1;return 1; Executed by:
executed 384 times by 1 test: return 1; Executed by:
| 384 | ||||||||||||||||||||||||
1696 | } | - | ||||||||||||||||||||||||
1697 | - | |||||||||||||||||||||||||
1698 | - | |||||||||||||||||||||||||
1699 | - | |||||||||||||||||||||||||
1700 | - | |||||||||||||||||||||||||
1701 | - | |||||||||||||||||||||||||
1702 | - | |||||||||||||||||||||||||
1703 | - | |||||||||||||||||||||||||
1704 | static const EVP_CIPHER aesni_128_xts = { 913,1, (0x10001==0x10001?2:1)*128/8, 16, (0x1000 | 0x10 | 0x20 | 0x40 | 0x400)|0x10001, aesni_xts_init_key, aes_xts_cipher, | - | ||||||||||||||||||||||||
1705 | ((void *)0) | - | ||||||||||||||||||||||||
1706 | , sizeof(EVP_AES_XTS_CTX), | - | ||||||||||||||||||||||||
1707 | ((void *)0) | - | ||||||||||||||||||||||||
1708 | , | - | ||||||||||||||||||||||||
1709 | ((void *)0) | - | ||||||||||||||||||||||||
1710 | ,aes_xts_ctrl, | - | ||||||||||||||||||||||||
1711 | ((void *)0) | - | ||||||||||||||||||||||||
1712 | }; static const EVP_CIPHER aes_128_xts = { 913,1, (0x10001==0x10001?2:1)*128/8, 16, (0x1000 | 0x10 | 0x20 | 0x40 | 0x400)|0x10001, aes_xts_init_key, aes_xts_cipher, | - | ||||||||||||||||||||||||
1713 | ((void *)0) | - | ||||||||||||||||||||||||
1714 | , sizeof(EVP_AES_XTS_CTX), | - | ||||||||||||||||||||||||
1715 | ((void *)0) | - | ||||||||||||||||||||||||
1716 | , | - | ||||||||||||||||||||||||
1717 | ((void *)0) | - | ||||||||||||||||||||||||
1718 | ,aes_xts_ctrl, | - | ||||||||||||||||||||||||
1719 | ((void *)0) | - | ||||||||||||||||||||||||
1720 | }; const EVP_CIPHER *EVP_aes_128_xts(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_xts:&aes_128_xts; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_xts:&aes_128_xts; Executed by:
| 0-1962 | ||||||||||||||||||||||||
1721 | static const EVP_CIPHER aesni_256_xts = { 914,1, (0x10001==0x10001?2:1)*256/8, 16, (0x1000 | 0x10 | 0x20 | 0x40 | 0x400)|0x10001, aesni_xts_init_key, aes_xts_cipher, | - | ||||||||||||||||||||||||
1722 | ((void *)0) | - | ||||||||||||||||||||||||
1723 | , sizeof(EVP_AES_XTS_CTX), | - | ||||||||||||||||||||||||
1724 | ((void *)0) | - | ||||||||||||||||||||||||
1725 | , | - | ||||||||||||||||||||||||
1726 | ((void *)0) | - | ||||||||||||||||||||||||
1727 | ,aes_xts_ctrl, | - | ||||||||||||||||||||||||
1728 | ((void *)0) | - | ||||||||||||||||||||||||
1729 | }; static const EVP_CIPHER aes_256_xts = { 914,1, (0x10001==0x10001?2:1)*256/8, 16, (0x1000 | 0x10 | 0x20 | 0x40 | 0x400)|0x10001, aes_xts_init_key, aes_xts_cipher, | - | ||||||||||||||||||||||||
1730 | ((void *)0) | - | ||||||||||||||||||||||||
1731 | , sizeof(EVP_AES_XTS_CTX), | - | ||||||||||||||||||||||||
1732 | ((void *)0) | - | ||||||||||||||||||||||||
1733 | , | - | ||||||||||||||||||||||||
1734 | ((void *)0) | - | ||||||||||||||||||||||||
1735 | ,aes_xts_ctrl, | - | ||||||||||||||||||||||||
1736 | ((void *)0) | - | ||||||||||||||||||||||||
1737 | }; const EVP_CIPHER *EVP_aes_256_xts(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_xts:&aes_256_xts; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_xts:&aes_256_xts; Executed by:
| 0-1962 | ||||||||||||||||||||||||
1738 | - | |||||||||||||||||||||||||
1739 | static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | - | ||||||||||||||||||||||||
1740 | { | - | ||||||||||||||||||||||||
1741 | EVP_AES_CCM_CTX *cctx = ((EVP_AES_CCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(c)); | - | ||||||||||||||||||||||||
1742 | switch (type) { | - | ||||||||||||||||||||||||
1743 | case executed 163 times by 1 test: 0x0:case 0x0: Executed by:
executed 163 times by 1 test: case 0x0: Executed by:
| 163 | ||||||||||||||||||||||||
1744 | cctx->key_set = 0; | - | ||||||||||||||||||||||||
1745 | cctx->iv_set = 0; | - | ||||||||||||||||||||||||
1746 | cctx->L = 8; | - | ||||||||||||||||||||||||
1747 | cctx->M = 12; | - | ||||||||||||||||||||||||
1748 | cctx->tag_set = 0; | - | ||||||||||||||||||||||||
1749 | cctx->len_set = 0; | - | ||||||||||||||||||||||||
1750 | cctx->tls_aad_len = -1; | - | ||||||||||||||||||||||||
1751 | return executed 163 times by 1 test: 1;return 1; Executed by:
executed 163 times by 1 test: return 1; Executed by:
| 163 | ||||||||||||||||||||||||
1752 | - | |||||||||||||||||||||||||
1753 | case executed 346 times by 1 test: 0x16:case 0x16: Executed by:
executed 346 times by 1 test: case 0x16: Executed by:
| 346 | ||||||||||||||||||||||||
1754 | - | |||||||||||||||||||||||||
1755 | if (arg != 13
| 0-346 | ||||||||||||||||||||||||
1756 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1757 | memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg); | - | ||||||||||||||||||||||||
1758 | cctx->tls_aad_len = arg; | - | ||||||||||||||||||||||||
1759 | { | - | ||||||||||||||||||||||||
1760 | uint16_t len = | - | ||||||||||||||||||||||||
1761 | EVP_CIPHER_CTX_buf_noconst(c)[arg - 2] << 8 | - | ||||||||||||||||||||||||
1762 | | EVP_CIPHER_CTX_buf_noconst(c)[arg - 1]; | - | ||||||||||||||||||||||||
1763 | - | |||||||||||||||||||||||||
1764 | if (len < 8
| 2-344 | ||||||||||||||||||||||||
1765 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
1766 | len -= 8; | - | ||||||||||||||||||||||||
1767 | - | |||||||||||||||||||||||||
1768 | if (!EVP_CIPHER_CTX_encrypting(c)
| 97-247 | ||||||||||||||||||||||||
1769 | if (len < cctx->M
| 2-95 | ||||||||||||||||||||||||
1770 | return executed 2 times by 1 test: 0;return 0; Executed by:
executed 2 times by 1 test: return 0; Executed by:
| 2 | ||||||||||||||||||||||||
1771 | len -= cctx->M; | - | ||||||||||||||||||||||||
1772 | } executed 95 times by 1 test: end of block Executed by:
| 95 | ||||||||||||||||||||||||
1773 | EVP_CIPHER_CTX_buf_noconst(c)[arg - 2] = len >> 8; | - | ||||||||||||||||||||||||
1774 | EVP_CIPHER_CTX_buf_noconst(c)[arg - 1] = len & 0xff; | - | ||||||||||||||||||||||||
1775 | } | - | ||||||||||||||||||||||||
1776 | - | |||||||||||||||||||||||||
1777 | return executed 342 times by 1 test: cctx->M;return cctx->M; Executed by:
executed 342 times by 1 test: return cctx->M; Executed by:
| 342 | ||||||||||||||||||||||||
1778 | - | |||||||||||||||||||||||||
1779 | case executed 126 times by 1 test: 0x12:case 0x12: Executed by:
executed 126 times by 1 test: case 0x12: Executed by:
| 126 | ||||||||||||||||||||||||
1780 | - | |||||||||||||||||||||||||
1781 | if (arg != 4
| 0-126 | ||||||||||||||||||||||||
1782 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1783 | - | |||||||||||||||||||||||||
1784 | memcpy(EVP_CIPHER_CTX_iv_noconst(c), ptr, arg); | - | ||||||||||||||||||||||||
1785 | return executed 126 times by 1 test: 1;return 1; Executed by:
executed 126 times by 1 test: return 1; Executed by:
| 126 | ||||||||||||||||||||||||
1786 | - | |||||||||||||||||||||||||
1787 | case executed 163 times by 1 test: 0x9:case 0x9: Executed by:
executed 163 times by 1 test: case 0x9: Executed by:
| 163 | ||||||||||||||||||||||||
1788 | arg = 15 - arg; | - | ||||||||||||||||||||||||
1789 | - | |||||||||||||||||||||||||
1790 | case never executed: case 0x14: code before this statement executed 163 times by 1 test: case 0x14: Executed by:
never executed: 0x14:case 0x14: code before this statement executed 163 times by 1 test: case 0x14: Executed by:
never executed: case 0x14: | 0-163 | ||||||||||||||||||||||||
1791 | if (arg < 2
| 0-163 | ||||||||||||||||||||||||
1792 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1793 | cctx->L = arg; | - | ||||||||||||||||||||||||
1794 | return executed 163 times by 1 test: 1;return 1; Executed by:
executed 163 times by 1 test: return 1; Executed by:
| 163 | ||||||||||||||||||||||||
1795 | - | |||||||||||||||||||||||||
1796 | case executed 205 times by 1 test: 0x11:case 0x11: Executed by:
executed 205 times by 1 test: case 0x11: Executed by:
| 205 | ||||||||||||||||||||||||
1797 | if ((
| 0-205 | ||||||||||||||||||||||||
1798 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1799 | if (EVP_CIPHER_CTX_encrypting(c)
| 0-111 | ||||||||||||||||||||||||
1800 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1801 | if (ptr
| 28-177 | ||||||||||||||||||||||||
1802 | cctx->tag_set = 1; | - | ||||||||||||||||||||||||
1803 | memcpy(EVP_CIPHER_CTX_buf_noconst(c), ptr, arg); | - | ||||||||||||||||||||||||
1804 | } executed 28 times by 1 test: end of block Executed by:
| 28 | ||||||||||||||||||||||||
1805 | cctx->M = arg; | - | ||||||||||||||||||||||||
1806 | return executed 205 times by 1 test: 1;return 1; Executed by:
executed 205 times by 1 test: return 1; Executed by:
| 205 | ||||||||||||||||||||||||
1807 | - | |||||||||||||||||||||||||
1808 | case executed 27 times by 1 test: 0x10:case 0x10: Executed by:
executed 27 times by 1 test: case 0x10: Executed by:
| 27 | ||||||||||||||||||||||||
1809 | if (!EVP_CIPHER_CTX_encrypting(c)
| 0-27 | ||||||||||||||||||||||||
1810 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1811 | if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg)
| 0-27 | ||||||||||||||||||||||||
1812 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1813 | cctx->tag_set = 0; | - | ||||||||||||||||||||||||
1814 | cctx->iv_set = 0; | - | ||||||||||||||||||||||||
1815 | cctx->len_set = 0; | - | ||||||||||||||||||||||||
1816 | return executed 27 times by 1 test: 1;return 1; Executed by:
executed 27 times by 1 test: return 1; Executed by:
| 27 | ||||||||||||||||||||||||
1817 | - | |||||||||||||||||||||||||
1818 | case never executed: 0x8:case 0x8: never executed: case 0x8: | 0 | ||||||||||||||||||||||||
1819 | { | - | ||||||||||||||||||||||||
1820 | EVP_CIPHER_CTX *out = ptr; | - | ||||||||||||||||||||||||
1821 | EVP_AES_CCM_CTX *cctx_out = ((EVP_AES_CCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(out)); | - | ||||||||||||||||||||||||
1822 | if (cctx->ccm.key
| 0 | ||||||||||||||||||||||||
1823 | if (cctx->ccm.key != &cctx->ks
| 0 | ||||||||||||||||||||||||
1824 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1825 | cctx_out->ccm.key = &cctx_out->ks; | - | ||||||||||||||||||||||||
1826 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1827 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
1828 | } | - | ||||||||||||||||||||||||
1829 | - | |||||||||||||||||||||||||
1830 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1831 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1832 | - | |||||||||||||||||||||||||
1833 | } | - | ||||||||||||||||||||||||
1834 | } | - | ||||||||||||||||||||||||
1835 | - | |||||||||||||||||||||||||
1836 | static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
1837 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
1838 | { | - | ||||||||||||||||||||||||
1839 | EVP_AES_CCM_CTX *cctx = ((EVP_AES_CCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1840 | if (!iv
| 55-313 | ||||||||||||||||||||||||
1841 | return executed 163 times by 1 test: 1;return 1; Executed by:
executed 163 times by 1 test: return 1; Executed by:
| 163 | ||||||||||||||||||||||||
1842 | if (key
| 42-163 | ||||||||||||||||||||||||
1843 | do { | - | ||||||||||||||||||||||||
1844 | if ((
| 0-163 | ||||||||||||||||||||||||
1845 | vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
1846 | &cctx->ks.ks); | - | ||||||||||||||||||||||||
1847 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | - | ||||||||||||||||||||||||
1848 | &cctx->ks, (block128_f) vpaes_encrypt); | - | ||||||||||||||||||||||||
1849 | cctx->str = | - | ||||||||||||||||||||||||
1850 | ((void *)0) | - | ||||||||||||||||||||||||
1851 | ; | - | ||||||||||||||||||||||||
1852 | cctx->key_set = 1; | - | ||||||||||||||||||||||||
1853 | break; executed 163 times by 1 test: break; Executed by:
| 163 | ||||||||||||||||||||||||
1854 | } | - | ||||||||||||||||||||||||
1855 | - | |||||||||||||||||||||||||
1856 | AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
1857 | &cctx->ks.ks); | - | ||||||||||||||||||||||||
1858 | CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, | - | ||||||||||||||||||||||||
1859 | &cctx->ks, (block128_f) AES_encrypt); | - | ||||||||||||||||||||||||
1860 | cctx->str = | - | ||||||||||||||||||||||||
1861 | ((void *)0) | - | ||||||||||||||||||||||||
1862 | ; | - | ||||||||||||||||||||||||
1863 | cctx->key_set = 1; | - | ||||||||||||||||||||||||
1864 | } never executed: while (0);end of block | 0 | ||||||||||||||||||||||||
1865 | if (iv
| 55-150 | ||||||||||||||||||||||||
1866 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 15 - cctx->L); | - | ||||||||||||||||||||||||
1867 | cctx->iv_set = 1; | - | ||||||||||||||||||||||||
1868 | } executed 55 times by 1 test: end of block Executed by:
| 55 | ||||||||||||||||||||||||
1869 | return executed 205 times by 1 test: 1;return 1; Executed by:
executed 205 times by 1 test: return 1; Executed by:
| 205 | ||||||||||||||||||||||||
1870 | } | - | ||||||||||||||||||||||||
1871 | - | |||||||||||||||||||||||||
1872 | static int aes_ccm_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
1873 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
1874 | { | - | ||||||||||||||||||||||||
1875 | EVP_AES_CCM_CTX *cctx = ((EVP_AES_CCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1876 | CCM128_CONTEXT *ccm = &cctx->ccm; | - | ||||||||||||||||||||||||
1877 | - | |||||||||||||||||||||||||
1878 | if (out != in
| 0-342 | ||||||||||||||||||||||||
1879 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1880 | - | |||||||||||||||||||||||||
1881 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 95-247 | ||||||||||||||||||||||||
1882 | memcpy(out, EVP_CIPHER_CTX_buf_noconst(ctx), executed 247 times by 1 test: memcpy(out, EVP_CIPHER_CTX_buf_noconst(ctx), 8); Executed by:
| 247 | ||||||||||||||||||||||||
1883 | 8); executed 247 times by 1 test: memcpy(out, EVP_CIPHER_CTX_buf_noconst(ctx), 8); Executed by:
| 247 | ||||||||||||||||||||||||
1884 | - | |||||||||||||||||||||||||
1885 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx) + 4, in, | - | ||||||||||||||||||||||||
1886 | 8); | - | ||||||||||||||||||||||||
1887 | - | |||||||||||||||||||||||||
1888 | len -= 8 + cctx->M; | - | ||||||||||||||||||||||||
1889 | if (CRYPTO_ccm128_setiv(ccm, EVP_CIPHER_CTX_iv_noconst(ctx), 15 - cctx->L,
| 0-342 | ||||||||||||||||||||||||
1890 | len)
| 0-342 | ||||||||||||||||||||||||
1891 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1892 | - | |||||||||||||||||||||||||
1893 | CRYPTO_ccm128_aad(ccm, EVP_CIPHER_CTX_buf_noconst(ctx), cctx->tls_aad_len); | - | ||||||||||||||||||||||||
1894 | - | |||||||||||||||||||||||||
1895 | in += 8; | - | ||||||||||||||||||||||||
1896 | out += 8; | - | ||||||||||||||||||||||||
1897 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 95-247 | ||||||||||||||||||||||||
1898 | if (cctx->str
| 0-247 | ||||||||||||||||||||||||
1899 | cctx->str) :
| 0-247 | ||||||||||||||||||||||||
1900 | CRYPTO_ccm128_encrypt(ccm, in, out, len)
| 0-247 | ||||||||||||||||||||||||
1901 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1902 | if (!CRYPTO_ccm128_tag(ccm, out + len, cctx->M)
| 0-247 | ||||||||||||||||||||||||
1903 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1904 | return executed 247 times by 1 test: len + 8 + cctx->M;return len + 8 + cctx->M; Executed by:
executed 247 times by 1 test: return len + 8 + cctx->M; Executed by:
| 247 | ||||||||||||||||||||||||
1905 | } else { | - | ||||||||||||||||||||||||
1906 | if (cctx->str
| 0-95 | ||||||||||||||||||||||||
1907 | cctx->str) :
| 0-95 | ||||||||||||||||||||||||
1908 | !CRYPTO_ccm128_decrypt(ccm, in, out, len)
| 0-95 | ||||||||||||||||||||||||
1909 | unsigned char tag[16]; | - | ||||||||||||||||||||||||
1910 | if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)
| 0-95 | ||||||||||||||||||||||||
1911 | if (!CRYPTO_memcmp(tag, in + len, cctx->M)
| 35-60 | ||||||||||||||||||||||||
1912 | return executed 60 times by 1 test: len;return len; Executed by:
executed 60 times by 1 test: return len; Executed by:
| 60 | ||||||||||||||||||||||||
1913 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||||||||
1914 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||||||||
1915 | OPENSSL_cleanse(out, len); | - | ||||||||||||||||||||||||
1916 | return executed 35 times by 1 test: -1;return -1; Executed by:
executed 35 times by 1 test: return -1; Executed by:
| 35 | ||||||||||||||||||||||||
1917 | } | - | ||||||||||||||||||||||||
1918 | } | - | ||||||||||||||||||||||||
1919 | - | |||||||||||||||||||||||||
1920 | static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
1921 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
1922 | { | - | ||||||||||||||||||||||||
1923 | EVP_AES_CCM_CTX *cctx = ((EVP_AES_CCM_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
1924 | CCM128_CONTEXT *ccm = &cctx->ccm; | - | ||||||||||||||||||||||||
1925 | - | |||||||||||||||||||||||||
1926 | if (!cctx->key_set
| 0-561 | ||||||||||||||||||||||||
1927 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1928 | - | |||||||||||||||||||||||||
1929 | if (cctx->tls_aad_len >= 0
| 219-342 | ||||||||||||||||||||||||
1930 | return executed 342 times by 1 test: aes_ccm_tls_cipher(ctx, out, in, len);return aes_ccm_tls_cipher(ctx, out, in, len); Executed by:
executed 342 times by 1 test: return aes_ccm_tls_cipher(ctx, out, in, len); Executed by:
| 342 | ||||||||||||||||||||||||
1931 | - | |||||||||||||||||||||||||
1932 | - | |||||||||||||||||||||||||
1933 | if (in ==
| 109-110 | ||||||||||||||||||||||||
1934 | ((void *)0)
| 109-110 | ||||||||||||||||||||||||
1935 | && out !=
| 54-55 | ||||||||||||||||||||||||
1936 | ((void *)0)
| 54-55 | ||||||||||||||||||||||||
1937 | ) | - | ||||||||||||||||||||||||
1938 | return executed 54 times by 1 test: 0;return 0; Executed by:
executed 54 times by 1 test: return 0; Executed by:
| 54 | ||||||||||||||||||||||||
1939 | - | |||||||||||||||||||||||||
1940 | if (!cctx->iv_set
| 0-165 | ||||||||||||||||||||||||
1941 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1942 | - | |||||||||||||||||||||||||
1943 | if (!EVP_CIPHER_CTX_encrypting(ctx)
| 0-84 | ||||||||||||||||||||||||
1944 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1945 | if (!out
| 55-110 | ||||||||||||||||||||||||
1946 | if (!in
| 55 | ||||||||||||||||||||||||
1947 | if (CRYPTO_ccm128_setiv(ccm, EVP_CIPHER_CTX_iv_noconst(ctx),
| 0-55 | ||||||||||||||||||||||||
1948 | 15 - cctx->L, len)
| 0-55 | ||||||||||||||||||||||||
1949 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1950 | cctx->len_set = 1; | - | ||||||||||||||||||||||||
1951 | return executed 55 times by 1 test: len;return len; Executed by:
executed 55 times by 1 test: return len; Executed by:
| 55 | ||||||||||||||||||||||||
1952 | } | - | ||||||||||||||||||||||||
1953 | - | |||||||||||||||||||||||||
1954 | if (!cctx->len_set
| 0-55 | ||||||||||||||||||||||||
1955 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1956 | CRYPTO_ccm128_aad(ccm, in, len); | - | ||||||||||||||||||||||||
1957 | return executed 55 times by 1 test: len;return len; Executed by:
executed 55 times by 1 test: return len; Executed by:
| 55 | ||||||||||||||||||||||||
1958 | } | - | ||||||||||||||||||||||||
1959 | - | |||||||||||||||||||||||||
1960 | if (!cctx->len_set
| 0-55 | ||||||||||||||||||||||||
1961 | if (CRYPTO_ccm128_setiv(ccm, EVP_CIPHER_CTX_iv_noconst(ctx),
| 0 | ||||||||||||||||||||||||
1962 | 15 - cctx->L, len)
| 0 | ||||||||||||||||||||||||
1963 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1964 | cctx->len_set = 1; | - | ||||||||||||||||||||||||
1965 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1966 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 27-28 | ||||||||||||||||||||||||
1967 | if (cctx->str
| 0-27 | ||||||||||||||||||||||||
1968 | cctx->str) :
| 0-27 | ||||||||||||||||||||||||
1969 | CRYPTO_ccm128_encrypt(ccm, in, out, len)
| 0-27 | ||||||||||||||||||||||||
1970 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
1971 | cctx->tag_set = 1; | - | ||||||||||||||||||||||||
1972 | return executed 27 times by 1 test: len;return len; Executed by:
executed 27 times by 1 test: return len; Executed by:
| 27 | ||||||||||||||||||||||||
1973 | } else { | - | ||||||||||||||||||||||||
1974 | int rv = -1; | - | ||||||||||||||||||||||||
1975 | if (cctx->str
| 0-28 | ||||||||||||||||||||||||
1976 | cctx->str) :
| 0-28 | ||||||||||||||||||||||||
1977 | !CRYPTO_ccm128_decrypt(ccm, in, out, len)
| 0-28 | ||||||||||||||||||||||||
1978 | unsigned char tag[16]; | - | ||||||||||||||||||||||||
1979 | if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)
| 0-28 | ||||||||||||||||||||||||
1980 | if (!CRYPTO_memcmp(tag, EVP_CIPHER_CTX_buf_noconst(ctx),
| 1-27 | ||||||||||||||||||||||||
1981 | cctx->M)
| 1-27 | ||||||||||||||||||||||||
1982 | rv = len; executed 27 times by 1 test: rv = len; Executed by:
| 27 | ||||||||||||||||||||||||
1983 | } executed 28 times by 1 test: end of block Executed by:
| 28 | ||||||||||||||||||||||||
1984 | } executed 28 times by 1 test: end of block Executed by:
| 28 | ||||||||||||||||||||||||
1985 | if (rv == -1
| 1-27 | ||||||||||||||||||||||||
1986 | OPENSSL_cleanse(out, len); executed 1 time by 1 test: OPENSSL_cleanse(out, len); Executed by:
| 1 | ||||||||||||||||||||||||
1987 | cctx->iv_set = 0; | - | ||||||||||||||||||||||||
1988 | cctx->tag_set = 0; | - | ||||||||||||||||||||||||
1989 | cctx->len_set = 0; | - | ||||||||||||||||||||||||
1990 | return executed 28 times by 1 test: rv;return rv; Executed by:
executed 28 times by 1 test: return rv; Executed by:
| 28 | ||||||||||||||||||||||||
1991 | } | - | ||||||||||||||||||||||||
1992 | } | - | ||||||||||||||||||||||||
1993 | - | |||||||||||||||||||||||||
1994 | - | |||||||||||||||||||||||||
1995 | - | |||||||||||||||||||||||||
1996 | static const EVP_CIPHER aesni_128_ccm = { 896,1, (0x7==0x10001?2:1)*128/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x7, aesni_ccm_init_key, aes_ccm_cipher, | - | ||||||||||||||||||||||||
1997 | ((void *)0) | - | ||||||||||||||||||||||||
1998 | , sizeof(EVP_AES_CCM_CTX), | - | ||||||||||||||||||||||||
1999 | ((void *)0) | - | ||||||||||||||||||||||||
2000 | , | - | ||||||||||||||||||||||||
2001 | ((void *)0) | - | ||||||||||||||||||||||||
2002 | ,aes_ccm_ctrl, | - | ||||||||||||||||||||||||
2003 | ((void *)0) | - | ||||||||||||||||||||||||
2004 | }; static const EVP_CIPHER aes_128_ccm = { 896,1, (0x7==0x10001?2:1)*128/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x7, aes_ccm_init_key, aes_ccm_cipher, | - | ||||||||||||||||||||||||
2005 | ((void *)0) | - | ||||||||||||||||||||||||
2006 | , sizeof(EVP_AES_CCM_CTX), | - | ||||||||||||||||||||||||
2007 | ((void *)0) | - | ||||||||||||||||||||||||
2008 | , | - | ||||||||||||||||||||||||
2009 | ((void *)0) | - | ||||||||||||||||||||||||
2010 | ,aes_ccm_ctrl, | - | ||||||||||||||||||||||||
2011 | ((void *)0) | - | ||||||||||||||||||||||||
2012 | }; const EVP_CIPHER *EVP_aes_128_ccm(void) { return executed 3920 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ccm:&aes_128_ccm; Executed by:
executed 3920 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ccm:&aes_128_ccm; Executed by:
| 0-3920 | ||||||||||||||||||||||||
2013 | - | |||||||||||||||||||||||||
2014 | static const EVP_CIPHER aesni_192_ccm = { 899,1, (0x7==0x10001?2:1)*192/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x7, aesni_ccm_init_key, aes_ccm_cipher, | - | ||||||||||||||||||||||||
2015 | ((void *)0) | - | ||||||||||||||||||||||||
2016 | , sizeof(EVP_AES_CCM_CTX), | - | ||||||||||||||||||||||||
2017 | ((void *)0) | - | ||||||||||||||||||||||||
2018 | , | - | ||||||||||||||||||||||||
2019 | ((void *)0) | - | ||||||||||||||||||||||||
2020 | ,aes_ccm_ctrl, | - | ||||||||||||||||||||||||
2021 | ((void *)0) | - | ||||||||||||||||||||||||
2022 | }; static const EVP_CIPHER aes_192_ccm = { 899,1, (0x7==0x10001?2:1)*192/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x7, aes_ccm_init_key, aes_ccm_cipher, | - | ||||||||||||||||||||||||
2023 | ((void *)0) | - | ||||||||||||||||||||||||
2024 | , sizeof(EVP_AES_CCM_CTX), | - | ||||||||||||||||||||||||
2025 | ((void *)0) | - | ||||||||||||||||||||||||
2026 | , | - | ||||||||||||||||||||||||
2027 | ((void *)0) | - | ||||||||||||||||||||||||
2028 | ,aes_ccm_ctrl, | - | ||||||||||||||||||||||||
2029 | ((void *)0) | - | ||||||||||||||||||||||||
2030 | }; const EVP_CIPHER *EVP_aes_192_ccm(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ccm:&aes_192_ccm; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ccm:&aes_192_ccm; Executed by:
| 0-1962 | ||||||||||||||||||||||||
2031 | - | |||||||||||||||||||||||||
2032 | static const EVP_CIPHER aesni_256_ccm = { 902,1, (0x7==0x10001?2:1)*256/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x7, aesni_ccm_init_key, aes_ccm_cipher, | - | ||||||||||||||||||||||||
2033 | ((void *)0) | - | ||||||||||||||||||||||||
2034 | , sizeof(EVP_AES_CCM_CTX), | - | ||||||||||||||||||||||||
2035 | ((void *)0) | - | ||||||||||||||||||||||||
2036 | , | - | ||||||||||||||||||||||||
2037 | ((void *)0) | - | ||||||||||||||||||||||||
2038 | ,aes_ccm_ctrl, | - | ||||||||||||||||||||||||
2039 | ((void *)0) | - | ||||||||||||||||||||||||
2040 | }; static const EVP_CIPHER aes_256_ccm = { 902,1, (0x7==0x10001?2:1)*256/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x7, aes_ccm_init_key, aes_ccm_cipher, | - | ||||||||||||||||||||||||
2041 | ((void *)0) | - | ||||||||||||||||||||||||
2042 | , sizeof(EVP_AES_CCM_CTX), | - | ||||||||||||||||||||||||
2043 | ((void *)0) | - | ||||||||||||||||||||||||
2044 | , | - | ||||||||||||||||||||||||
2045 | ((void *)0) | - | ||||||||||||||||||||||||
2046 | ,aes_ccm_ctrl, | - | ||||||||||||||||||||||||
2047 | ((void *)0) | - | ||||||||||||||||||||||||
2048 | }; const EVP_CIPHER *EVP_aes_256_ccm(void) { return executed 3920 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ccm:&aes_256_ccm; Executed by:
executed 3920 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ccm:&aes_256_ccm; Executed by:
| 0-3920 | ||||||||||||||||||||||||
2049 | - | |||||||||||||||||||||||||
2050 | - | |||||||||||||||||||||||||
2051 | typedef struct { | - | ||||||||||||||||||||||||
2052 | union { | - | ||||||||||||||||||||||||
2053 | double align; | - | ||||||||||||||||||||||||
2054 | AES_KEY ks; | - | ||||||||||||||||||||||||
2055 | } ks; | - | ||||||||||||||||||||||||
2056 | - | |||||||||||||||||||||||||
2057 | unsigned char *iv; | - | ||||||||||||||||||||||||
2058 | } EVP_AES_WRAP_CTX; | - | ||||||||||||||||||||||||
2059 | - | |||||||||||||||||||||||||
2060 | static int aes_wrap_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
2061 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
2062 | { | - | ||||||||||||||||||||||||
2063 | EVP_AES_WRAP_CTX *wctx = ((EVP_AES_WRAP_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
2064 | if (!iv
| 0-206 | ||||||||||||||||||||||||
2065 | return executed 103 times by 1 test: 1;return 1; Executed by:
executed 103 times by 1 test: return 1; Executed by:
| 103 | ||||||||||||||||||||||||
2066 | if (key
| 0-103 | ||||||||||||||||||||||||
2067 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 51-52 | ||||||||||||||||||||||||
2068 | AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, executed 51 times by 1 test: AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &wctx->ks.ks); Executed by:
| 51 | ||||||||||||||||||||||||
2069 | &wctx->ks.ks); executed 51 times by 1 test: AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &wctx->ks.ks); Executed by:
| 51 | ||||||||||||||||||||||||
2070 | else | - | ||||||||||||||||||||||||
2071 | AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, executed 52 times by 1 test: AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &wctx->ks.ks); Executed by:
| 52 | ||||||||||||||||||||||||
2072 | &wctx->ks.ks); executed 52 times by 1 test: AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &wctx->ks.ks); Executed by:
| 52 | ||||||||||||||||||||||||
2073 | if (!iv
| 0-103 | ||||||||||||||||||||||||
2074 | wctx->iv = executed 103 times by 1 test: wctx->iv = ((void *)0) ; Executed by:
| 103 | ||||||||||||||||||||||||
2075 | ((void *)0) executed 103 times by 1 test: wctx->iv = ((void *)0) ; Executed by:
| 103 | ||||||||||||||||||||||||
2076 | ; executed 103 times by 1 test: wctx->iv = ((void *)0) ; Executed by:
| 103 | ||||||||||||||||||||||||
2077 | } executed 103 times by 1 test: end of block Executed by:
| 103 | ||||||||||||||||||||||||
2078 | if (iv
| 0-103 | ||||||||||||||||||||||||
2079 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, EVP_CIPHER_CTX_iv_length(ctx)); | - | ||||||||||||||||||||||||
2080 | wctx->iv = EVP_CIPHER_CTX_iv_noconst(ctx); | - | ||||||||||||||||||||||||
2081 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2082 | return executed 103 times by 1 test: 1;return 1; Executed by:
executed 103 times by 1 test: return 1; Executed by:
| 103 | ||||||||||||||||||||||||
2083 | } | - | ||||||||||||||||||||||||
2084 | - | |||||||||||||||||||||||||
2085 | static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
2086 | const unsigned char *in, size_t inlen) | - | ||||||||||||||||||||||||
2087 | { | - | ||||||||||||||||||||||||
2088 | EVP_AES_WRAP_CTX *wctx = ((EVP_AES_WRAP_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
2089 | size_t rv; | - | ||||||||||||||||||||||||
2090 | - | |||||||||||||||||||||||||
2091 | int pad = EVP_CIPHER_CTX_iv_length(ctx) == 4; | - | ||||||||||||||||||||||||
2092 | - | |||||||||||||||||||||||||
2093 | if (!in
| 96-109 | ||||||||||||||||||||||||
2094 | return executed 96 times by 1 test: 0;return 0; Executed by:
executed 96 times by 1 test: return 0; Executed by:
| 96 | ||||||||||||||||||||||||
2095 | - | |||||||||||||||||||||||||
2096 | if (!inlen
| 0-109 | ||||||||||||||||||||||||
2097 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2098 | - | |||||||||||||||||||||||||
2099 | if (!EVP_CIPHER_CTX_encrypting(ctx)
| 0-55 | ||||||||||||||||||||||||
2100 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2101 | - | |||||||||||||||||||||||||
2102 | if (!pad
| 0-85 | ||||||||||||||||||||||||
2103 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2104 | if (is_partially_overlapping(out, in, inlen)
| 0-109 | ||||||||||||||||||||||||
2105 | ERR_put_error(6,(170),(162),__FILE__,3805); | - | ||||||||||||||||||||||||
2106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2107 | } | - | ||||||||||||||||||||||||
2108 | if (!out
| 6-103 | ||||||||||||||||||||||||
2109 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 3 | ||||||||||||||||||||||||
2110 | - | |||||||||||||||||||||||||
2111 | if (pad
| 0-3 | ||||||||||||||||||||||||
2112 | inlen = (inlen + 7) / 8 * 8; never executed: inlen = (inlen + 7) / 8 * 8; | 0 | ||||||||||||||||||||||||
2113 | - | |||||||||||||||||||||||||
2114 | return executed 3 times by 1 test: inlen + 8;return inlen + 8; Executed by:
executed 3 times by 1 test: return inlen + 8; Executed by:
| 3 | ||||||||||||||||||||||||
2115 | } else { | - | ||||||||||||||||||||||||
2116 | - | |||||||||||||||||||||||||
2117 | - | |||||||||||||||||||||||||
2118 | - | |||||||||||||||||||||||||
2119 | - | |||||||||||||||||||||||||
2120 | - | |||||||||||||||||||||||||
2121 | return executed 3 times by 1 test: inlen - 8;return inlen - 8; Executed by:
executed 3 times by 1 test: return inlen - 8; Executed by:
| 3 | ||||||||||||||||||||||||
2122 | } | - | ||||||||||||||||||||||||
2123 | } | - | ||||||||||||||||||||||||
2124 | if (pad
| 24-79 | ||||||||||||||||||||||||
2125 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 12 | ||||||||||||||||||||||||
2126 | rv = CRYPTO_128_wrap_pad(&wctx->ks.ks, wctx->iv, executed 12 times by 1 test: rv = CRYPTO_128_wrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); Executed by:
| 12 | ||||||||||||||||||||||||
2127 | out, in, inlen, executed 12 times by 1 test: rv = CRYPTO_128_wrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); Executed by:
| 12 | ||||||||||||||||||||||||
2128 | (block128_f) AES_encrypt); executed 12 times by 1 test: rv = CRYPTO_128_wrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); Executed by:
| 12 | ||||||||||||||||||||||||
2129 | else | - | ||||||||||||||||||||||||
2130 | rv = CRYPTO_128_unwrap_pad(&wctx->ks.ks, wctx->iv, executed 12 times by 1 test: rv = CRYPTO_128_unwrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_decrypt); Executed by:
| 12 | ||||||||||||||||||||||||
2131 | out, in, inlen, executed 12 times by 1 test: rv = CRYPTO_128_unwrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_decrypt); Executed by:
| 12 | ||||||||||||||||||||||||
2132 | (block128_f) AES_decrypt); executed 12 times by 1 test: rv = CRYPTO_128_unwrap_pad(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_decrypt); Executed by:
| 12 | ||||||||||||||||||||||||
2133 | } else { | - | ||||||||||||||||||||||||
2134 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 39-40 | ||||||||||||||||||||||||
2135 | rv = CRYPTO_128_wrap(&wctx->ks.ks, wctx->iv, executed 39 times by 1 test: rv = CRYPTO_128_wrap(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); Executed by:
| 39 | ||||||||||||||||||||||||
2136 | out, in, inlen, (block128_f) AES_encrypt); executed 39 times by 1 test: rv = CRYPTO_128_wrap(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_encrypt); Executed by:
| 39 | ||||||||||||||||||||||||
2137 | else | - | ||||||||||||||||||||||||
2138 | rv = CRYPTO_128_unwrap(&wctx->ks.ks, wctx->iv, executed 40 times by 1 test: rv = CRYPTO_128_unwrap(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_decrypt); Executed by:
| 40 | ||||||||||||||||||||||||
2139 | out, in, inlen, (block128_f) AES_decrypt); executed 40 times by 1 test: rv = CRYPTO_128_unwrap(&wctx->ks.ks, wctx->iv, out, in, inlen, (block128_f) AES_decrypt); Executed by:
| 40 | ||||||||||||||||||||||||
2140 | } | - | ||||||||||||||||||||||||
2141 | return executed 103 times by 1 test: rvreturn rv ? (int)rv : -1; Executed by:
executed 103 times by 1 test: return rv ? (int)rv : -1; Executed by:
| 1-103 | ||||||||||||||||||||||||
2142 | } | - | ||||||||||||||||||||||||
2143 | - | |||||||||||||||||||||||||
2144 | - | |||||||||||||||||||||||||
2145 | - | |||||||||||||||||||||||||
2146 | - | |||||||||||||||||||||||||
2147 | - | |||||||||||||||||||||||||
2148 | static const EVP_CIPHER aes_128_wrap = { | - | ||||||||||||||||||||||||
2149 | 788, | - | ||||||||||||||||||||||||
2150 | 8, 16, 8, (0x10002 | 0x10 | 0x100000 | 0x20 | 0x1000), | - | ||||||||||||||||||||||||
2151 | aes_wrap_init_key, aes_wrap_cipher, | - | ||||||||||||||||||||||||
2152 | - | |||||||||||||||||||||||||
2153 | ((void *)0) | - | ||||||||||||||||||||||||
2154 | , | - | ||||||||||||||||||||||||
2155 | sizeof(EVP_AES_WRAP_CTX), | - | ||||||||||||||||||||||||
2156 | - | |||||||||||||||||||||||||
2157 | ((void *)0) | - | ||||||||||||||||||||||||
2158 | , | - | ||||||||||||||||||||||||
2159 | ((void *)0) | - | ||||||||||||||||||||||||
2160 | , | - | ||||||||||||||||||||||||
2161 | ((void *)0) | - | ||||||||||||||||||||||||
2162 | , | - | ||||||||||||||||||||||||
2163 | ((void *)0) | - | ||||||||||||||||||||||||
2164 | - | |||||||||||||||||||||||||
2165 | }; | - | ||||||||||||||||||||||||
2166 | - | |||||||||||||||||||||||||
2167 | const EVP_CIPHER *EVP_aes_128_wrap(void) | - | ||||||||||||||||||||||||
2168 | { | - | ||||||||||||||||||||||||
2169 | return executed 1965 times by 1 test: &aes_128_wrap;return &aes_128_wrap; Executed by:
executed 1965 times by 1 test: return &aes_128_wrap; Executed by:
| 1965 | ||||||||||||||||||||||||
2170 | } | - | ||||||||||||||||||||||||
2171 | - | |||||||||||||||||||||||||
2172 | static const EVP_CIPHER aes_192_wrap = { | - | ||||||||||||||||||||||||
2173 | 789, | - | ||||||||||||||||||||||||
2174 | 8, 24, 8, (0x10002 | 0x10 | 0x100000 | 0x20 | 0x1000), | - | ||||||||||||||||||||||||
2175 | aes_wrap_init_key, aes_wrap_cipher, | - | ||||||||||||||||||||||||
2176 | - | |||||||||||||||||||||||||
2177 | ((void *)0) | - | ||||||||||||||||||||||||
2178 | , | - | ||||||||||||||||||||||||
2179 | sizeof(EVP_AES_WRAP_CTX), | - | ||||||||||||||||||||||||
2180 | - | |||||||||||||||||||||||||
2181 | ((void *)0) | - | ||||||||||||||||||||||||
2182 | , | - | ||||||||||||||||||||||||
2183 | ((void *)0) | - | ||||||||||||||||||||||||
2184 | , | - | ||||||||||||||||||||||||
2185 | ((void *)0) | - | ||||||||||||||||||||||||
2186 | , | - | ||||||||||||||||||||||||
2187 | ((void *)0) | - | ||||||||||||||||||||||||
2188 | - | |||||||||||||||||||||||||
2189 | }; | - | ||||||||||||||||||||||||
2190 | - | |||||||||||||||||||||||||
2191 | const EVP_CIPHER *EVP_aes_192_wrap(void) | - | ||||||||||||||||||||||||
2192 | { | - | ||||||||||||||||||||||||
2193 | return executed 1962 times by 1 test: &aes_192_wrap;return &aes_192_wrap; Executed by:
executed 1962 times by 1 test: return &aes_192_wrap; Executed by:
| 1962 | ||||||||||||||||||||||||
2194 | } | - | ||||||||||||||||||||||||
2195 | - | |||||||||||||||||||||||||
2196 | static const EVP_CIPHER aes_256_wrap = { | - | ||||||||||||||||||||||||
2197 | 790, | - | ||||||||||||||||||||||||
2198 | 8, 32, 8, (0x10002 | 0x10 | 0x100000 | 0x20 | 0x1000), | - | ||||||||||||||||||||||||
2199 | aes_wrap_init_key, aes_wrap_cipher, | - | ||||||||||||||||||||||||
2200 | - | |||||||||||||||||||||||||
2201 | ((void *)0) | - | ||||||||||||||||||||||||
2202 | , | - | ||||||||||||||||||||||||
2203 | sizeof(EVP_AES_WRAP_CTX), | - | ||||||||||||||||||||||||
2204 | - | |||||||||||||||||||||||||
2205 | ((void *)0) | - | ||||||||||||||||||||||||
2206 | , | - | ||||||||||||||||||||||||
2207 | ((void *)0) | - | ||||||||||||||||||||||||
2208 | , | - | ||||||||||||||||||||||||
2209 | ((void *)0) | - | ||||||||||||||||||||||||
2210 | , | - | ||||||||||||||||||||||||
2211 | ((void *)0) | - | ||||||||||||||||||||||||
2212 | - | |||||||||||||||||||||||||
2213 | }; | - | ||||||||||||||||||||||||
2214 | - | |||||||||||||||||||||||||
2215 | const EVP_CIPHER *EVP_aes_256_wrap(void) | - | ||||||||||||||||||||||||
2216 | { | - | ||||||||||||||||||||||||
2217 | return executed 1962 times by 1 test: &aes_256_wrap;return &aes_256_wrap; Executed by:
executed 1962 times by 1 test: return &aes_256_wrap; Executed by:
| 1962 | ||||||||||||||||||||||||
2218 | } | - | ||||||||||||||||||||||||
2219 | - | |||||||||||||||||||||||||
2220 | static const EVP_CIPHER aes_128_wrap_pad = { | - | ||||||||||||||||||||||||
2221 | 897, | - | ||||||||||||||||||||||||
2222 | 8, 16, 4, (0x10002 | 0x10 | 0x100000 | 0x20 | 0x1000), | - | ||||||||||||||||||||||||
2223 | aes_wrap_init_key, aes_wrap_cipher, | - | ||||||||||||||||||||||||
2224 | - | |||||||||||||||||||||||||
2225 | ((void *)0) | - | ||||||||||||||||||||||||
2226 | , | - | ||||||||||||||||||||||||
2227 | sizeof(EVP_AES_WRAP_CTX), | - | ||||||||||||||||||||||||
2228 | - | |||||||||||||||||||||||||
2229 | ((void *)0) | - | ||||||||||||||||||||||||
2230 | , | - | ||||||||||||||||||||||||
2231 | ((void *)0) | - | ||||||||||||||||||||||||
2232 | , | - | ||||||||||||||||||||||||
2233 | ((void *)0) | - | ||||||||||||||||||||||||
2234 | , | - | ||||||||||||||||||||||||
2235 | ((void *)0) | - | ||||||||||||||||||||||||
2236 | - | |||||||||||||||||||||||||
2237 | }; | - | ||||||||||||||||||||||||
2238 | - | |||||||||||||||||||||||||
2239 | const EVP_CIPHER *EVP_aes_128_wrap_pad(void) | - | ||||||||||||||||||||||||
2240 | { | - | ||||||||||||||||||||||||
2241 | return executed 1962 times by 1 test: &aes_128_wrap_pad;return &aes_128_wrap_pad; Executed by:
executed 1962 times by 1 test: return &aes_128_wrap_pad; Executed by:
| 1962 | ||||||||||||||||||||||||
2242 | } | - | ||||||||||||||||||||||||
2243 | - | |||||||||||||||||||||||||
2244 | static const EVP_CIPHER aes_192_wrap_pad = { | - | ||||||||||||||||||||||||
2245 | 900, | - | ||||||||||||||||||||||||
2246 | 8, 24, 4, (0x10002 | 0x10 | 0x100000 | 0x20 | 0x1000), | - | ||||||||||||||||||||||||
2247 | aes_wrap_init_key, aes_wrap_cipher, | - | ||||||||||||||||||||||||
2248 | - | |||||||||||||||||||||||||
2249 | ((void *)0) | - | ||||||||||||||||||||||||
2250 | , | - | ||||||||||||||||||||||||
2251 | sizeof(EVP_AES_WRAP_CTX), | - | ||||||||||||||||||||||||
2252 | - | |||||||||||||||||||||||||
2253 | ((void *)0) | - | ||||||||||||||||||||||||
2254 | , | - | ||||||||||||||||||||||||
2255 | ((void *)0) | - | ||||||||||||||||||||||||
2256 | , | - | ||||||||||||||||||||||||
2257 | ((void *)0) | - | ||||||||||||||||||||||||
2258 | , | - | ||||||||||||||||||||||||
2259 | ((void *)0) | - | ||||||||||||||||||||||||
2260 | - | |||||||||||||||||||||||||
2261 | }; | - | ||||||||||||||||||||||||
2262 | - | |||||||||||||||||||||||||
2263 | const EVP_CIPHER *EVP_aes_192_wrap_pad(void) | - | ||||||||||||||||||||||||
2264 | { | - | ||||||||||||||||||||||||
2265 | return executed 1962 times by 1 test: &aes_192_wrap_pad;return &aes_192_wrap_pad; Executed by:
executed 1962 times by 1 test: return &aes_192_wrap_pad; Executed by:
| 1962 | ||||||||||||||||||||||||
2266 | } | - | ||||||||||||||||||||||||
2267 | - | |||||||||||||||||||||||||
2268 | static const EVP_CIPHER aes_256_wrap_pad = { | - | ||||||||||||||||||||||||
2269 | 903, | - | ||||||||||||||||||||||||
2270 | 8, 32, 4, (0x10002 | 0x10 | 0x100000 | 0x20 | 0x1000), | - | ||||||||||||||||||||||||
2271 | aes_wrap_init_key, aes_wrap_cipher, | - | ||||||||||||||||||||||||
2272 | - | |||||||||||||||||||||||||
2273 | ((void *)0) | - | ||||||||||||||||||||||||
2274 | , | - | ||||||||||||||||||||||||
2275 | sizeof(EVP_AES_WRAP_CTX), | - | ||||||||||||||||||||||||
2276 | - | |||||||||||||||||||||||||
2277 | ((void *)0) | - | ||||||||||||||||||||||||
2278 | , | - | ||||||||||||||||||||||||
2279 | ((void *)0) | - | ||||||||||||||||||||||||
2280 | , | - | ||||||||||||||||||||||||
2281 | ((void *)0) | - | ||||||||||||||||||||||||
2282 | , | - | ||||||||||||||||||||||||
2283 | ((void *)0) | - | ||||||||||||||||||||||||
2284 | - | |||||||||||||||||||||||||
2285 | }; | - | ||||||||||||||||||||||||
2286 | - | |||||||||||||||||||||||||
2287 | const EVP_CIPHER *EVP_aes_256_wrap_pad(void) | - | ||||||||||||||||||||||||
2288 | { | - | ||||||||||||||||||||||||
2289 | return executed 1962 times by 1 test: &aes_256_wrap_pad;return &aes_256_wrap_pad; Executed by:
executed 1962 times by 1 test: return &aes_256_wrap_pad; Executed by:
| 1962 | ||||||||||||||||||||||||
2290 | } | - | ||||||||||||||||||||||||
2291 | - | |||||||||||||||||||||||||
2292 | - | |||||||||||||||||||||||||
2293 | static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | - | ||||||||||||||||||||||||
2294 | { | - | ||||||||||||||||||||||||
2295 | EVP_AES_OCB_CTX *octx = ((EVP_AES_OCB_CTX *)EVP_CIPHER_CTX_get_cipher_data(c)); | - | ||||||||||||||||||||||||
2296 | EVP_CIPHER_CTX *newc; | - | ||||||||||||||||||||||||
2297 | EVP_AES_OCB_CTX *new_octx; | - | ||||||||||||||||||||||||
2298 | - | |||||||||||||||||||||||||
2299 | switch (type) { | - | ||||||||||||||||||||||||
2300 | case executed 553 times by 1 test: 0x0:case 0x0: Executed by:
executed 553 times by 1 test: case 0x0: Executed by:
| 553 | ||||||||||||||||||||||||
2301 | octx->key_set = 0; | - | ||||||||||||||||||||||||
2302 | octx->iv_set = 0; | - | ||||||||||||||||||||||||
2303 | octx->ivlen = EVP_CIPHER_CTX_iv_length(c); | - | ||||||||||||||||||||||||
2304 | octx->iv = EVP_CIPHER_CTX_iv_noconst(c); | - | ||||||||||||||||||||||||
2305 | octx->taglen = 16; | - | ||||||||||||||||||||||||
2306 | octx->data_buf_len = 0; | - | ||||||||||||||||||||||||
2307 | octx->aad_buf_len = 0; | - | ||||||||||||||||||||||||
2308 | return executed 553 times by 1 test: 1;return 1; Executed by:
executed 553 times by 1 test: return 1; Executed by:
| 553 | ||||||||||||||||||||||||
2309 | - | |||||||||||||||||||||||||
2310 | case executed 553 times by 1 test: 0x9:case 0x9: Executed by:
executed 553 times by 1 test: case 0x9: Executed by:
| 553 | ||||||||||||||||||||||||
2311 | - | |||||||||||||||||||||||||
2312 | if (arg <= 0
| 0-553 | ||||||||||||||||||||||||
2313 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2314 | - | |||||||||||||||||||||||||
2315 | octx->ivlen = arg; | - | ||||||||||||||||||||||||
2316 | return executed 553 times by 1 test: 1;return 1; Executed by:
executed 553 times by 1 test: return 1; Executed by:
| 553 | ||||||||||||||||||||||||
2317 | - | |||||||||||||||||||||||||
2318 | case executed 830 times by 1 test: 0x11:case 0x11: Executed by:
executed 830 times by 1 test: case 0x11: Executed by:
| 830 | ||||||||||||||||||||||||
2319 | if (!ptr
| 277-553 | ||||||||||||||||||||||||
2320 | - | |||||||||||||||||||||||||
2321 | if (arg < 0
| 0-553 | ||||||||||||||||||||||||
2322 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2323 | - | |||||||||||||||||||||||||
2324 | octx->taglen = arg; | - | ||||||||||||||||||||||||
2325 | return executed 553 times by 1 test: 1;return 1; Executed by:
executed 553 times by 1 test: return 1; Executed by:
| 553 | ||||||||||||||||||||||||
2326 | } | - | ||||||||||||||||||||||||
2327 | if (arg != octx->taglen
| 0-277 | ||||||||||||||||||||||||
2328 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2329 | memcpy(octx->tag, ptr, arg); | - | ||||||||||||||||||||||||
2330 | return executed 277 times by 1 test: 1;return 1; Executed by:
executed 277 times by 1 test: return 1; Executed by:
| 277 | ||||||||||||||||||||||||
2331 | - | |||||||||||||||||||||||||
2332 | case executed 276 times by 1 test: 0x10:case 0x10: Executed by:
executed 276 times by 1 test: case 0x10: Executed by:
| 276 | ||||||||||||||||||||||||
2333 | if (arg != octx->taglen
| 0-276 | ||||||||||||||||||||||||
2334 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2335 | - | |||||||||||||||||||||||||
2336 | memcpy(ptr, octx->tag, arg); | - | ||||||||||||||||||||||||
2337 | return executed 276 times by 1 test: 1;return 1; Executed by:
executed 276 times by 1 test: return 1; Executed by:
| 276 | ||||||||||||||||||||||||
2338 | - | |||||||||||||||||||||||||
2339 | case never executed: 0x8:case 0x8: never executed: case 0x8: | 0 | ||||||||||||||||||||||||
2340 | newc = (EVP_CIPHER_CTX *)ptr; | - | ||||||||||||||||||||||||
2341 | new_octx = ((EVP_AES_OCB_CTX *)EVP_CIPHER_CTX_get_cipher_data(newc)); | - | ||||||||||||||||||||||||
2342 | return never executed: CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb,return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb, &new_octx->ksenc.ks, &new_octx->ksdec.ks); never executed: return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb, &new_octx->ksenc.ks, &new_octx->ksdec.ks); | 0 | ||||||||||||||||||||||||
2343 | &new_octx->ksenc.ks, never executed: return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb, &new_octx->ksenc.ks, &new_octx->ksdec.ks); | 0 | ||||||||||||||||||||||||
2344 | &new_octx->ksdec.ks); never executed: return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb, &new_octx->ksenc.ks, &new_octx->ksdec.ks); | 0 | ||||||||||||||||||||||||
2345 | - | |||||||||||||||||||||||||
2346 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
2347 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2348 | - | |||||||||||||||||||||||||
2349 | } | - | ||||||||||||||||||||||||
2350 | } | - | ||||||||||||||||||||||||
2351 | static int aes_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | - | ||||||||||||||||||||||||
2352 | const unsigned char *iv, int enc) | - | ||||||||||||||||||||||||
2353 | { | - | ||||||||||||||||||||||||
2354 | EVP_AES_OCB_CTX *octx = ((EVP_AES_OCB_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
2355 | if (!iv
| 0-553 | ||||||||||||||||||||||||
2356 | return executed 553 times by 1 test: 1;return 1; Executed by:
executed 553 times by 1 test: return 1; Executed by:
| 553 | ||||||||||||||||||||||||
2357 | if (key
| 0-553 | ||||||||||||||||||||||||
2358 | do { | - | ||||||||||||||||||||||||
2359 | if ((
| 0-553 | ||||||||||||||||||||||||
2360 | vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
2361 | &octx->ksenc.ks); | - | ||||||||||||||||||||||||
2362 | vpaes_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
2363 | &octx->ksdec.ks); | - | ||||||||||||||||||||||||
2364 | if (!CRYPTO_ocb128_init(&octx->ocb,
| 0-553 | ||||||||||||||||||||||||
2365 | &octx->ksenc.ks, &octx->ksdec.ks,
| 0-553 | ||||||||||||||||||||||||
2366 | (block128_f) vpaes_encrypt,
| 0-553 | ||||||||||||||||||||||||
2367 | (block128_f) vpaes_decrypt,
| 0-553 | ||||||||||||||||||||||||
2368 |
| 0-553 | ||||||||||||||||||||||||
2369 | ((void *)0)
| 0-553 | ||||||||||||||||||||||||
2370 | )
| 0-553 | ||||||||||||||||||||||||
2371 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2372 | break; executed 553 times by 1 test: break; Executed by:
| 553 | ||||||||||||||||||||||||
2373 | } | - | ||||||||||||||||||||||||
2374 | - | |||||||||||||||||||||||||
2375 | AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
2376 | &octx->ksenc.ks); | - | ||||||||||||||||||||||||
2377 | AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, | - | ||||||||||||||||||||||||
2378 | &octx->ksdec.ks); | - | ||||||||||||||||||||||||
2379 | if (!CRYPTO_ocb128_init(&octx->ocb,
| 0 | ||||||||||||||||||||||||
2380 | &octx->ksenc.ks, &octx->ksdec.ks,
| 0 | ||||||||||||||||||||||||
2381 | (block128_f) AES_encrypt,
| 0 | ||||||||||||||||||||||||
2382 | (block128_f) AES_decrypt,
| 0 | ||||||||||||||||||||||||
2383 |
| 0 | ||||||||||||||||||||||||
2384 | ((void *)0)
| 0 | ||||||||||||||||||||||||
2385 | )
| 0 | ||||||||||||||||||||||||
2386 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2387 | } | - | ||||||||||||||||||||||||
2388 | while (0); | - | ||||||||||||||||||||||||
2389 | - | |||||||||||||||||||||||||
2390 | - | |||||||||||||||||||||||||
2391 | - | |||||||||||||||||||||||||
2392 | - | |||||||||||||||||||||||||
2393 | if (iv ==
| 0-553 | ||||||||||||||||||||||||
2394 | ((void *)0)
| 0-553 | ||||||||||||||||||||||||
2395 | && octx->iv_set
| 0 | ||||||||||||||||||||||||
2396 | iv = octx->iv; never executed: iv = octx->iv; | 0 | ||||||||||||||||||||||||
2397 | if (iv
| 0-553 | ||||||||||||||||||||||||
2398 | if (CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen)
| 0-553 | ||||||||||||||||||||||||
2399 | != 1
| 0-553 | ||||||||||||||||||||||||
2400 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2401 | octx->iv_set = 1; | - | ||||||||||||||||||||||||
2402 | } executed 553 times by 1 test: end of block Executed by:
| 553 | ||||||||||||||||||||||||
2403 | octx->key_set = 1; | - | ||||||||||||||||||||||||
2404 | } executed 553 times by 1 test: else {end of block Executed by:
| 553 | ||||||||||||||||||||||||
2405 | - | |||||||||||||||||||||||||
2406 | if (octx->key_set
| 0 | ||||||||||||||||||||||||
2407 | CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen); never executed: CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen); | 0 | ||||||||||||||||||||||||
2408 | else | - | ||||||||||||||||||||||||
2409 | memcpy(octx->iv, iv, octx->ivlen); never executed: memcpy(octx->iv, iv, octx->ivlen); | 0 | ||||||||||||||||||||||||
2410 | octx->iv_set = 1; | - | ||||||||||||||||||||||||
2411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
2412 | return executed 553 times by 1 test: 1;return 1; Executed by:
executed 553 times by 1 test: return 1; Executed by:
| 553 | ||||||||||||||||||||||||
2413 | } | - | ||||||||||||||||||||||||
2414 | - | |||||||||||||||||||||||||
2415 | static int aes_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | - | ||||||||||||||||||||||||
2416 | const unsigned char *in, size_t len) | - | ||||||||||||||||||||||||
2417 | { | - | ||||||||||||||||||||||||
2418 | unsigned char *buf; | - | ||||||||||||||||||||||||
2419 | int *buf_len; | - | ||||||||||||||||||||||||
2420 | int written_len = 0; | - | ||||||||||||||||||||||||
2421 | size_t trailing_len; | - | ||||||||||||||||||||||||
2422 | EVP_AES_OCB_CTX *octx = ((EVP_AES_OCB_CTX *)EVP_CIPHER_CTX_get_cipher_data(ctx)); | - | ||||||||||||||||||||||||
2423 | - | |||||||||||||||||||||||||
2424 | - | |||||||||||||||||||||||||
2425 | if (!octx->iv_set
| 0-2331 | ||||||||||||||||||||||||
2426 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2427 | - | |||||||||||||||||||||||||
2428 | if (!octx->key_set
| 0-2331 | ||||||||||||||||||||||||
2429 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2430 | - | |||||||||||||||||||||||||
2431 | if (in !=
| 553-1778 | ||||||||||||||||||||||||
2432 | ((void *)0)
| 553-1778 | ||||||||||||||||||||||||
2433 | ) { | - | ||||||||||||||||||||||||
2434 | if (out ==
| 889 | ||||||||||||||||||||||||
2435 | ((void *)0)
| 889 | ||||||||||||||||||||||||
2436 | ) { | - | ||||||||||||||||||||||||
2437 | buf = octx->aad_buf; | - | ||||||||||||||||||||||||
2438 | buf_len = &(octx->aad_buf_len); | - | ||||||||||||||||||||||||
2439 | } executed 889 times by 1 test: else {end of block Executed by:
| 889 | ||||||||||||||||||||||||
2440 | buf = octx->data_buf; | - | ||||||||||||||||||||||||
2441 | buf_len = &(octx->data_buf_len); | - | ||||||||||||||||||||||||
2442 | - | |||||||||||||||||||||||||
2443 | if (is_partially_overlapping(out + *buf_len, in, len)
| 0-889 | ||||||||||||||||||||||||
2444 | ERR_put_error(6,(169),(162),__FILE__,4128); | - | ||||||||||||||||||||||||
2445 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
2446 | } | - | ||||||||||||||||||||||||
2447 | } executed 889 times by 1 test: end of block Executed by:
| 889 | ||||||||||||||||||||||||
2448 | - | |||||||||||||||||||||||||
2449 | - | |||||||||||||||||||||||||
2450 | - | |||||||||||||||||||||||||
2451 | - | |||||||||||||||||||||||||
2452 | - | |||||||||||||||||||||||||
2453 | if (*
| 816-962 | ||||||||||||||||||||||||
2454 | unsigned int remaining; | - | ||||||||||||||||||||||||
2455 | - | |||||||||||||||||||||||||
2456 | remaining = 16 - (*buf_len); | - | ||||||||||||||||||||||||
2457 | if (remaining > len
| 408 | ||||||||||||||||||||||||
2458 | memcpy(buf + (*buf_len), in, len); | - | ||||||||||||||||||||||||
2459 | *(buf_len) += len; | - | ||||||||||||||||||||||||
2460 | return executed 408 times by 1 test: 0;return 0; Executed by:
executed 408 times by 1 test: return 0; Executed by:
| 408 | ||||||||||||||||||||||||
2461 | } | - | ||||||||||||||||||||||||
2462 | memcpy(buf + (*buf_len), in, remaining); | - | ||||||||||||||||||||||||
2463 | - | |||||||||||||||||||||||||
2464 | - | |||||||||||||||||||||||||
2465 | - | |||||||||||||||||||||||||
2466 | - | |||||||||||||||||||||||||
2467 | len -= remaining; | - | ||||||||||||||||||||||||
2468 | in += remaining; | - | ||||||||||||||||||||||||
2469 | if (out ==
| 204 | ||||||||||||||||||||||||
2470 | ((void *)0)
| 204 | ||||||||||||||||||||||||
2471 | ) { | - | ||||||||||||||||||||||||
2472 | if (!CRYPTO_ocb128_aad(&octx->ocb, buf, 16)
| 0-204 | ||||||||||||||||||||||||
2473 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2474 | } executed 204 times by 1 test: else if (EVP_CIPHER_CTX_encrypting(ctx)end of block Executed by:
| 102-204 | ||||||||||||||||||||||||
2475 | if (!CRYPTO_ocb128_encrypt(&octx->ocb, buf, out,
| 0-102 | ||||||||||||||||||||||||
2476 | 16)
| 0-102 | ||||||||||||||||||||||||
2477 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2478 | } executed 102 times by 1 test: else {end of block Executed by:
| 102 | ||||||||||||||||||||||||
2479 | if (!CRYPTO_ocb128_decrypt(&octx->ocb, buf, out,
| 0-102 | ||||||||||||||||||||||||
2480 | 16)
| 0-102 | ||||||||||||||||||||||||
2481 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2482 | } executed 102 times by 1 test: end of block Executed by:
| 102 | ||||||||||||||||||||||||
2483 | written_len = 16; | - | ||||||||||||||||||||||||
2484 | *buf_len = 0; | - | ||||||||||||||||||||||||
2485 | if (out !=
| 204 | ||||||||||||||||||||||||
2486 | ((void *)0)
| 204 | ||||||||||||||||||||||||
2487 | ) | - | ||||||||||||||||||||||||
2488 | out += 16; executed 204 times by 1 test: out += 16; Executed by:
| 204 | ||||||||||||||||||||||||
2489 | } executed 408 times by 1 test: end of block Executed by:
| 408 | ||||||||||||||||||||||||
2490 | - | |||||||||||||||||||||||||
2491 | - | |||||||||||||||||||||||||
2492 | trailing_len = len % 16; | - | ||||||||||||||||||||||||
2493 | - | |||||||||||||||||||||||||
2494 | - | |||||||||||||||||||||||||
2495 | - | |||||||||||||||||||||||||
2496 | - | |||||||||||||||||||||||||
2497 | if (len != trailing_len
| 578-792 | ||||||||||||||||||||||||
2498 | if (out ==
| 289 | ||||||||||||||||||||||||
2499 | ((void *)0)
| 289 | ||||||||||||||||||||||||
2500 | ) { | - | ||||||||||||||||||||||||
2501 | if (!CRYPTO_ocb128_aad(&octx->ocb, in, len - trailing_len)
| 0-289 | ||||||||||||||||||||||||
2502 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2503 | } executed 289 times by 1 test: else if (EVP_CIPHER_CTX_encrypting(ctx)end of block Executed by:
| 144-289 | ||||||||||||||||||||||||
2504 | if (!CRYPTO_ocb128_encrypt
| 0-144 | ||||||||||||||||||||||||
2505 | (&octx->ocb, in, out, len - trailing_len)
| 0-144 | ||||||||||||||||||||||||
2506 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2507 | } executed 144 times by 1 test: else {end of block Executed by:
| 144 | ||||||||||||||||||||||||
2508 | if (!CRYPTO_ocb128_decrypt
| 0-145 | ||||||||||||||||||||||||
2509 | (&octx->ocb, in, out, len - trailing_len)
| 0-145 | ||||||||||||||||||||||||
2510 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2511 | } executed 145 times by 1 test: end of block Executed by:
| 145 | ||||||||||||||||||||||||
2512 | written_len += len - trailing_len; | - | ||||||||||||||||||||||||
2513 | in += len - trailing_len; | - | ||||||||||||||||||||||||
2514 | } executed 578 times by 1 test: end of block Executed by:
| 578 | ||||||||||||||||||||||||
2515 | - | |||||||||||||||||||||||||
2516 | - | |||||||||||||||||||||||||
2517 | if (trailing_len > 0
| 336-1034 | ||||||||||||||||||||||||
2518 | memcpy(buf, in, trailing_len); | - | ||||||||||||||||||||||||
2519 | *buf_len = trailing_len; | - | ||||||||||||||||||||||||
2520 | } executed 1034 times by 1 test: end of block Executed by:
| 1034 | ||||||||||||||||||||||||
2521 | - | |||||||||||||||||||||||||
2522 | return executed 1370 times by 1 test: written_len;return written_len; Executed by:
executed 1370 times by 1 test: return written_len; Executed by:
| 1370 | ||||||||||||||||||||||||
2523 | } else { | - | ||||||||||||||||||||||||
2524 | - | |||||||||||||||||||||||||
2525 | - | |||||||||||||||||||||||||
2526 | - | |||||||||||||||||||||||||
2527 | - | |||||||||||||||||||||||||
2528 | if (octx->data_buf_len > 0
| 240-313 | ||||||||||||||||||||||||
2529 | if (EVP_CIPHER_CTX_encrypting(ctx)
| 156-157 | ||||||||||||||||||||||||
2530 | if (!CRYPTO_ocb128_encrypt(&octx->ocb, octx->data_buf, out,
| 0-156 | ||||||||||||||||||||||||
2531 | octx->data_buf_len)
| 0-156 | ||||||||||||||||||||||||
2532 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2533 | } executed 156 times by 1 test: else {end of block Executed by:
| 156 | ||||||||||||||||||||||||
2534 | if (!CRYPTO_ocb128_decrypt(&octx->ocb, octx->data_buf, out,
| 0-157 | ||||||||||||||||||||||||
2535 | octx->data_buf_len)
| 0-157 | ||||||||||||||||||||||||
2536 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2537 | } executed 157 times by 1 test: end of block Executed by:
| 157 | ||||||||||||||||||||||||
2538 | written_len = octx->data_buf_len; | - | ||||||||||||||||||||||||
2539 | octx->data_buf_len = 0; | - | ||||||||||||||||||||||||
2540 | } executed 313 times by 1 test: end of block Executed by:
| 313 | ||||||||||||||||||||||||
2541 | if (octx->aad_buf_len > 0
| 240-313 | ||||||||||||||||||||||||
2542 | if (!CRYPTO_ocb128_aad
| 0-313 | ||||||||||||||||||||||||
2543 | (&octx->ocb, octx->aad_buf, octx->aad_buf_len)
| 0-313 | ||||||||||||||||||||||||
2544 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2545 | octx->aad_buf_len = 0; | - | ||||||||||||||||||||||||
2546 | } executed 313 times by 1 test: end of block Executed by:
| 313 | ||||||||||||||||||||||||
2547 | - | |||||||||||||||||||||||||
2548 | if (!EVP_CIPHER_CTX_encrypting(ctx)
| 276-277 | ||||||||||||||||||||||||
2549 | if (octx->taglen < 0
| 0-277 | ||||||||||||||||||||||||
2550 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2551 | if (CRYPTO_ocb128_finish(&octx->ocb,
| 1-276 | ||||||||||||||||||||||||
2552 | octx->tag, octx->taglen) != 0
| 1-276 | ||||||||||||||||||||||||
2553 | return executed 1 time by 1 test: -1;return -1; Executed by:
executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||||||||
2554 | octx->iv_set = 0; | - | ||||||||||||||||||||||||
2555 | return executed 276 times by 1 test: written_len;return written_len; Executed by:
executed 276 times by 1 test: return written_len; Executed by:
| 276 | ||||||||||||||||||||||||
2556 | } | - | ||||||||||||||||||||||||
2557 | - | |||||||||||||||||||||||||
2558 | if (CRYPTO_ocb128_tag(&octx->ocb, octx->tag, 16) != 1
| 0-276 | ||||||||||||||||||||||||
2559 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
2560 | - | |||||||||||||||||||||||||
2561 | octx->iv_set = 0; | - | ||||||||||||||||||||||||
2562 | return executed 276 times by 1 test: written_len;return written_len; Executed by:
executed 276 times by 1 test: return written_len; Executed by:
| 276 | ||||||||||||||||||||||||
2563 | } | - | ||||||||||||||||||||||||
2564 | } | - | ||||||||||||||||||||||||
2565 | - | |||||||||||||||||||||||||
2566 | static int aes_ocb_cleanup(EVP_CIPHER_CTX *c) | - | ||||||||||||||||||||||||
2567 | { | - | ||||||||||||||||||||||||
2568 | EVP_AES_OCB_CTX *octx = ((EVP_AES_OCB_CTX *)EVP_CIPHER_CTX_get_cipher_data(c)); | - | ||||||||||||||||||||||||
2569 | CRYPTO_ocb128_cleanup(&octx->ocb); | - | ||||||||||||||||||||||||
2570 | return executed 553 times by 1 test: 1;return 1; Executed by:
executed 553 times by 1 test: return 1; Executed by:
| 553 | ||||||||||||||||||||||||
2571 | } | - | ||||||||||||||||||||||||
2572 | - | |||||||||||||||||||||||||
2573 | static const EVP_CIPHER aesni_128_ocb = { 958,16, (0x10003==0x10001?2:1)*128/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x10003, aesni_ocb_init_key, aes_ocb_cipher, aes_ocb_cleanup, sizeof(EVP_AES_OCB_CTX), | - | ||||||||||||||||||||||||
2574 | ((void *)0) | - | ||||||||||||||||||||||||
2575 | , | - | ||||||||||||||||||||||||
2576 | ((void *)0) | - | ||||||||||||||||||||||||
2577 | ,aes_ocb_ctrl, | - | ||||||||||||||||||||||||
2578 | ((void *)0) | - | ||||||||||||||||||||||||
2579 | }; static const EVP_CIPHER aes_128_ocb = { 958,16, (0x10003==0x10001?2:1)*128/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x10003, aes_ocb_init_key, aes_ocb_cipher, aes_ocb_cleanup, sizeof(EVP_AES_OCB_CTX), | - | ||||||||||||||||||||||||
2580 | ((void *)0) | - | ||||||||||||||||||||||||
2581 | , | - | ||||||||||||||||||||||||
2582 | ((void *)0) | - | ||||||||||||||||||||||||
2583 | ,aes_ocb_ctrl, | - | ||||||||||||||||||||||||
2584 | ((void *)0) | - | ||||||||||||||||||||||||
2585 | }; const EVP_CIPHER *EVP_aes_128_ocb(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ocb:&aes_128_ocb; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_128_ocb:&aes_128_ocb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
2586 | - | |||||||||||||||||||||||||
2587 | static const EVP_CIPHER aesni_192_ocb = { 959,16, (0x10003==0x10001?2:1)*192/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x10003, aesni_ocb_init_key, aes_ocb_cipher, aes_ocb_cleanup, sizeof(EVP_AES_OCB_CTX), | - | ||||||||||||||||||||||||
2588 | ((void *)0) | - | ||||||||||||||||||||||||
2589 | , | - | ||||||||||||||||||||||||
2590 | ((void *)0) | - | ||||||||||||||||||||||||
2591 | ,aes_ocb_ctrl, | - | ||||||||||||||||||||||||
2592 | ((void *)0) | - | ||||||||||||||||||||||||
2593 | }; static const EVP_CIPHER aes_192_ocb = { 959,16, (0x10003==0x10001?2:1)*192/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x10003, aes_ocb_init_key, aes_ocb_cipher, aes_ocb_cleanup, sizeof(EVP_AES_OCB_CTX), | - | ||||||||||||||||||||||||
2594 | ((void *)0) | - | ||||||||||||||||||||||||
2595 | , | - | ||||||||||||||||||||||||
2596 | ((void *)0) | - | ||||||||||||||||||||||||
2597 | ,aes_ocb_ctrl, | - | ||||||||||||||||||||||||
2598 | ((void *)0) | - | ||||||||||||||||||||||||
2599 | }; const EVP_CIPHER *EVP_aes_192_ocb(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ocb:&aes_192_ocb; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_192_ocb:&aes_192_ocb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
2600 | - | |||||||||||||||||||||||||
2601 | static const EVP_CIPHER aesni_256_ocb = { 960,16, (0x10003==0x10001?2:1)*256/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x10003, aesni_ocb_init_key, aes_ocb_cipher, aes_ocb_cleanup, sizeof(EVP_AES_OCB_CTX), | - | ||||||||||||||||||||||||
2602 | ((void *)0) | - | ||||||||||||||||||||||||
2603 | , | - | ||||||||||||||||||||||||
2604 | ((void *)0) | - | ||||||||||||||||||||||||
2605 | ,aes_ocb_ctrl, | - | ||||||||||||||||||||||||
2606 | ((void *)0) | - | ||||||||||||||||||||||||
2607 | }; static const EVP_CIPHER aes_256_ocb = { 960,16, (0x10003==0x10001?2:1)*256/8, 12, 0x200000 | (0x1000 | 0x10 | 0x100000 | 0x20 | 0x40 | 0x400)|0x10003, aes_ocb_init_key, aes_ocb_cipher, aes_ocb_cleanup, sizeof(EVP_AES_OCB_CTX), | - | ||||||||||||||||||||||||
2608 | ((void *)0) | - | ||||||||||||||||||||||||
2609 | , | - | ||||||||||||||||||||||||
2610 | ((void *)0) | - | ||||||||||||||||||||||||
2611 | ,aes_ocb_ctrl, | - | ||||||||||||||||||||||||
2612 | ((void *)0) | - | ||||||||||||||||||||||||
2613 | }; const EVP_CIPHER *EVP_aes_256_ocb(void) { return executed 1962 times by 1 test: (return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ocb:&aes_256_ocb; Executed by:
executed 1962 times by 1 test: }return (OPENSSL_ia32cap_P[1]&(1<<(57-32)))?&aesni_256_ocb:&aes_256_ocb; Executed by:
| 0-1962 | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |