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