Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/des/xcbc_enc.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | void DES_xcbc_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||
5 | long length, DES_key_schedule *schedule, | - | ||||||
6 | DES_cblock *ivec, const_DES_cblock *inw, | - | ||||||
7 | const_DES_cblock *outw, int enc) | - | ||||||
8 | { | - | ||||||
9 | register DES_LONG tin0, tin1; | - | ||||||
10 | register DES_LONG tout0, tout1, xor0, xor1; | - | ||||||
11 | register DES_LONG inW0, inW1, outW0, outW1; | - | ||||||
12 | register const unsigned char *in2; | - | ||||||
13 | register long l = length; | - | ||||||
14 | DES_LONG tin[2]; | - | ||||||
15 | unsigned char *iv; | - | ||||||
16 | - | |||||||
17 | in2 = &(*inw)[0]; | - | ||||||
18 | (inW0 =((DES_LONG)(*((in2)++))) , inW0|=((DES_LONG)(*((in2)++)))<< 8L, inW0|=((DES_LONG)(*((in2)++)))<<16L, inW0|=((DES_LONG)(*((in2)++)))<<24L); | - | ||||||
19 | (inW1 =((DES_LONG)(*((in2)++))) , inW1|=((DES_LONG)(*((in2)++)))<< 8L, inW1|=((DES_LONG)(*((in2)++)))<<16L, inW1|=((DES_LONG)(*((in2)++)))<<24L); | - | ||||||
20 | in2 = &(*outw)[0]; | - | ||||||
21 | (outW0 =((DES_LONG)(*((in2)++))) , outW0|=((DES_LONG)(*((in2)++)))<< 8L, outW0|=((DES_LONG)(*((in2)++)))<<16L, outW0|=((DES_LONG)(*((in2)++)))<<24L); | - | ||||||
22 | (outW1 =((DES_LONG)(*((in2)++))) , outW1|=((DES_LONG)(*((in2)++)))<< 8L, outW1|=((DES_LONG)(*((in2)++)))<<16L, outW1|=((DES_LONG)(*((in2)++)))<<24L); | - | ||||||
23 | - | |||||||
24 | iv = &(*ivec)[0]; | - | ||||||
25 | - | |||||||
26 | if (enc
| 79-103 | ||||||
27 | (tout0 =((DES_LONG)(*((iv)++))) , tout0|=((DES_LONG)(*((iv)++)))<< 8L, tout0|=((DES_LONG)(*((iv)++)))<<16L, tout0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
28 | (tout1 =((DES_LONG)(*((iv)++))) , tout1|=((DES_LONG)(*((iv)++)))<< 8L, tout1|=((DES_LONG)(*((iv)++)))<<16L, tout1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
29 | for (l -= 8; l >= 0
| 103-1083 | ||||||
30 | (tin0 =((DES_LONG)(*((in)++))) , tin0|=((DES_LONG)(*((in)++)))<< 8L, tin0|=((DES_LONG)(*((in)++)))<<16L, tin0|=((DES_LONG)(*((in)++)))<<24L); | - | ||||||
31 | (tin1 =((DES_LONG)(*((in)++))) , tin1|=((DES_LONG)(*((in)++)))<< 8L, tin1|=((DES_LONG)(*((in)++)))<<16L, tin1|=((DES_LONG)(*((in)++)))<<24L); | - | ||||||
32 | tin0 ^= tout0 ^ inW0; | - | ||||||
33 | tin[0] = tin0; | - | ||||||
34 | tin1 ^= tout1 ^ inW1; | - | ||||||
35 | tin[1] = tin1; | - | ||||||
36 | DES_encrypt1(tin, schedule, 1); | - | ||||||
37 | tout0 = tin[0] ^ outW0; | - | ||||||
38 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
39 | tout1 = tin[1] ^ outW1; | - | ||||||
40 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
41 | } executed 1083 times by 1 test: end of block Executed by:
| 1083 | ||||||
42 | if (l != -8
| 1-102 | ||||||
43 | { in+=l + 8; tin0=tin1=0; switch (l + 8) { case never executed: 8:case 8: never executed: tin1 =((DES_LONG)(*(--(in))))<<24L; casecase 8: never executed: 7:case 7: never executed: case 7: code before this statement never executed: tin1|=((DES_LONG)(*(--(in))))<<16L; casecase 7: never executed: 6:case 6: never executed: case 6: code before this statement never executed: tin1|=((DES_LONG)(*(--(in))))<< 8L; casecase 6: executed 1 time by 1 test: case 5: Executed by:
code before this statement never executed: case 5: executed 1 time by 1 test: 5:case 5: Executed by:
code before this statement never executed: case 5: executed 1 time by 1 test: tin1|=((DES_LONG)(*(--(in)))); casecase 5: Executed by:
never executed: case 4: code before this statement executed 1 time by 1 test: case 4: Executed by:
never executed: 4:case 4: code before this statement executed 1 time by 1 test: case 4: Executed by:
never executed: tin0 =((DES_LONG)(*(--(in))))<<24L; casecase 4: never executed: case 3: code before this statement executed 1 time by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 1 time by 1 test: case 3: Executed by:
never executed: tin0|=((DES_LONG)(*(--(in))))<<16L; casecase 3: never executed: case 2: code before this statement executed 1 time by 1 test: case 2: Executed by:
never executed: 2:case 2: code before this statement executed 1 time by 1 test: case 2: Executed by:
never executed: tin0|=((DES_LONG)(*(--(in))))<< 8L; casecase 2: executed 1 time by 1 test: 1:case 1: Executed by:
executed 1 time by 1 test: case 1: Executed by:
code before this statement executed 1 time by 1 test: tin0|=((DES_LONG)(*(--(in)))); }case 1: Executed by:
executed 1 time by 1 test: };end of block Executed by:
| 0-1 | ||||||
44 | tin0 ^= tout0 ^ inW0; | - | ||||||
45 | tin[0] = tin0; | - | ||||||
46 | tin1 ^= tout1 ^ inW1; | - | ||||||
47 | tin[1] = tin1; | - | ||||||
48 | DES_encrypt1(tin, schedule, 1); | - | ||||||
49 | tout0 = tin[0] ^ outW0; | - | ||||||
50 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
51 | tout1 = tin[1] ^ outW1; | - | ||||||
52 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
53 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
54 | iv = &(*ivec)[0]; | - | ||||||
55 | (*((iv)++)=(unsigned char)(((tout0) )&0xff), *((iv)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
56 | (*((iv)++)=(unsigned char)(((tout1) )&0xff), *((iv)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
57 | } executed 103 times by 1 test: else {end of block Executed by:
| 103 | ||||||
58 | (xor0 =((DES_LONG)(*((iv)++))) , xor0|=((DES_LONG)(*((iv)++)))<< 8L, xor0|=((DES_LONG)(*((iv)++)))<<16L, xor0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
59 | (xor1 =((DES_LONG)(*((iv)++))) , xor1|=((DES_LONG)(*((iv)++)))<< 8L, xor1|=((DES_LONG)(*((iv)++)))<<16L, xor1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
60 | for (l -= 8; l > 0
| 79-1005 | ||||||
61 | (tin0 =((DES_LONG)(*((in)++))) , tin0|=((DES_LONG)(*((in)++)))<< 8L, tin0|=((DES_LONG)(*((in)++)))<<16L, tin0|=((DES_LONG)(*((in)++)))<<24L); | - | ||||||
62 | tin[0] = tin0 ^ outW0; | - | ||||||
63 | (tin1 =((DES_LONG)(*((in)++))) , tin1|=((DES_LONG)(*((in)++)))<< 8L, tin1|=((DES_LONG)(*((in)++)))<<16L, tin1|=((DES_LONG)(*((in)++)))<<24L); | - | ||||||
64 | tin[1] = tin1 ^ outW1; | - | ||||||
65 | DES_encrypt1(tin, schedule, 0); | - | ||||||
66 | tout0 = tin[0] ^ xor0 ^ inW0; | - | ||||||
67 | tout1 = tin[1] ^ xor1 ^ inW1; | - | ||||||
68 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
69 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
70 | xor0 = tin0; | - | ||||||
71 | xor1 = tin1; | - | ||||||
72 | } executed 1005 times by 1 test: end of block Executed by:
| 1005 | ||||||
73 | if (l != -8
| 0-79 | ||||||
74 | (tin0 =((DES_LONG)(*((in)++))) , tin0|=((DES_LONG)(*((in)++)))<< 8L, tin0|=((DES_LONG)(*((in)++)))<<16L, tin0|=((DES_LONG)(*((in)++)))<<24L); | - | ||||||
75 | tin[0] = tin0 ^ outW0; | - | ||||||
76 | (tin1 =((DES_LONG)(*((in)++))) , tin1|=((DES_LONG)(*((in)++)))<< 8L, tin1|=((DES_LONG)(*((in)++)))<<16L, tin1|=((DES_LONG)(*((in)++)))<<24L); | - | ||||||
77 | tin[1] = tin1 ^ outW1; | - | ||||||
78 | DES_encrypt1(tin, schedule, 0); | - | ||||||
79 | tout0 = tin[0] ^ xor0 ^ inW0; | - | ||||||
80 | tout1 = tin[1] ^ xor1 ^ inW1; | - | ||||||
81 | { out+=l + 8; switch (l + 8) { case executed 78 times by 1 test: 8:case 8: Executed by:
executed 78 times by 1 test: *(--(out))=(unsigned char)(((tout1)>>24L)&0xff); casecase 8: Executed by:
never executed: case 7: code before this statement executed 78 times by 1 test: case 7: Executed by:
never executed: 7:case 7: code before this statement executed 78 times by 1 test: case 7: Executed by:
never executed: *(--(out))=(unsigned char)(((tout1)>>16L)&0xff); casecase 7: never executed: case 6: code before this statement executed 78 times by 1 test: case 6: Executed by:
never executed: 6:case 6: code before this statement executed 78 times by 1 test: case 6: Executed by:
never executed: *(--(out))=(unsigned char)(((tout1)>> 8L)&0xff); casecase 6: executed 1 time by 1 test: 5:case 5: Executed by:
executed 1 time by 1 test: case 5: Executed by:
code before this statement executed 78 times by 1 test: *(--(out))=(unsigned char)(((tout1) )&0xff); casecase 5: Executed by:
never executed: case 4: code before this statement executed 79 times by 1 test: case 4: Executed by:
never executed: 4:case 4: code before this statement executed 79 times by 1 test: case 4: Executed by:
never executed: *(--(out))=(unsigned char)(((tout0)>>24L)&0xff); casecase 4: never executed: case 3: code before this statement executed 79 times by 1 test: case 3: Executed by:
never executed: 3:case 3: code before this statement executed 79 times by 1 test: case 3: Executed by:
never executed: *(--(out))=(unsigned char)(((tout0)>>16L)&0xff); casecase 3: never executed: case 2: code before this statement executed 79 times by 1 test: case 2: Executed by:
never executed: 2:case 2: code before this statement executed 79 times by 1 test: case 2: Executed by:
never executed: *(--(out))=(unsigned char)(((tout0)>> 8L)&0xff); casecase 2: executed 79 times by 1 test: 1:case 1: Executed by:
executed 79 times by 1 test: case 1: Executed by:
code before this statement executed 79 times by 1 test: *(--(out))=(unsigned char)(((tout0) )&0xff); }case 1: Executed by:
executed 79 times by 1 test: };end of block Executed by:
| 0-79 | ||||||
82 | xor0 = tin0; | - | ||||||
83 | xor1 = tin1; | - | ||||||
84 | } executed 79 times by 1 test: end of block Executed by:
| 79 | ||||||
85 | - | |||||||
86 | iv = &(*ivec)[0]; | - | ||||||
87 | (*((iv)++)=(unsigned char)(((xor0) )&0xff), *((iv)++)=(unsigned char)(((xor0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>24L)&0xff)); | - | ||||||
88 | (*((iv)++)=(unsigned char)(((xor1) )&0xff), *((iv)++)=(unsigned char)(((xor1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>24L)&0xff)); | - | ||||||
89 | } executed 79 times by 1 test: end of block Executed by:
| 79 | ||||||
90 | tin0 = tin1 = tout0 = tout1 = xor0 = xor1 = 0; | - | ||||||
91 | inW0 = inW1 = outW0 = outW1 = 0; | - | ||||||
92 | tin[0] = tin[1] = 0; | - | ||||||
93 | } executed 182 times by 1 test: end of block Executed by:
| 182 | ||||||
Switch to Source code | Preprocessed file |