Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/evp/evp_aead.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | size_t | - | ||||||
5 | EVP_AEAD_key_length(const EVP_AEAD *aead) | - | ||||||
6 | { | - | ||||||
7 | return executed 138 times by 2 tests: aead->key_len;return aead->key_len; Executed by:
executed 138 times by 2 tests: return aead->key_len; Executed by:
| 138 | ||||||
8 | } | - | ||||||
9 | - | |||||||
10 | size_t | - | ||||||
11 | EVP_AEAD_nonce_length(const EVP_AEAD *aead) | - | ||||||
12 | { | - | ||||||
13 | return executed 160 times by 2 tests: aead->nonce_len;return aead->nonce_len; Executed by:
executed 160 times by 2 tests: return aead->nonce_len; Executed by:
| 160 | ||||||
14 | } | - | ||||||
15 | - | |||||||
16 | size_t | - | ||||||
17 | EVP_AEAD_max_overhead(const EVP_AEAD *aead) | - | ||||||
18 | { | - | ||||||
19 | return executed 92 times by 2 tests: aead->overhead;return aead->overhead; Executed by:
executed 92 times by 2 tests: return aead->overhead; Executed by:
| 92 | ||||||
20 | } | - | ||||||
21 | - | |||||||
22 | size_t | - | ||||||
23 | EVP_AEAD_max_tag_len(const EVP_AEAD *aead) | - | ||||||
24 | { | - | ||||||
25 | return never executed: aead->max_tag_len;return aead->max_tag_len; never executed: return aead->max_tag_len; | 0 | ||||||
26 | } | - | ||||||
27 | - | |||||||
28 | int | - | ||||||
29 | EVP_AEAD_CTX_init(EVP_AEAD_CTX *ctx, const EVP_AEAD *aead, | - | ||||||
30 | const unsigned char *key, size_t key_len, size_t tag_len, ENGINE *impl) | - | ||||||
31 | { | - | ||||||
32 | ctx->aead = aead; | - | ||||||
33 | if (key_len != aead->key_len
| 0-100 | ||||||
34 | ERR_put_error(6,(0xfff),(108),__FILE__,56); | - | ||||||
35 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
36 | } | - | ||||||
37 | return executed 100 times by 3 tests: aead->init(ctx, key, key_len, tag_len);return aead->init(ctx, key, key_len, tag_len); Executed by:
executed 100 times by 3 tests: return aead->init(ctx, key, key_len, tag_len); Executed by:
| 100 | ||||||
38 | } | - | ||||||
39 | - | |||||||
40 | void | - | ||||||
41 | EVP_AEAD_CTX_cleanup(EVP_AEAD_CTX *ctx) | - | ||||||
42 | { | - | ||||||
43 | if (ctx->aead ==
| 0-100 | ||||||
44 | ((void *)0)
| 0-100 | ||||||
45 | ) | - | ||||||
46 | return; never executed: return; | 0 | ||||||
47 | ctx->aead->cleanup(ctx); | - | ||||||
48 | ctx->aead = | - | ||||||
49 | ((void *)0) | - | ||||||
50 | ; | - | ||||||
51 | } executed 100 times by 3 tests: end of block Executed by:
| 100 | ||||||
52 | static int | - | ||||||
53 | check_alias(const unsigned char *in, size_t in_len, const unsigned char *out) | - | ||||||
54 | { | - | ||||||
55 | if (out <= in
| 8-230 | ||||||
56 | return executed 230 times by 3 tests: 1;return 1; Executed by:
executed 230 times by 3 tests: return 1; Executed by:
| 230 | ||||||
57 | if (in + in_len <= out
| 0-8 | ||||||
58 | return executed 8 times by 1 test: 1;return 1; Executed by:
executed 8 times by 1 test: return 1; Executed by:
| 8 | ||||||
59 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
60 | } | - | ||||||
61 | - | |||||||
62 | int | - | ||||||
63 | EVP_AEAD_CTX_seal(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len, | - | ||||||
64 | size_t max_out_len, const unsigned char *nonce, size_t nonce_len, | - | ||||||
65 | const unsigned char *in, size_t in_len, const unsigned char *ad, | - | ||||||
66 | size_t ad_len) | - | ||||||
67 | { | - | ||||||
68 | size_t possible_out_len = in_len + ctx->aead->overhead; | - | ||||||
69 | - | |||||||
70 | - | |||||||
71 | if (possible_out_len < in_len
| 0-138 | ||||||
72 | ERR_put_error(6,(0xfff),(164),__FILE__,99); | - | ||||||
73 | goto never executed: error;goto error; never executed: goto error; | 0 | ||||||
74 | } | - | ||||||
75 | - | |||||||
76 | if (!check_alias(in, in_len, out)
| 0-138 | ||||||
77 | ERR_put_error(6,(0xfff),(172),__FILE__,104); | - | ||||||
78 | goto never executed: error;goto error; never executed: goto error; | 0 | ||||||
79 | } | - | ||||||
80 | - | |||||||
81 | if (ctx->aead->seal(ctx, out, out_len, max_out_len, nonce, nonce_len,
| 0-138 | ||||||
82 | in, in_len, ad, ad_len)
| 0-138 | ||||||
83 | return executed 138 times by 3 tests: 1;return 1; Executed by:
executed 138 times by 3 tests: return 1; Executed by:
| 138 | ||||||
84 | } | - | ||||||
85 | - | |||||||
86 | error: code before this statement never executed: error: | 0 | ||||||
87 | - | |||||||
88 | - | |||||||
89 | memset(out, 0, max_out_len); | - | ||||||
90 | *out_len = 0; | - | ||||||
91 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
92 | } | - | ||||||
93 | - | |||||||
94 | int | - | ||||||
95 | EVP_AEAD_CTX_open(const EVP_AEAD_CTX *ctx, unsigned char *out, size_t *out_len, | - | ||||||
96 | size_t max_out_len, const unsigned char *nonce, size_t nonce_len, | - | ||||||
97 | const unsigned char *in, size_t in_len, const unsigned char *ad, | - | ||||||
98 | size_t ad_len) | - | ||||||
99 | { | - | ||||||
100 | if (!check_alias(in, in_len, out)
| 0-100 | ||||||
101 | ERR_put_error(6,(0xfff),(172),__FILE__,128); | - | ||||||
102 | goto never executed: error;goto error; never executed: goto error; | 0 | ||||||
103 | } | - | ||||||
104 | - | |||||||
105 | if (ctx->aead->open(ctx, out, out_len, max_out_len, nonce, nonce_len,
| 8-92 | ||||||
106 | in, in_len, ad, ad_len)
| 8-92 | ||||||
107 | return executed 92 times by 3 tests: 1;return 1; Executed by:
executed 92 times by 3 tests: return 1; Executed by:
| 92 | ||||||
108 | } | - | ||||||
109 | - | |||||||
110 | error: code before this statement executed 8 times by 1 test: error: Executed by:
| 8 | ||||||
111 | - | |||||||
112 | - | |||||||
113 | - | |||||||
114 | memset(out, 0, max_out_len); | - | ||||||
115 | *out_len = 0; | - | ||||||
116 | return executed 8 times by 1 test: 0;return 0; Executed by:
executed 8 times by 1 test: return 0; Executed by:
| 8 | ||||||
117 | } | - | ||||||
Switch to Source code | Preprocessed file |