Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/include/internal/md32_common.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | int SHA256_Update(SHA256_CTX *c, const void *data_, size_t len) | - | ||||||||||||||||||||||||||||||
2 | { | - | ||||||||||||||||||||||||||||||
3 | const unsigned char *data = data_; | - | ||||||||||||||||||||||||||||||
4 | unsigned char *p; | - | ||||||||||||||||||||||||||||||
5 | unsigned int l; | - | ||||||||||||||||||||||||||||||
6 | size_t n; | - | ||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||
8 | if (len == 0
| 612-1308473 | ||||||||||||||||||||||||||||||
9 | return executed 612 times by 2 tests: 1;return 1; Executed by:
executed 612 times by 2 tests: return 1; Executed by:
| 612 | ||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||
11 | l = (c->Nl + (((unsigned int) len) << 3)) & 0xffffffffUL; | - | ||||||||||||||||||||||||||||||
12 | if (l < c->Nl
| 0-1308473 | ||||||||||||||||||||||||||||||
13 | c->Nh++; never executed: c->Nh++; | 0 | ||||||||||||||||||||||||||||||
14 | c->Nh += (unsigned int) (len >> 29); | - | ||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||
16 | c->Nl = l; | - | ||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||
18 | n = c->num; | - | ||||||||||||||||||||||||||||||
19 | if (n != 0
| 613278-695195 | ||||||||||||||||||||||||||||||
20 | p = (unsigned char *)c->data; | - | ||||||||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||||||||
22 | if (len >= (16*4)
| 38028-657167 | ||||||||||||||||||||||||||||||
23 | memcpy(p + n, data, (16*4) - n); | - | ||||||||||||||||||||||||||||||
24 | sha256_block_data_order(c, p, 1); | - | ||||||||||||||||||||||||||||||
25 | n = (16*4) - n; | - | ||||||||||||||||||||||||||||||
26 | data += n; | - | ||||||||||||||||||||||||||||||
27 | len -= n; | - | ||||||||||||||||||||||||||||||
28 | c->num = 0; | - | ||||||||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||
32 | - | |||||||||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||||||||
35 | memset(p, 0, (16*4)); | - | ||||||||||||||||||||||||||||||
36 | } executed 287882 times by 2 tests: else {end of block Executed by:
| 287882 | ||||||||||||||||||||||||||||||
37 | memcpy(p + n, data, len); | - | ||||||||||||||||||||||||||||||
38 | c->num += (unsigned int)len; | - | ||||||||||||||||||||||||||||||
39 | return executed 407313 times by 2 tests: 1;return 1; Executed by:
executed 407313 times by 2 tests: return 1; Executed by:
| 407313 | ||||||||||||||||||||||||||||||
40 | } | - | ||||||||||||||||||||||||||||||
41 | } | - | ||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||
43 | n = len / (16*4); | - | ||||||||||||||||||||||||||||||
44 | if (n > 0
| 147219-753941 | ||||||||||||||||||||||||||||||
45 | sha256_block_data_order(c, data, n); | - | ||||||||||||||||||||||||||||||
46 | n *= (16*4); | - | ||||||||||||||||||||||||||||||
47 | data += n; | - | ||||||||||||||||||||||||||||||
48 | len -= n; | - | ||||||||||||||||||||||||||||||
49 | } executed 147219 times by 2 tests: end of block Executed by:
| 147219 | ||||||||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||||||||
51 | if (len != 0
| 75184-825976 | ||||||||||||||||||||||||||||||
52 | p = (unsigned char *)c->data; | - | ||||||||||||||||||||||||||||||
53 | c->num = (unsigned int)len; | - | ||||||||||||||||||||||||||||||
54 | memcpy(p, data, len); | - | ||||||||||||||||||||||||||||||
55 | } executed 825976 times by 2 tests: end of block Executed by:
| 825976 | ||||||||||||||||||||||||||||||
56 | return executed 901160 times by 2 tests: 1;return 1; Executed by:
executed 901160 times by 2 tests: return 1; Executed by:
| 901160 | ||||||||||||||||||||||||||||||
57 | } | - | ||||||||||||||||||||||||||||||
58 | - | |||||||||||||||||||||||||||||||
59 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data) | - | ||||||||||||||||||||||||||||||
60 | { | - | ||||||||||||||||||||||||||||||
61 | sha256_block_data_order(c, data, 1); | - | ||||||||||||||||||||||||||||||
62 | } executed 4138 times by 1 test: end of block Executed by:
| 4138 | ||||||||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||||||||
64 | int SHA256_Final(unsigned char *md, SHA256_CTX *c) | - | ||||||||||||||||||||||||||||||
65 | { | - | ||||||||||||||||||||||||||||||
66 | unsigned char *p = (unsigned char *)c->data; | - | ||||||||||||||||||||||||||||||
67 | size_t n = c->num; | - | ||||||||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||||||||
69 | p[n] = 0x80; | - | ||||||||||||||||||||||||||||||
70 | n++; | - | ||||||||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||||||||
72 | if (n > ((16*4) - 8)
| 68500-506394 | ||||||||||||||||||||||||||||||
73 | memset(p + n, 0, (16*4) - n); | - | ||||||||||||||||||||||||||||||
74 | n = 0; | - | ||||||||||||||||||||||||||||||
75 | sha256_block_data_order(c, p, 1); | - | ||||||||||||||||||||||||||||||
76 | } executed 68500 times by 1 test: end of block Executed by:
| 68500 | ||||||||||||||||||||||||||||||
77 | memset(p + n, 0, (16*4) - 8 - n); | - | ||||||||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||||||||
79 | p += (16*4) - 8; | - | ||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||
81 | (void)(*((p)++)=(unsigned char)(((c->Nh)>>24)&0xff), *((p)++)=(unsigned char)(((c->Nh)>>16)&0xff), *((p)++)=(unsigned char)(((c->Nh)>> 8)&0xff), *((p)++)=(unsigned char)(((c->Nh) )&0xff), c->Nh); | - | ||||||||||||||||||||||||||||||
82 | (void)(*((p)++)=(unsigned char)(((c->Nl)>>24)&0xff), *((p)++)=(unsigned char)(((c->Nl)>>16)&0xff), *((p)++)=(unsigned char)(((c->Nl)>> 8)&0xff), *((p)++)=(unsigned char)(((c->Nl) )&0xff), c->Nl); | - | ||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||||||||
87 | p -= (16*4); | - | ||||||||||||||||||||||||||||||
88 | sha256_block_data_order(c, p, 1); | - | ||||||||||||||||||||||||||||||
89 | c->num = 0; | - | ||||||||||||||||||||||||||||||
90 | OPENSSL_cleanse(p, (16*4)); | - | ||||||||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||||||||
95 | do { unsigned long ll; unsigned int nn; switch ((c)->md_len) { case executed 51 times by 1 test: 28:case 28: Executed by:
executed 51 times by 1 test: for (nn=0;nn<28/4case 28: Executed by:
executed 357 times by 1 test: break;end of block Executed by:
executed 51 times by 1 test: casebreak; Executed by:
executed 360611 times by 2 tests: 32:case 32: Executed by:
executed 360611 times by 2 tests: for (nn=0;nn<32/4case 32: Executed by:
executed 2884888 times by 2 tests: break;end of block Executed by:
executed 360611 times by 2 tests: defaultbreak; Executed by:
never executed: :default: never executed: if ((default:
never executed: 0;return 0; never executed: for (nn=0;nn<(c)->md_len/4return 0;
never executed: break;end of block never executed: } } while (0);break; | 0-2884888 | ||||||||||||||||||||||||||||||
96 | - | |||||||||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||||||||
98 | return executed 574894 times by 2 tests: 1;return 1; Executed by:
executed 574894 times by 2 tests: return 1; Executed by:
| 574894 | ||||||||||||||||||||||||||||||
99 | } | - | ||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |