OpenCoverage

ede_cbcm_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/ede_cbcm_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out,-
5 long length, DES_key_schedule *ks1, DES_key_schedule *ks2,-
6 DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2,-
7 int enc)-
8 {-
9 unsigned int tin0,tin1;-
10 unsigned int tout0,tout1,xor0,xor1,m0,m1;-
11 long l=length;-
12 unsigned int tin[2];-
13 unsigned char *iv1,*iv2;-
14-
15 iv1 = &(*ivec1)[0];-
16 iv2 = &(*ivec2)[0];-
17-
18 if (enc
encDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
)
1-2
19 {-
20 (m0 =((unsigned int)(*((iv1)++))) , m0|=((unsigned int)(*((iv1)++)))<< 8L, m0|=((unsigned int)(*((iv1)++)))<<16L, m0|=((unsigned int)(*((iv1)++)))<<24L);-
21 (m1 =((unsigned int)(*((iv1)++))) , m1|=((unsigned int)(*((iv1)++)))<< 8L, m1|=((unsigned int)(*((iv1)++)))<<16L, m1|=((unsigned int)(*((iv1)++)))<<24L);-
22 (tout0 =((unsigned int)(*((iv2)++))) , tout0|=((unsigned int)(*((iv2)++)))<< 8L, tout0|=((unsigned int)(*((iv2)++)))<<16L, tout0|=((unsigned int)(*((iv2)++)))<<24L);-
23 (tout1 =((unsigned int)(*((iv2)++))) , tout1|=((unsigned int)(*((iv2)++)))<< 8L, tout1|=((unsigned int)(*((iv2)++)))<<16L, tout1|=((unsigned int)(*((iv2)++)))<<24L);-
24 for (l-=8; l>=-7
l>=-7Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 2 times by 1 test
Evaluated by:
  • destest
; l-=8)
2-4
25 {-
26 tin[0]=m0;-
27 tin[1]=m1;-
28 DES_encrypt1(tin,ks3,1);-
29 m0=tin[0];-
30 m1=tin[1];-
31-
32 if(l < 0
l < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • destest
FALSEevaluated 3 times by 1 test
Evaluated by:
  • destest
)
1-3
33 {-
34 { 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
35 }
executed 1 time by 1 test: end of block
Executed by:
  • destest
1
36 else-
37 {-
38 (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L);-
39 (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L);-
40 }
executed 3 times by 1 test: end of block
Executed by:
  • destest
3
41 tin0^=tout0;-
42 tin1^=tout1;-
43-
44 tin[0]=tin0;-
45 tin[1]=tin1;-
46 DES_encrypt1(tin,ks1,1);-
47 tin[0]^=m0;-
48 tin[1]^=m1;-
49 DES_encrypt1(tin,ks2,0);-
50 tin[0]^=m0;-
51 tin[1]^=m1;-
52 DES_encrypt1(tin,ks1,1);-
53 tout0=tin[0];-
54 tout1=tin[1];-
55-
56 (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff));-
57 (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff));-
58 }
executed 4 times by 1 test: end of block
Executed by:
  • destest
4
59 iv1=&(*ivec1)[0];-
60 (*((iv1)++)=(unsigned char)(((m0) )&0xff), *((iv1)++)=(unsigned char)(((m0)>> 8L)&0xff), *((iv1)++)=(unsigned char)(((m0)>>16L)&0xff), *((iv1)++)=(unsigned char)(((m0)>>24L)&0xff));-
61 (*((iv1)++)=(unsigned char)(((m1) )&0xff), *((iv1)++)=(unsigned char)(((m1)>> 8L)&0xff), *((iv1)++)=(unsigned char)(((m1)>>16L)&0xff), *((iv1)++)=(unsigned char)(((m1)>>24L)&0xff));-
62-
63 iv2=&(*ivec2)[0];-
64 (*((iv2)++)=(unsigned char)(((tout0) )&0xff), *((iv2)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((iv2)++)=(unsigned char)(((tout0)>>16L)&0xff), *((iv2)++)=(unsigned char)(((tout0)>>24L)&0xff));-
65 (*((iv2)++)=(unsigned char)(((tout1) )&0xff), *((iv2)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((iv2)++)=(unsigned char)(((tout1)>>16L)&0xff), *((iv2)++)=(unsigned char)(((tout1)>>24L)&0xff));-
66 }
executed 2 times by 1 test: end of block
Executed by:
  • destest
2
67 else-
68 {-
69 unsigned int t0,t1;-
70-
71 (m0 =((unsigned int)(*((iv1)++))) , m0|=((unsigned int)(*((iv1)++)))<< 8L, m0|=((unsigned int)(*((iv1)++)))<<16L, m0|=((unsigned int)(*((iv1)++)))<<24L);-
72 (m1 =((unsigned int)(*((iv1)++))) , m1|=((unsigned int)(*((iv1)++)))<< 8L, m1|=((unsigned int)(*((iv1)++)))<<16L, m1|=((unsigned int)(*((iv1)++)))<<24L);-
73 (xor0 =((unsigned int)(*((iv2)++))) , xor0|=((unsigned int)(*((iv2)++)))<< 8L, xor0|=((unsigned int)(*((iv2)++)))<<16L, xor0|=((unsigned int)(*((iv2)++)))<<24L);-
74 (xor1 =((unsigned int)(*((iv2)++))) , xor1|=((unsigned int)(*((iv2)++)))<< 8L, xor1|=((unsigned int)(*((iv2)++)))<<16L, xor1|=((unsigned int)(*((iv2)++)))<<24L);-
75 for (l-=8; l>=-7
l>=-7Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
; l-=8)
1-4
76 {-
77 tin[0]=m0;-
78 tin[1]=m1;-
79 DES_encrypt1(tin,ks3,1);-
80 m0=tin[0];-
81 m1=tin[1];-
82-
83 (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L);-
84 (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L);-
85-
86 t0=tin0;-
87 t1=tin1;-
88-
89 tin[0]=tin0;-
90 tin[1]=tin1;-
91 DES_encrypt1(tin,ks1,0);-
92 tin[0]^=m0;-
93 tin[1]^=m1;-
94 DES_encrypt1(tin,ks2,1);-
95 tin[0]^=m0;-
96 tin[1]^=m1;-
97 DES_encrypt1(tin,ks1,0);-
98 tout0=tin[0];-
99 tout1=tin[1];-
100-
101 tout0^=xor0;-
102 tout1^=xor1;-
103 if(l < 0
l < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • destest
FALSEevaluated 3 times by 1 test
Evaluated by:
  • destest
)
1-3
104 {-
105 { out+=l+8; switch (l+8) { case
never executed: case 8:
8:
never executed: case 8:
*(--(out))=(unsigned char)(((tout1)>>24L)&0xff); case
never executed: case 7:
7:
never executed: case 7:
code before this statement never executed: case 7:
*(--(out))=(unsigned char)(((tout1)>>16L)&0xff); case
never executed: case 6:
6:
never executed: case 6:
code before this statement never executed: case 6:
*(--(out))=(unsigned char)(((tout1)>> 8L)&0xff); 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
*(--(out))=(unsigned char)(((tout1) )&0xff); 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:
*(--(out))=(unsigned char)(((tout0)>>24L)&0xff); 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:
*(--(out))=(unsigned char)(((tout0)>>16L)&0xff); 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:
*(--(out))=(unsigned char)(((tout0)>> 8L)&0xff); 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
*(--(out))=(unsigned char)(((tout0) )&0xff); }
executed 1 time by 1 test: end of block
Executed by:
  • destest
};
0-1
106 }
executed 1 time by 1 test: end of block
Executed by:
  • destest
1
107 else-
108 {-
109 (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff));-
110 (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff));-
111 }
executed 3 times by 1 test: end of block
Executed by:
  • destest
3
112 xor0=t0;-
113 xor1=t1;-
114 }
executed 4 times by 1 test: end of block
Executed by:
  • destest
4
115-
116 iv1=&(*ivec1)[0];-
117 (*((iv1)++)=(unsigned char)(((m0) )&0xff), *((iv1)++)=(unsigned char)(((m0)>> 8L)&0xff), *((iv1)++)=(unsigned char)(((m0)>>16L)&0xff), *((iv1)++)=(unsigned char)(((m0)>>24L)&0xff));-
118 (*((iv1)++)=(unsigned char)(((m1) )&0xff), *((iv1)++)=(unsigned char)(((m1)>> 8L)&0xff), *((iv1)++)=(unsigned char)(((m1)>>16L)&0xff), *((iv1)++)=(unsigned char)(((m1)>>24L)&0xff));-
119-
120 iv2=&(*ivec2)[0];-
121 (*((iv2)++)=(unsigned char)(((xor0) )&0xff), *((iv2)++)=(unsigned char)(((xor0)>> 8L)&0xff), *((iv2)++)=(unsigned char)(((xor0)>>16L)&0xff), *((iv2)++)=(unsigned char)(((xor0)>>24L)&0xff));-
122 (*((iv2)++)=(unsigned char)(((xor1) )&0xff), *((iv2)++)=(unsigned char)(((xor1)>> 8L)&0xff), *((iv2)++)=(unsigned char)(((xor1)>>16L)&0xff), *((iv2)++)=(unsigned char)(((xor1)>>24L)&0xff));-
123 }
executed 1 time by 1 test: end of block
Executed by:
  • destest
1
124 tin0=tin1=tout0=tout1=xor0=xor1=0;-
125 tin[0]=tin[1]=0;-
126 }
executed 3 times by 1 test: end of block
Executed by:
  • destest
3
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2