OpenCoverage

pcbc_enc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/pcbc_enc.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2void 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
encDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
)
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
length>0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
; length-=8)
1-4
20 {-
21 if (length >= 8
length >= 8Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
)
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:
  • destest
3
26 else-
27 { in+=length; sin0=sin1=0; switch (length) { case
never executed: case 8:
8:
never executed: case 8:
sin1 =((unsigned int)(*(--(in))))<<24L; case
never executed: case 7:
7:
never executed: case 7:
code before this statement never executed: case 7:
sin1|=((unsigned int)(*(--(in))))<<16L; case
never executed: case 6:
6:
never executed: case 6:
code before this statement never executed: case 6:
sin1|=((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
sin1|=((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:
sin0 =((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:
sin0|=((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:
sin0|=((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
sin0|=((unsigned int)(*(--(in)))); }
executed 1 time by 1 test: end of block
Executed by:
  • destest
}
executed 1 time by 1 test: end of block
Executed by:
  • destest
;
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:
  • destest
4
38 }
executed 1 time by 1 test: end of block
Executed by:
  • destest
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
length>0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
; length-=8)
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
length >= 8Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • destest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • destest
)
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:
  • destest
3
56 else-
57 { out+=length; switch (length) { 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
}
executed 1 time by 1 test: end of block
Executed by:
  • destest
;
0-1
58 xor0=tout0^sin0;-
59 xor1=tout1^sin1;-
60 }
executed 4 times by 1 test: end of block
Executed by:
  • destest
4
61 }
executed 1 time by 1 test: end of block
Executed by:
  • destest
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:
  • destest
2
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2