Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/pcbc_enc.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, | - | ||||||
3 | long length, DES_key_schedule *schedule, | - | ||||||
4 | DES_cblock *ivec, int enc) | - | ||||||
5 | { | - | ||||||
6 | unsigned int sin0,sin1,xor0,xor1,tout0,tout1; | - | ||||||
7 | unsigned int tin[2]; | - | ||||||
8 | const unsigned char *in; | - | ||||||
9 | unsigned char *out,*iv; | - | ||||||
10 | - | |||||||
11 | in=input; | - | ||||||
12 | out=output; | - | ||||||
13 | iv = &(*ivec)[0]; | - | ||||||
14 | - | |||||||
15 | if (enc
| 1 | ||||||
16 | { | - | ||||||
17 | (xor0 =((unsigned int)(*((iv)++))) , xor0|=((unsigned int)(*((iv)++)))<< 8L, xor0|=((unsigned int)(*((iv)++)))<<16L, xor0|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
18 | (xor1 =((unsigned int)(*((iv)++))) , xor1|=((unsigned int)(*((iv)++)))<< 8L, xor1|=((unsigned int)(*((iv)++)))<<16L, xor1|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
19 | for (; length>0
| 1-4 | ||||||
20 | { | - | ||||||
21 | if (length >= 8
| 1-3 | ||||||
22 | { | - | ||||||
23 | (sin0 =((unsigned int)(*((in)++))) , sin0|=((unsigned int)(*((in)++)))<< 8L, sin0|=((unsigned int)(*((in)++)))<<16L, sin0|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
24 | (sin1 =((unsigned int)(*((in)++))) , sin1|=((unsigned int)(*((in)++)))<< 8L, sin1|=((unsigned int)(*((in)++)))<<16L, sin1|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
25 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||
26 | else | - | ||||||
27 | { in+=length; sin0=sin1=0; switch (length) { case never executed: 8:case 8: never executed: sin1 =((unsigned int)(*(--(in))))<<24L; casecase 8: never executed: 7:case 7: never executed: case 7: code before this statement never executed: sin1|=((unsigned int)(*(--(in))))<<16L; casecase 7: never executed: 6:case 6: never executed: case 6: code before this statement never executed: sin1|=((unsigned int)(*(--(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: sin1|=((unsigned int)(*(--(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: sin0 =((unsigned int)(*(--(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: sin0|=((unsigned int)(*(--(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: sin0|=((unsigned int)(*(--(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: sin0|=((unsigned int)(*(--(in)))); }case 1: Executed by:
executed 1 time by 1 test: }end of block Executed by:
executed 1 time by 1 test: ;end of block Executed by:
| 0-1 | ||||||
28 | tin[0]=sin0^xor0; | - | ||||||
29 | tin[1]=sin1^xor1; | - | ||||||
30 | DES_encrypt1((unsigned int *)tin,schedule,1); | - | ||||||
31 | tout0=tin[0]; | - | ||||||
32 | tout1=tin[1]; | - | ||||||
33 | xor0=sin0^tout0; | - | ||||||
34 | xor1=sin1^tout1; | - | ||||||
35 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
36 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
37 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||
38 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
39 | else | - | ||||||
40 | { | - | ||||||
41 | (xor0 =((unsigned int)(*((iv)++))) , xor0|=((unsigned int)(*((iv)++)))<< 8L, xor0|=((unsigned int)(*((iv)++)))<<16L, xor0|=((unsigned int)(*((iv)++)))<<24L); (xor1 =((unsigned int)(*((iv)++))) , xor1|=((unsigned int)(*((iv)++)))<< 8L, xor1|=((unsigned int)(*((iv)++)))<<16L, xor1|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
42 | for (; length>0
| 1-4 | ||||||
43 | { | - | ||||||
44 | (sin0 =((unsigned int)(*((in)++))) , sin0|=((unsigned int)(*((in)++)))<< 8L, sin0|=((unsigned int)(*((in)++)))<<16L, sin0|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
45 | (sin1 =((unsigned int)(*((in)++))) , sin1|=((unsigned int)(*((in)++)))<< 8L, sin1|=((unsigned int)(*((in)++)))<<16L, sin1|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
46 | tin[0]=sin0; | - | ||||||
47 | tin[1]=sin1; | - | ||||||
48 | DES_encrypt1((unsigned int *)tin,schedule,0); | - | ||||||
49 | tout0=tin[0]^xor0; | - | ||||||
50 | tout1=tin[1]^xor1; | - | ||||||
51 | if (length >= 8
| 1-3 | ||||||
52 | { | - | ||||||
53 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
54 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
55 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||
56 | else | - | ||||||
57 | { out+=length; switch (length) { 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:
executed 1 time by 1 test: ;end of block Executed by:
| 0-1 | ||||||
58 | xor0=tout0^sin0; | - | ||||||
59 | xor1=tout1^sin1; | - | ||||||
60 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||
61 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
62 | tin[0]=tin[1]=0; | - | ||||||
63 | sin0=sin1=xor0=xor1=tout0=tout1=0; | - | ||||||
64 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||
Switch to Source code | Preprocessed file |