Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/m_sha1.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | static int init(EVP_MD_CTX *ctx) | - | ||||||
5 | { | - | ||||||
6 | return executed 69553 times by 1 test: SHA1_Init(EVP_MD_CTX_md_data(ctx));return SHA1_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 69553 times by 1 test: return SHA1_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 69553 | ||||||
7 | } | - | ||||||
8 | - | |||||||
9 | static int update(EVP_MD_CTX *ctx, const void *data, size_t count) | - | ||||||
10 | { | - | ||||||
11 | return executed 178243 times by 1 test: SHA1_Update(EVP_MD_CTX_md_data(ctx), data, count);return SHA1_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
executed 178243 times by 1 test: return SHA1_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
| 178243 | ||||||
12 | } | - | ||||||
13 | - | |||||||
14 | static int final(EVP_MD_CTX *ctx, unsigned char *md) | - | ||||||
15 | { | - | ||||||
16 | return executed 149975 times by 1 test: SHA1_Final(md, EVP_MD_CTX_md_data(ctx));return SHA1_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
executed 149975 times by 1 test: return SHA1_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
| 149975 | ||||||
17 | } | - | ||||||
18 | - | |||||||
19 | static int ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms) | - | ||||||
20 | { | - | ||||||
21 | unsigned char padtmp[40]; | - | ||||||
22 | unsigned char sha1tmp[20]; | - | ||||||
23 | - | |||||||
24 | SHA_CTX *sha1; | - | ||||||
25 | - | |||||||
26 | if (cmd != 0x1d
| 0-3 | ||||||
27 | return executed 3 times by 1 test: -2;return -2; Executed by:
executed 3 times by 1 test: return -2; Executed by:
| 3 | ||||||
28 | - | |||||||
29 | if (ctx ==
| 0 | ||||||
30 | ((void *)0)
| 0 | ||||||
31 | ) | - | ||||||
32 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
33 | - | |||||||
34 | sha1 = EVP_MD_CTX_md_data(ctx); | - | ||||||
35 | - | |||||||
36 | - | |||||||
37 | if (mslen != 48
| 0 | ||||||
38 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
39 | - | |||||||
40 | - | |||||||
41 | - | |||||||
42 | - | |||||||
43 | - | |||||||
44 | if (SHA1_Update(sha1, ms, mslen) <= 0
| 0 | ||||||
45 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
46 | - | |||||||
47 | - | |||||||
48 | memset(padtmp, 0x36, sizeof(padtmp)); | - | ||||||
49 | - | |||||||
50 | if (!SHA1_Update(sha1, padtmp, sizeof(padtmp))
| 0 | ||||||
51 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
52 | - | |||||||
53 | if (!SHA1_Final(sha1tmp, sha1)
| 0 | ||||||
54 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
55 | - | |||||||
56 | - | |||||||
57 | - | |||||||
58 | if (!SHA1_Init(sha1)
| 0 | ||||||
59 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
60 | - | |||||||
61 | if (SHA1_Update(sha1, ms, mslen) <= 0
| 0 | ||||||
62 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
63 | - | |||||||
64 | - | |||||||
65 | memset(padtmp, 0x5c, sizeof(padtmp)); | - | ||||||
66 | - | |||||||
67 | if (!SHA1_Update(sha1, padtmp, sizeof(padtmp))
| 0 | ||||||
68 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
69 | - | |||||||
70 | if (!SHA1_Update(sha1, sha1tmp, sizeof(sha1tmp))
| 0 | ||||||
71 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||
72 | - | |||||||
73 | - | |||||||
74 | OPENSSL_cleanse(sha1tmp, sizeof(sha1tmp)); | - | ||||||
75 | - | |||||||
76 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||
77 | - | |||||||
78 | } | - | ||||||
79 | - | |||||||
80 | static const EVP_MD sha1_md = { | - | ||||||
81 | 64, | - | ||||||
82 | 65, | - | ||||||
83 | 20, | - | ||||||
84 | 0x0008, | - | ||||||
85 | init, | - | ||||||
86 | update, | - | ||||||
87 | final, | - | ||||||
88 | - | |||||||
89 | ((void *)0) | - | ||||||
90 | , | - | ||||||
91 | - | |||||||
92 | ((void *)0) | - | ||||||
93 | , | - | ||||||
94 | (16*4), | - | ||||||
95 | sizeof(EVP_MD *) + sizeof(SHA_CTX), | - | ||||||
96 | ctrl | - | ||||||
97 | }; | - | ||||||
98 | - | |||||||
99 | const EVP_MD *EVP_sha1(void) | - | ||||||
100 | { | - | ||||||
101 | return executed 102544 times by 1 test: &sha1_md;return &sha1_md; Executed by:
executed 102544 times by 1 test: return &sha1_md; Executed by:
| 102544 | ||||||
102 | } | - | ||||||
103 | - | |||||||
104 | static int init224(EVP_MD_CTX *ctx) | - | ||||||
105 | { | - | ||||||
106 | return executed 51 times by 1 test: SHA224_Init(EVP_MD_CTX_md_data(ctx));return SHA224_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 51 times by 1 test: return SHA224_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 51 | ||||||
107 | } | - | ||||||
108 | - | |||||||
109 | static int update224(EVP_MD_CTX *ctx, const void *data, size_t count) | - | ||||||
110 | { | - | ||||||
111 | return executed 15681 times by 1 test: SHA224_Update(EVP_MD_CTX_md_data(ctx), data, count);return SHA224_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
executed 15681 times by 1 test: return SHA224_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
| 15681 | ||||||
112 | } | - | ||||||
113 | - | |||||||
114 | static int final224(EVP_MD_CTX *ctx, unsigned char *md) | - | ||||||
115 | { | - | ||||||
116 | return executed 51 times by 1 test: SHA224_Final(md, EVP_MD_CTX_md_data(ctx));return SHA224_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
executed 51 times by 1 test: return SHA224_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
| 51 | ||||||
117 | } | - | ||||||
118 | - | |||||||
119 | static int init256(EVP_MD_CTX *ctx) | - | ||||||
120 | { | - | ||||||
121 | return executed 276922 times by 2 tests: SHA256_Init(EVP_MD_CTX_md_data(ctx));return SHA256_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 276922 times by 2 tests: return SHA256_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 276922 | ||||||
122 | } | - | ||||||
123 | - | |||||||
124 | static int update256(EVP_MD_CTX *ctx, const void *data, size_t count) | - | ||||||
125 | { | - | ||||||
126 | return executed 978004 times by 2 tests: SHA256_Update(EVP_MD_CTX_md_data(ctx), data, count);return SHA256_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
executed 978004 times by 2 tests: return SHA256_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
| 978004 | ||||||
127 | } | - | ||||||
128 | - | |||||||
129 | static int final256(EVP_MD_CTX *ctx, unsigned char *md) | - | ||||||
130 | { | - | ||||||
131 | return executed 332776 times by 2 tests: SHA256_Final(md, EVP_MD_CTX_md_data(ctx));return SHA256_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
executed 332776 times by 2 tests: return SHA256_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
| 332776 | ||||||
132 | } | - | ||||||
133 | - | |||||||
134 | static const EVP_MD sha224_md = { | - | ||||||
135 | 675, | - | ||||||
136 | 671, | - | ||||||
137 | 28, | - | ||||||
138 | 0x0008, | - | ||||||
139 | init224, | - | ||||||
140 | update224, | - | ||||||
141 | final224, | - | ||||||
142 | - | |||||||
143 | ((void *)0) | - | ||||||
144 | , | - | ||||||
145 | - | |||||||
146 | ((void *)0) | - | ||||||
147 | , | - | ||||||
148 | (16*4), | - | ||||||
149 | sizeof(EVP_MD *) + sizeof(SHA256_CTX), | - | ||||||
150 | }; | - | ||||||
151 | - | |||||||
152 | const EVP_MD *EVP_sha224(void) | - | ||||||
153 | { | - | ||||||
154 | return executed 3927 times by 1 test: &sha224_md;return &sha224_md; Executed by:
executed 3927 times by 1 test: return &sha224_md; Executed by:
| 3927 | ||||||
155 | } | - | ||||||
156 | - | |||||||
157 | static const EVP_MD sha256_md = { | - | ||||||
158 | 672, | - | ||||||
159 | 668, | - | ||||||
160 | 32, | - | ||||||
161 | 0x0008, | - | ||||||
162 | init256, | - | ||||||
163 | update256, | - | ||||||
164 | final256, | - | ||||||
165 | - | |||||||
166 | ((void *)0) | - | ||||||
167 | , | - | ||||||
168 | - | |||||||
169 | ((void *)0) | - | ||||||
170 | , | - | ||||||
171 | (16*4), | - | ||||||
172 | sizeof(EVP_MD *) + sizeof(SHA256_CTX), | - | ||||||
173 | }; | - | ||||||
174 | - | |||||||
175 | const EVP_MD *EVP_sha256(void) | - | ||||||
176 | { | - | ||||||
177 | return executed 11264 times by 2 tests: &sha256_md;return &sha256_md; Executed by:
executed 11264 times by 2 tests: return &sha256_md; Executed by:
| 11264 | ||||||
178 | } | - | ||||||
179 | - | |||||||
180 | static int init512_224(EVP_MD_CTX *ctx) | - | ||||||
181 | { | - | ||||||
182 | return executed 7 times by 1 test: sha512_224_init(EVP_MD_CTX_md_data(ctx));return sha512_224_init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 7 times by 1 test: return sha512_224_init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 7 | ||||||
183 | } | - | ||||||
184 | - | |||||||
185 | static int init512_256(EVP_MD_CTX *ctx) | - | ||||||
186 | { | - | ||||||
187 | return executed 7 times by 1 test: sha512_256_init(EVP_MD_CTX_md_data(ctx));return sha512_256_init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 7 times by 1 test: return sha512_256_init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 7 | ||||||
188 | } | - | ||||||
189 | - | |||||||
190 | static int init384(EVP_MD_CTX *ctx) | - | ||||||
191 | { | - | ||||||
192 | return executed 66329 times by 1 test: SHA384_Init(EVP_MD_CTX_md_data(ctx));return SHA384_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 66329 times by 1 test: return SHA384_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 66329 | ||||||
193 | } | - | ||||||
194 | - | |||||||
195 | static int update384(EVP_MD_CTX *ctx, const void *data, size_t count) | - | ||||||
196 | { | - | ||||||
197 | return executed 190411 times by 1 test: SHA384_Update(EVP_MD_CTX_md_data(ctx), data, count);return SHA384_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
executed 190411 times by 1 test: return SHA384_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
| 190411 | ||||||
198 | } | - | ||||||
199 | - | |||||||
200 | static int final384(EVP_MD_CTX *ctx, unsigned char *md) | - | ||||||
201 | { | - | ||||||
202 | return executed 86807 times by 1 test: SHA384_Final(md, EVP_MD_CTX_md_data(ctx));return SHA384_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
executed 86807 times by 1 test: return SHA384_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
| 86807 | ||||||
203 | } | - | ||||||
204 | - | |||||||
205 | static int init512(EVP_MD_CTX *ctx) | - | ||||||
206 | { | - | ||||||
207 | return executed 233813 times by 1 test: SHA512_Init(EVP_MD_CTX_md_data(ctx));return SHA512_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
executed 233813 times by 1 test: return SHA512_Init(EVP_MD_CTX_md_data(ctx)); Executed by:
| 233813 | ||||||
208 | } | - | ||||||
209 | - | |||||||
210 | - | |||||||
211 | static int update512(EVP_MD_CTX *ctx, const void *data, size_t count) | - | ||||||
212 | { | - | ||||||
213 | return executed 853277 times by 1 test: SHA512_Update(EVP_MD_CTX_md_data(ctx), data, count);return SHA512_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
executed 853277 times by 1 test: return SHA512_Update(EVP_MD_CTX_md_data(ctx), data, count); Executed by:
| 853277 | ||||||
214 | } | - | ||||||
215 | - | |||||||
216 | static int final512(EVP_MD_CTX *ctx, unsigned char *md) | - | ||||||
217 | { | - | ||||||
218 | return executed 258396 times by 1 test: SHA512_Final(md, EVP_MD_CTX_md_data(ctx));return SHA512_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
executed 258396 times by 1 test: return SHA512_Final(md, EVP_MD_CTX_md_data(ctx)); Executed by:
| 258396 | ||||||
219 | } | - | ||||||
220 | - | |||||||
221 | static const EVP_MD sha512_224_md = { | - | ||||||
222 | 1094, | - | ||||||
223 | 1145, | - | ||||||
224 | 28, | - | ||||||
225 | 0x0008, | - | ||||||
226 | init512_224, | - | ||||||
227 | update512, | - | ||||||
228 | final512, | - | ||||||
229 | - | |||||||
230 | ((void *)0) | - | ||||||
231 | , | - | ||||||
232 | - | |||||||
233 | ((void *)0) | - | ||||||
234 | , | - | ||||||
235 | (16*8), | - | ||||||
236 | sizeof(EVP_MD *) + sizeof(SHA512_CTX), | - | ||||||
237 | }; | - | ||||||
238 | - | |||||||
239 | const EVP_MD *EVP_sha512_224(void) | - | ||||||
240 | { | - | ||||||
241 | return executed 1969 times by 1 test: &sha512_224_md;return &sha512_224_md; Executed by:
executed 1969 times by 1 test: return &sha512_224_md; Executed by:
| 1969 | ||||||
242 | } | - | ||||||
243 | - | |||||||
244 | static const EVP_MD sha512_256_md = { | - | ||||||
245 | 1095, | - | ||||||
246 | 1146, | - | ||||||
247 | 32, | - | ||||||
248 | 0x0008, | - | ||||||
249 | init512_256, | - | ||||||
250 | update512, | - | ||||||
251 | final512, | - | ||||||
252 | - | |||||||
253 | ((void *)0) | - | ||||||
254 | , | - | ||||||
255 | - | |||||||
256 | ((void *)0) | - | ||||||
257 | , | - | ||||||
258 | (16*8), | - | ||||||
259 | sizeof(EVP_MD *) + sizeof(SHA512_CTX), | - | ||||||
260 | }; | - | ||||||
261 | - | |||||||
262 | const EVP_MD *EVP_sha512_256(void) | - | ||||||
263 | { | - | ||||||
264 | return executed 1969 times by 1 test: &sha512_256_md;return &sha512_256_md; Executed by:
executed 1969 times by 1 test: return &sha512_256_md; Executed by:
| 1969 | ||||||
265 | } | - | ||||||
266 | - | |||||||
267 | static const EVP_MD sha384_md = { | - | ||||||
268 | 673, | - | ||||||
269 | 669, | - | ||||||
270 | 48, | - | ||||||
271 | 0x0008, | - | ||||||
272 | init384, | - | ||||||
273 | update384, | - | ||||||
274 | final384, | - | ||||||
275 | - | |||||||
276 | ((void *)0) | - | ||||||
277 | , | - | ||||||
278 | - | |||||||
279 | ((void *)0) | - | ||||||
280 | , | - | ||||||
281 | (16*8), | - | ||||||
282 | sizeof(EVP_MD *) + sizeof(SHA512_CTX), | - | ||||||
283 | }; | - | ||||||
284 | - | |||||||
285 | const EVP_MD *EVP_sha384(void) | - | ||||||
286 | { | - | ||||||
287 | return executed 3927 times by 1 test: &sha384_md;return &sha384_md; Executed by:
executed 3927 times by 1 test: return &sha384_md; Executed by:
| 3927 | ||||||
288 | } | - | ||||||
289 | - | |||||||
290 | static const EVP_MD sha512_md = { | - | ||||||
291 | 674, | - | ||||||
292 | 670, | - | ||||||
293 | 64, | - | ||||||
294 | 0x0008, | - | ||||||
295 | init512, | - | ||||||
296 | update512, | - | ||||||
297 | final512, | - | ||||||
298 | - | |||||||
299 | ((void *)0) | - | ||||||
300 | , | - | ||||||
301 | - | |||||||
302 | ((void *)0) | - | ||||||
303 | , | - | ||||||
304 | (16*8), | - | ||||||
305 | sizeof(EVP_MD *) + sizeof(SHA512_CTX), | - | ||||||
306 | }; | - | ||||||
307 | - | |||||||
308 | const EVP_MD *EVP_sha512(void) | - | ||||||
309 | { | - | ||||||
310 | return executed 3937 times by 1 test: &sha512_md;return &sha512_md; Executed by:
executed 3937 times by 1 test: return &sha512_md; Executed by:
| 3937 | ||||||
311 | } | - | ||||||
Switch to Source code | Preprocessed file |