Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/des/cfb_enc.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | - | ||||||||||||
2 | long length, DES_key_schedule *schedule, | - | ||||||||||||
3 | DES_cblock *ivec, int enc) | - | ||||||||||||
4 | { | - | ||||||||||||
5 | register DES_LONG d0, d1, v0, v1; | - | ||||||||||||
6 | register unsigned long l = length; | - | ||||||||||||
7 | register int num = numbits / 8, n = (numbits + 7) / 8, i, rem = | - | ||||||||||||
8 | numbits % 8; | - | ||||||||||||
9 | DES_LONG ti[2]; | - | ||||||||||||
10 | unsigned char *iv; | - | ||||||||||||
11 | - | |||||||||||||
12 | - | |||||||||||||
13 | - | |||||||||||||
14 | unsigned int sh[4]; | - | ||||||||||||
15 | unsigned char *ovec = (unsigned char *)sh; | - | ||||||||||||
16 | - | |||||||||||||
17 | - | |||||||||||||
18 | - | |||||||||||||
19 | ((void) (0)) | - | ||||||||||||
20 | ; | - | ||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | - | |||||||||||||
24 | - | |||||||||||||
25 | if (numbits <= 0
| 0-31420 | ||||||||||||
26 | return; never executed: return; | 0 | ||||||||||||
27 | iv = &(*ivec)[0]; | - | ||||||||||||
28 | (v0 =((DES_LONG)(*((iv)++))) , v0|=((DES_LONG)(*((iv)++)))<< 8L, v0|=((DES_LONG)(*((iv)++)))<<16L, v0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||||||||
29 | (v1 =((DES_LONG)(*((iv)++))) , v1|=((DES_LONG)(*((iv)++)))<< 8L, v1|=((DES_LONG)(*((iv)++)))<<16L, v1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||||||||
30 | if (enc
| 15710 | ||||||||||||
31 | while (l >= (unsigned long)n
| 15710-17713 | ||||||||||||
32 | l -= n; | - | ||||||||||||
33 | ti[0] = v0; | - | ||||||||||||
34 | ti[1] = v1; | - | ||||||||||||
35 | DES_encrypt1((DES_LONG *)ti, schedule, 1); | - | ||||||||||||
36 | { in+=n; d0=d1=0; switch (n) { case executed 3 times by 1 test: 8:case 8: Executed by:
executed 3 times by 1 test: d1 =((DES_LONG)(*(--(in))))<<24L; casecase 8: Executed by:
never executed: case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: d1|=((DES_LONG)(*(--(in))))<<16L; casecase 7: executed 4 times by 1 test: 6:case 6: Executed by:
executed 4 times by 1 test: case 6: Executed by:
code before this statement executed 3 times by 1 test: d1|=((DES_LONG)(*(--(in))))<< 8L; casecase 6: Executed by:
never executed: case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: 5:case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: d1|=((DES_LONG)(*(--(in)))); casecase 5: executed 6 times by 1 test: 4:case 4: Executed by:
executed 6 times by 1 test: case 4: Executed by:
code before this statement executed 7 times by 1 test: d0 =((DES_LONG)(*(--(in))))<<24L; casecase 4: Executed by:
never executed: case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: d0|=((DES_LONG)(*(--(in))))<<16L; casecase 3: executed 12 times by 1 test: 2:case 2: Executed by:
executed 12 times by 1 test: case 2: Executed by:
code before this statement executed 13 times by 1 test: d0|=((DES_LONG)(*(--(in))))<< 8L; casecase 2: Executed by:
executed 17713 times by 1 test: 1:case 1: Executed by:
executed 17713 times by 1 test: case 1: Executed by:
code before this statement executed 25 times by 1 test: d0|=((DES_LONG)(*(--(in)))); }case 1: Executed by:
executed 17713 times by 1 test: };end of block Executed by:
| 0-17713 | ||||||||||||
37 | in += n; | - | ||||||||||||
38 | d0 ^= ti[0]; | - | ||||||||||||
39 | d1 ^= ti[1]; | - | ||||||||||||
40 | { out+=n; switch (n) { case executed 3 times by 1 test: 8:case 8: Executed by:
executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8: Executed by:
never executed: case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7: executed 4 times by 1 test: 6:case 6: Executed by:
executed 4 times by 1 test: case 6: Executed by:
code before this statement executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6: Executed by:
never executed: case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: 5:case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5: executed 6 times by 1 test: 4:case 4: Executed by:
executed 6 times by 1 test: case 4: Executed by:
code before this statement executed 7 times by 1 test: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4: Executed by:
never executed: case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3: executed 12 times by 1 test: 2:case 2: Executed by:
executed 12 times by 1 test: case 2: Executed by:
code before this statement executed 13 times by 1 test: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2: Executed by:
executed 17713 times by 1 test: 1:case 1: Executed by:
executed 17713 times by 1 test: case 1: Executed by:
code before this statement executed 25 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1: Executed by:
executed 17713 times by 1 test: };end of block Executed by:
| 0-17713 | ||||||||||||
41 | out += n; | - | ||||||||||||
42 | - | |||||||||||||
43 | - | |||||||||||||
44 | - | |||||||||||||
45 | - | |||||||||||||
46 | if (numbits == 32
| 6-17707 | ||||||||||||
47 | v0 = v1; | - | ||||||||||||
48 | v1 = d0; | - | ||||||||||||
49 | } executed 6 times by 1 test: else if (numbits == 64end of block Executed by:
| 3-17704 | ||||||||||||
50 | v0 = d0; | - | ||||||||||||
51 | v1 = d1; | - | ||||||||||||
52 | } executed 3 times by 1 test: else {end of block Executed by:
| 3 | ||||||||||||
53 | - | |||||||||||||
54 | - | |||||||||||||
55 | - | |||||||||||||
56 | - | |||||||||||||
57 | - | |||||||||||||
58 | - | |||||||||||||
59 | - | |||||||||||||
60 | sh[0] = v0, sh[1] = v1, sh[2] = d0, sh[3] = d1; | - | ||||||||||||
61 | - | |||||||||||||
62 | if (rem == 0
| 2024-15680 | ||||||||||||
63 | memmove(ovec, ovec + num, 8); executed 2024 times by 1 test: memmove(ovec, ovec + num, 8); Executed by:
| 2024 | ||||||||||||
64 | else | - | ||||||||||||
65 | for (i = 0; i < 8
| 15680-125440 | ||||||||||||
66 | ovec[i] = ovec[i + num] << rem | executed 125440 times by 1 test: ovec[i] = ovec[i + num] << rem | ovec[i + num + 1] >> (8 - rem); Executed by:
| 125440 | ||||||||||||
67 | ovec[i + num + 1] >> (8 - rem); executed 125440 times by 1 test: ovec[i] = ovec[i + num] << rem | ovec[i + num + 1] >> (8 - rem); Executed by:
| 125440 | ||||||||||||
68 | - | |||||||||||||
69 | v0 = sh[0], v1 = sh[1]; | - | ||||||||||||
70 | - | |||||||||||||
71 | - | |||||||||||||
72 | - | |||||||||||||
73 | - | |||||||||||||
74 | - | |||||||||||||
75 | } executed 17704 times by 1 test: end of block Executed by:
| 17704 | ||||||||||||
76 | } | - | ||||||||||||
77 | } executed 15710 times by 1 test: else {end of block Executed by:
| 15710 | ||||||||||||
78 | while (l >= (unsigned long)n
| 15710-17713 | ||||||||||||
79 | l -= n; | - | ||||||||||||
80 | ti[0] = v0; | - | ||||||||||||
81 | ti[1] = v1; | - | ||||||||||||
82 | DES_encrypt1((DES_LONG *)ti, schedule, 1); | - | ||||||||||||
83 | { in+=n; d0=d1=0; switch (n) { case executed 3 times by 1 test: 8:case 8: Executed by:
executed 3 times by 1 test: d1 =((DES_LONG)(*(--(in))))<<24L; casecase 8: Executed by:
never executed: case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: d1|=((DES_LONG)(*(--(in))))<<16L; casecase 7: executed 4 times by 1 test: 6:case 6: Executed by:
executed 4 times by 1 test: case 6: Executed by:
code before this statement executed 3 times by 1 test: d1|=((DES_LONG)(*(--(in))))<< 8L; casecase 6: Executed by:
never executed: case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: 5:case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: d1|=((DES_LONG)(*(--(in)))); casecase 5: executed 6 times by 1 test: 4:case 4: Executed by:
executed 6 times by 1 test: case 4: Executed by:
code before this statement executed 7 times by 1 test: d0 =((DES_LONG)(*(--(in))))<<24L; casecase 4: Executed by:
never executed: case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: d0|=((DES_LONG)(*(--(in))))<<16L; casecase 3: executed 12 times by 1 test: 2:case 2: Executed by:
executed 12 times by 1 test: case 2: Executed by:
code before this statement executed 13 times by 1 test: d0|=((DES_LONG)(*(--(in))))<< 8L; casecase 2: Executed by:
executed 17713 times by 1 test: 1:case 1: Executed by:
executed 17713 times by 1 test: case 1: Executed by:
code before this statement executed 25 times by 1 test: d0|=((DES_LONG)(*(--(in)))); }case 1: Executed by:
executed 17713 times by 1 test: };end of block Executed by:
| 0-17713 | ||||||||||||
84 | in += n; | - | ||||||||||||
85 | - | |||||||||||||
86 | - | |||||||||||||
87 | - | |||||||||||||
88 | - | |||||||||||||
89 | if (numbits == 32
| 6-17707 | ||||||||||||
90 | v0 = v1; | - | ||||||||||||
91 | v1 = d0; | - | ||||||||||||
92 | } executed 6 times by 1 test: else if (numbits == 64end of block Executed by:
| 3-17704 | ||||||||||||
93 | v0 = d0; | - | ||||||||||||
94 | v1 = d1; | - | ||||||||||||
95 | } executed 3 times by 1 test: else {end of block Executed by:
| 3 | ||||||||||||
96 | - | |||||||||||||
97 | - | |||||||||||||
98 | - | |||||||||||||
99 | - | |||||||||||||
100 | - | |||||||||||||
101 | - | |||||||||||||
102 | - | |||||||||||||
103 | sh[0] = v0, sh[1] = v1, sh[2] = d0, sh[3] = d1; | - | ||||||||||||
104 | - | |||||||||||||
105 | if (rem == 0
| 2024-15680 | ||||||||||||
106 | memmove(ovec, ovec + num, 8); executed 2024 times by 1 test: memmove(ovec, ovec + num, 8); Executed by:
| 2024 | ||||||||||||
107 | else | - | ||||||||||||
108 | for (i = 0; i < 8
| 15680-125440 | ||||||||||||
109 | ovec[i] = ovec[i + num] << rem | executed 125440 times by 1 test: ovec[i] = ovec[i + num] << rem | ovec[i + num + 1] >> (8 - rem); Executed by:
| 125440 | ||||||||||||
110 | ovec[i + num + 1] >> (8 - rem); executed 125440 times by 1 test: ovec[i] = ovec[i + num] << rem | ovec[i + num + 1] >> (8 - rem); Executed by:
| 125440 | ||||||||||||
111 | - | |||||||||||||
112 | v0 = sh[0], v1 = sh[1]; | - | ||||||||||||
113 | - | |||||||||||||
114 | - | |||||||||||||
115 | - | |||||||||||||
116 | - | |||||||||||||
117 | - | |||||||||||||
118 | } executed 17704 times by 1 test: end of block Executed by:
| 17704 | ||||||||||||
119 | d0 ^= ti[0]; | - | ||||||||||||
120 | d1 ^= ti[1]; | - | ||||||||||||
121 | { out+=n; switch (n) { case executed 3 times by 1 test: 8:case 8: Executed by:
executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8: Executed by:
never executed: case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 3 times by 1 test: case 7: Executed by:
never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7: executed 4 times by 1 test: 6:case 6: Executed by:
executed 4 times by 1 test: case 6: Executed by:
code before this statement executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6: Executed by:
never executed: case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: 5:case 5: code before this statement executed 7 times by 1 test: case 5: Executed by:
never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5: executed 6 times by 1 test: 4:case 4: Executed by:
executed 6 times by 1 test: case 4: Executed by:
code before this statement executed 7 times by 1 test: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4: Executed by:
never executed: case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 13 times by 1 test: case 3: Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3: executed 12 times by 1 test: 2:case 2: Executed by:
executed 12 times by 1 test: case 2: Executed by:
code before this statement executed 13 times by 1 test: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2: Executed by:
executed 17713 times by 1 test: 1:case 1: Executed by:
executed 17713 times by 1 test: case 1: Executed by:
code before this statement executed 25 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1: Executed by:
executed 17713 times by 1 test: };end of block Executed by:
| 0-17713 | ||||||||||||
122 | out += n; | - | ||||||||||||
123 | } executed 17713 times by 1 test: end of block Executed by:
| 17713 | ||||||||||||
124 | } executed 15710 times by 1 test: end of block Executed by:
| 15710 | ||||||||||||
125 | iv = &(*ivec)[0]; | - | ||||||||||||
126 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||||||||
127 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||||||||
128 | v0 = v1 = d0 = d1 = ti[0] = ti[1] = 0; | - | ||||||||||||
129 | } executed 31420 times by 1 test: end of block Executed by:
| 31420 | ||||||||||||
Switch to Source code | Preprocessed file |