| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/ncbc_enc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | void 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
| 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
| 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 blockExecuted by:
| 251 | ||||||
| 27 | if (l != -8
| 4-9 | ||||||
| 28 | { | - | ||||||
| 29 | { 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 9 times by 1 test: case 5:Executed by:
code before this statement never executed: case 5:executed 9 times by 1 test: 5:case 5:Executed by:
code before this statement never executed: case 5:executed 9 times by 1 test: tin1|=((unsigned int)(*(--(in)))); casecase 5:Executed by:
never executed: case 4:code before this statement executed 9 times by 1 test: case 4:Executed by:
never executed: 4:case 4:code before this statement executed 9 times 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 9 times by 1 test: case 3:Executed by:
never executed: 3:case 3:code before this statement executed 9 times 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 9 times by 1 test: case 2:Executed by:
never executed: 2:case 2:code before this statement executed 9 times by 1 test: case 2:Executed by:
never executed: tin0|=((unsigned int)(*(--(in))))<< 8L; casecase 2:executed 9 times by 1 test: 1:case 1:Executed by:
executed 9 times by 1 test: case 1:Executed by:
code before this statement executed 9 times by 1 test: tin0|=((unsigned int)(*(--(in)))); }case 1:Executed by:
executed 9 times by 1 test: };end of blockExecuted by:
| 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 blockExecuted by:
| 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 blockExecuted by:
| 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
| 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 blockExecuted by:
| 227 | ||||||
| 58 | if (l != -8
| 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: 8:case 8:never executed: *(--(out))=(unsigned char)(((tout1)>>24L)&0xff); casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: *(--(out))=(unsigned char)(((tout1)>>16L)&0xff); casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: *(--(out))=(unsigned char)(((tout1)>> 8L)&0xff); 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: *(--(out))=(unsigned char)(((tout1) )&0xff); 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: *(--(out))=(unsigned char)(((tout0)>>24L)&0xff); 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: *(--(out))=(unsigned char)(((tout0)>>16L)&0xff); 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: *(--(out))=(unsigned char)(((tout0)>> 8L)&0xff); 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: *(--(out))=(unsigned char)(((tout0) )&0xff); }case 1:Executed by:
executed 1 time by 1 test: };end of blockExecuted by:
| 0-1 | ||||||
| 66 | - | |||||||
| 67 | xor0=tin0; | - | ||||||
| 68 | xor1=tin1; | - | ||||||
| 69 | - | |||||||
| 70 | } executed 1 time by 1 test: end of blockExecuted by:
| 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 blockExecuted by:
| 3 | ||||||
| 77 | tin0=tin1=tout0=tout1=xor0=xor1=0; | - | ||||||
| 78 | tin[0]=tin[1]=0; | - | ||||||
| 79 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||
| Switch to Source code | Preprocessed file |