OpenCoverage

xcbc_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/xcbc_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void 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 unsigned int tin0,tin1;-
10 unsigned int tout0,tout1,xor0,xor1;-
11 unsigned int inW0,inW1,outW0,outW1;-
12 const unsigned char *in2;-
13 long l=length;-
14 unsigned int tin[2];-
15 unsigned char *iv;-
16-
17 in2 = &(*inw)[0];-
18 (inW0 =((unsigned int)(*((in2)++))) , inW0|=((unsigned int)(*((in2)++)))<< 8L, inW0|=((unsigned int)(*((in2)++)))<<16L, inW0|=((unsigned int)(*((in2)++)))<<24L);-
19 (inW1 =((unsigned int)(*((in2)++))) , inW1|=((unsigned int)(*((in2)++)))<< 8L, inW1|=((unsigned int)(*((in2)++)))<<16L, inW1|=((unsigned int)(*((in2)++)))<<24L);-
20 in2 = &(*outw)[0];-
21 (outW0 =((unsigned int)(*((in2)++))) , outW0|=((unsigned int)(*((in2)++)))<< 8L, outW0|=((unsigned int)(*((in2)++)))<<16L, outW0|=((unsigned int)(*((in2)++)))<<24L);-
22 (outW1 =((unsigned int)(*((in2)++))) , outW1|=((unsigned int)(*((in2)++)))<< 8L, outW1|=((unsigned int)(*((in2)++)))<<16L, outW1|=((unsigned int)(*((in2)++)))<<24L);-
23-
24 iv = &(*ivec)[0];-
25-
26 if (enc
encDescription
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
)
4-6
27 {-
28 (tout0 =((unsigned int)(*((iv)++))) , tout0|=((unsigned int)(*((iv)++)))<< 8L, tout0|=((unsigned int)(*((iv)++)))<<16L, tout0|=((unsigned int)(*((iv)++)))<<24L);-
29 (tout1 =((unsigned int)(*((iv)++))) , tout1|=((unsigned int)(*((iv)++)))<< 8L, tout1|=((unsigned int)(*((iv)++)))<<16L, tout1|=((unsigned int)(*((iv)++)))<<24L);-
30 for (l-=8; l>=0
l>=0Description
TRUEevaluated 231 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
; l-=8)
6-231
31 {-
32 (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L);-
33 (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L);-
34 tin0^=tout0^inW0; tin[0]=tin0;-
35 tin1^=tout1^inW1; tin[1]=tin1;-
36 DES_encrypt1(tin,schedule,1);-
37 tout0=tin[0]^outW0; (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff));-
38 tout1=tin[1]^outW1; (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff));-
39 }
executed 231 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
231
40 if (l != -8
l != -8Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • destest
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • evptest
  • libcrypto.so.44.0.1
)
1-5
41 {-
42 { in+=l+8; tin0=tin1=0; switch (l+8) { case
never executed: case 8:
8:
never executed: case 8:
tin1 =((unsigned int)(*(--(in))))<<24L; case
never executed: case 7:
7:
never executed: case 7:
code before this statement never executed: case 7:
tin1|=((unsigned int)(*(--(in))))<<16L; case
never executed: case 6:
6:
never executed: case 6:
code before this statement never executed: case 6:
tin1|=((unsigned int)(*(--(in))))<< 8L; case
executed 1 time by 1 test: case 5:
Executed by:
  • destest
code before this statement never executed: case 5:
executed 1 time by 1 test: case 5:
Executed by:
  • destest
5:
code before this statement never executed: case 5:
executed 1 time by 1 test: case 5:
Executed by:
  • destest
tin1|=((unsigned int)(*(--(in)))); case
never executed: case 4:
code before this statement executed 1 time by 1 test: case 4:
Executed by:
  • destest
never executed: case 4:
4:
code before this statement executed 1 time by 1 test: case 4:
Executed by:
  • destest
never executed: case 4:
tin0 =((unsigned int)(*(--(in))))<<24L; case
never executed: case 3:
code before this statement executed 1 time by 1 test: case 3:
Executed by:
  • destest
never executed: case 3:
3:
code before this statement executed 1 time by 1 test: case 3:
Executed by:
  • destest
never executed: case 3:
tin0|=((unsigned int)(*(--(in))))<<16L; case
never executed: case 2:
code before this statement executed 1 time by 1 test: case 2:
Executed by:
  • destest
never executed: case 2:
2:
code before this statement executed 1 time by 1 test: case 2:
Executed by:
  • destest
never executed: case 2:
tin0|=((unsigned int)(*(--(in))))<< 8L; case
executed 1 time by 1 test: case 1:
Executed by:
  • destest
1:
executed 1 time by 1 test: case 1:
Executed by:
  • destest
code before this statement executed 1 time by 1 test: case 1:
Executed by:
  • destest
tin0|=((unsigned int)(*(--(in)))); }
executed 1 time by 1 test: end of block
Executed by:
  • destest
};
0-1
43 tin0^=tout0^inW0; tin[0]=tin0;-
44 tin1^=tout1^inW1; tin[1]=tin1;-
45 DES_encrypt1(tin,schedule,1);-
46 tout0=tin[0]^outW0; (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff));-
47 tout1=tin[1]^outW1; (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff));-
48 }
executed 1 time by 1 test: end of block
Executed by:
  • destest
