OpenCoverage

ncbc_enc.c #2

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

Generated by Squish Coco 4.2.2