| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/xcbc_enc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | void 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
| 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
| 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 blockExecuted by:
| 231 | ||||||
| 40 | if (l != -8
| 1-5 | ||||||
| 41 | { | - | ||||||
| 42 | { in+=l+8; tin0=tin1=0; switch (l+8) { case never executed: 8:case 8:never executed: tin1 =((unsigned int)(*(--(in))))<<24L; casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: tin1|=((unsigned int)(*(--(in))))<<16L; casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: tin1|=((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: tin1|=((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: tin0 =((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: tin0|=((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: tin0|=((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: tin0|=((unsigned int)(*(--(in)))); }case 1:Executed by:
executed 1 time by 1 test: };end of blockExecuted by:
| 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 blockExecuted by:
| 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 blockExecuted by:
| 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
| 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 blockExecuted by:
| 228 | ||||||
| 69 | if (l != -8
| 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: 8:case 8:Executed by:
executed 3 times by 2 tests: *(--(out))=(unsigned char)(((tout1)>>24L)&0xff); casecase 8:Executed by:
never executed: case 7:code before this statement executed 3 times by 2 tests: case 7:Executed by:
never executed: 7:case 7:code before this statement executed 3 times by 2 tests: case 7:Executed by:
never executed: *(--(out))=(unsigned char)(((tout1)>>16L)&0xff); casecase 7:never executed: case 6:code before this statement executed 3 times by 2 tests: case 6:Executed by:
never executed: 6:case 6:code before this statement executed 3 times by 2 tests: case 6:Executed by:
never executed: *(--(out))=(unsigned char)(((tout1)>> 8L)&0xff); casecase 6:executed 1 time by 1 test: 5:case 5:Executed by:
executed 1 time by 1 test: case 5:Executed by:
code before this statement executed 3 times by 2 tests: *(--(out))=(unsigned char)(((tout1) )&0xff); casecase 5:Executed by:
never executed: case 4:code before this statement executed 4 times by 3 tests: case 4:Executed by:
never executed: 4:case 4:code before this statement executed 4 times by 3 tests: case 4:Executed by:
never executed: *(--(out))=(unsigned char)(((tout0)>>24L)&0xff); casecase 4:never executed: case 3:code before this statement executed 4 times by 3 tests: case 3:Executed by:
never executed: 3:case 3:code before this statement executed 4 times by 3 tests: case 3:Executed by:
never executed: *(--(out))=(unsigned char)(((tout0)>>16L)&0xff); casecase 3:never executed: case 2:code before this statement executed 4 times by 3 tests: case 2:Executed by:
never executed: 2:case 2:code before this statement executed 4 times by 3 tests: case 2:Executed by:
never executed: *(--(out))=(unsigned char)(((tout0)>> 8L)&0xff); casecase 2:executed 4 times by 3 tests: 1:case 1:Executed by:
executed 4 times by 3 tests: case 1:Executed by:
code before this statement executed 4 times by 3 tests: *(--(out))=(unsigned char)(((tout0) )&0xff); }case 1:Executed by:
executed 4 times by 3 tests: };end of blockExecuted by:
| 0-4 | ||||||
| 77 | xor0=tin0; | - | ||||||
| 78 | xor1=tin1; | - | ||||||
| 79 | } executed 4 times by 3 tests: end of blockExecuted by:
| 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 blockExecuted by:
| 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 blockExecuted by:
| 10 | ||||||
| Switch to Source code | Preprocessed file |