1
49 iv = &(*ivec)[0];-
50 (*((iv)++)=(unsigned char)(((tout0) )&0xff), *((iv)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>24L)&0xff));-
51 (*((iv)++)=(unsigned char)(((tout1) )&0xff), *((iv)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>24L)&0xff));-
52 }
executed 6 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
6
53 else-
54 {-
55 (xor0 =((unsigned int)(*((iv)++))) , xor0|=((unsigned int)(*((iv)++)))<< 8L, xor0|=((unsigned int)(*((iv)++)))<<16L, xor0|=((unsigned int)(*((iv)++)))<<24L);-
56 (xor1 =((unsigned int)(*((iv)++))) , xor1|=((unsigned int)(*((iv)++)))<< 8L, xor1|=((unsigned int)(*((iv)++)))<<16L, xor1|=((unsigned int)(*((iv)++)))<<24L);-
57 for (l-=8; l>0
l>0Description
TRUEevaluated 228 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
; l-=8)
4-228
58 {-
59 (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L); tin[0]=tin0^outW0;-
60 (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L); tin[1]=tin1^outW1;-
61 DES_encrypt1(tin,schedule,0);-
62 tout0=tin[0]^xor0^inW0;-
63 tout1=tin[1]^xor1^inW1;-
64 (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff));-
65 (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff));-
66 xor0=tin0;-
67 xor1=tin1;-
68 }
executed 228 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
228
69 if (l != -8
l != -8Description
TRUEevaluated 4 times by 3 tests
Evaluated by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
FALSEnever evaluated
)
0-4
70 {-
71 (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L); tin[0]=tin0^outW0;-
72 (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L); tin[1]=tin1^outW1;-
73 DES_encrypt1(tin,schedule,0);-
74 tout0=tin[0]^xor0^inW0;-
75 tout1=tin[1]^xor1^inW1;-
76 { out+=l+8; switch (l+8) { case
executed 3 times by 2 tests: case 8:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
8:
executed 3 times by 2 tests: case 8:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
*(--(out))=(unsigned char)(((tout1)>>24L)&0xff); case
never executed: case 7:
code before this statement executed 3 times by 2 tests: case 7:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
never executed: case 7:
7:
code before this statement executed 3 times by 2 tests: case 7:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
never executed: case 7:
*(--(out))=(unsigned char)(((tout1)>>16L)&0xff); case
never executed: case 6:
code before this statement executed 3 times by 2 tests: case 6:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
never executed: case 6:
6:
code before this statement executed 3 times by 2 tests: case 6:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
never executed: case 6:
*(--(out))=(unsigned char)(((tout1)>> 8L)&0xff); case
executed 1 time by 1 test: case 5:
Executed by:
  • destest
5:
executed 1 time by 1 test: case 5:
Executed by:
  • destest
code before this statement executed 3 times by 2 tests: case 5:
Executed by:
  • evptest
  • libcrypto.so.44.0.1
*(--(out))=(unsigned char)(((tout1) )&0xff); case
never executed: case 4:
code before this statement executed 4 times by 3 tests: case 4:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
never executed: case 4:
4:
code before this statement executed 4 times by 3 tests: case 4:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
never executed: case 4:
*(--(out))=(unsigned char)(((tout0)>>24L)&0xff); case
never executed: case 3:
code before this statement executed 4 times by 3 tests: case 3:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
never executed: case 3:
3:
code before this statement executed 4 times by 3 tests: case 3:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
never executed: case 3:
*(--(out))=(unsigned char)(((tout0)>>16L)&0xff); case
never executed: case 2:
code before this statement executed 4 times by 3 tests: case 2:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
never executed: case 2:
2:
code before this statement executed 4 times by 3 tests: case 2:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
never executed: case 2:
*(--(out))=(unsigned char)(((tout0)>> 8L)&0xff); case
executed 4 times by 3 tests: case 1:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
1:
executed 4 times by 3 tests: case 1:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
code before this statement executed 4 times by 3 tests: case 1:
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
*(--(out))=(unsigned char)(((tout0) )&0xff); }
executed 4 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
};
0-4
77 xor0=tin0;-
78 xor1=tin1;-
79 }
executed 4 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
4
80-
81 iv = &(*ivec)[0];-
82 (*((iv)++)=(unsigned char)(((xor0) )&0xff), *((iv)++)=(unsigned char)(((xor0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>24L)&0xff));-
83 (*((iv)++)=(unsigned char)(((xor1) )&0xff), *((iv)++)=(unsigned char)(((xor1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>24L)&0xff));-
84 }
executed 4 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
4
85 tin0=tin1=tout0=tout1=xor0=xor1=0;-
86 inW0=inW1=outW0=outW1=0;-
87 tin[0]=tin[1]=0;-
88 }
executed 10 times by 3 tests: end of block
Executed by:
  • destest
  • evptest
  • libcrypto.so.44.0.1
10
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2