| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/cfb_enc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | - | ||||||||||||
| 2 | long length, DES_key_schedule *schedule, DES_cblock *ivec, | - | ||||||||||||
| 3 | int enc) | - | ||||||||||||
| 4 | { | - | ||||||||||||
| 5 | unsigned int d0,d1,v0,v1; | - | ||||||||||||
| 6 | unsigned long l=length; | - | ||||||||||||
| 7 | int num=numbits/8,n=(numbits+7)/8,i,rem=numbits%8; | - | ||||||||||||
| 8 | unsigned int ti[2]; | - | ||||||||||||
| 9 | unsigned char *iv; | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | - | |||||||||||||
| 13 | unsigned int sh[4]; | - | ||||||||||||
| 14 | unsigned char *ovec=(unsigned char *)sh; | - | ||||||||||||
| 15 | - | |||||||||||||
| 16 | - | |||||||||||||
| 17 | if (numbits<=0
never executed: return; | 0-62 | ||||||||||||
| 18 | iv = &(*ivec)[0]; | - | ||||||||||||
| 19 | (v0 =((unsigned int)(*((iv)++))) , v0|=((unsigned int)(*((iv)++)))<< 8L, v0|=((unsigned int)(*((iv)++)))<<16L, v0|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||||||||
| 20 | (v1 =((unsigned int)(*((iv)++))) , v1|=((unsigned int)(*((iv)++)))<< 8L, v1|=((unsigned int)(*((iv)++)))<<16L, v1|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||||||||
| 21 | if (enc
| 31 | ||||||||||||
| 22 | { | - | ||||||||||||
| 23 | while (l >= (unsigned long)n
| 31-1849 | ||||||||||||
| 24 | { | - | ||||||||||||
| 25 | l-=n; | - | ||||||||||||
| 26 | ti[0]=v0; | - | ||||||||||||
| 27 | ti[1]=v1; | - | ||||||||||||
| 28 | DES_encrypt1((unsigned int *)ti,schedule,1); | - | ||||||||||||
| 29 | { in+=n; d0=d1=0; switch (n) { case executed 3 times by 1 test: 8:case 8:Executed by:
executed 3 times by 1 test: d1 =((unsigned int)(*(--(in))))<<24L; casecase 8:Executed by:
never executed: case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: 7:case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: d1|=((unsigned int)(*(--(in))))<<16L; casecase 7:executed 4 times by 1 test: 6:case 6:Executed by:
executed 4 times by 1 test: case 6:Executed by:
code before this statement executed 3 times by 1 test: d1|=((unsigned int)(*(--(in))))<< 8L; casecase 6:Executed by:
never executed: case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: 5:case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: d1|=((unsigned int)(*(--(in)))); casecase 5:executed 6 times by 1 test: 4:case 4:Executed by:
executed 6 times by 1 test: case 4:Executed by:
code before this statement executed 7 times by 1 test: d0 =((unsigned int)(*(--(in))))<<24L; casecase 4:Executed by:
never executed: case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: 3:case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: d0|=((unsigned int)(*(--(in))))<<16L; casecase 3:executed 12 times by 1 test: 2:case 2:Executed by:
executed 12 times by 1 test: case 2:Executed by:
code before this statement executed 13 times by 1 test: d0|=((unsigned int)(*(--(in))))<< 8L; casecase 2:Executed by:
executed 1849 times by 2 tests: 1:case 1:Executed by:
executed 1849 times by 2 tests: case 1:Executed by:
code before this statement executed 25 times by 1 test: d0|=((unsigned int)(*(--(in)))); }case 1:Executed by:
executed 1849 times by 2 tests: };end of blockExecuted by:
| 0-1849 | ||||||||||||
| 30 | in+=n; | - | ||||||||||||
| 31 | d0^=ti[0]; | - | ||||||||||||
| 32 | d1^=ti[1]; | - | ||||||||||||
| 33 | { out+=n; switch (n) { case executed 3 times by 1 test: 8:case 8:Executed by:
executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8:Executed by:
never executed: case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: 7:case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7:executed 4 times by 1 test: 6:case 6:Executed by:
executed 4 times by 1 test: case 6:Executed by:
code before this statement executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6:Executed by:
never executed: case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: 5:case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5:executed 6 times by 1 test: 4:case 4:Executed by:
executed 6 times by 1 test: case 4:Executed by:
code before this statement executed 7 times by 1 test: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4:Executed by:
never executed: case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: 3:case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3:executed 12 times by 1 test: 2:case 2:Executed by:
executed 12 times by 1 test: case 2:Executed by:
code before this statement executed 13 times by 1 test: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2:Executed by:
executed 1849 times by 2 tests: 1:case 1:Executed by:
executed 1849 times by 2 tests: case 1:Executed by:
code before this statement executed 25 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1:Executed by:
executed 1849 times by 2 tests: };end of blockExecuted by:
| 0-1849 | ||||||||||||
| 34 | out+=n; | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | - | |||||||||||||
| 37 | if (numbits == 32
| 6-1843 | ||||||||||||
| 38 | { v0=v1; v1=d0; } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||
| 39 | else if (numbits == 64
| 3-1840 | ||||||||||||
| 40 | { v0=d0; v1=d1; } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||
| 41 | else | - | ||||||||||||
| 42 | { | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | - | |||||||||||||
| 47 | - | |||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | sh[0]=v0, sh[1]=v1, sh[2]=d0, sh[3]=d1; | - | ||||||||||||
| 51 | - | |||||||||||||
| 52 | if (rem==0
| 0-1840 | ||||||||||||
| 53 | memmove(ovec,ovec+num,8); executed 1840 times by 2 tests: memmove(ovec,ovec+num,8);Executed by:
| 1840 | ||||||||||||
| 54 | else | - | ||||||||||||
| 55 | for(i=0 ; i < 8
| 0 | ||||||||||||
| 56 | ovec[i]=ovec[i+num]<<rem | never executed: ovec[i]=ovec[i+num]<<rem | ovec[i+num+1]>>(8-rem); | 0 | ||||||||||||
| 57 | ovec[i+num+1]>>(8-rem); never executed: ovec[i]=ovec[i+num]<<rem | ovec[i+num+1]>>(8-rem); | 0 | ||||||||||||
| 58 | - | |||||||||||||
| 59 | v0=sh[0], v1=sh[1]; | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | - | |||||||||||||
| 62 | - | |||||||||||||
| 63 | - | |||||||||||||
| 64 | - | |||||||||||||
| 65 | } executed 1840 times by 2 tests: end of blockExecuted by:
| 1840 | ||||||||||||
| 66 | } | - | ||||||||||||
| 67 | } executed 31 times by 2 tests: end of blockExecuted by:
| 31 | ||||||||||||
| 68 | else | - | ||||||||||||
| 69 | { | - | ||||||||||||
| 70 | while (l >= (unsigned long)n
| 31-1849 | ||||||||||||
| 71 | { | - | ||||||||||||
| 72 | l-=n; | - | ||||||||||||
| 73 | ti[0]=v0; | - | ||||||||||||
| 74 | ti[1]=v1; | - | ||||||||||||
| 75 | DES_encrypt1((unsigned int *)ti,schedule,1); | - | ||||||||||||
| 76 | { in+=n; d0=d1=0; switch (n) { case executed 3 times by 1 test: 8:case 8:Executed by:
executed 3 times by 1 test: d1 =((unsigned int)(*(--(in))))<<24L; casecase 8:Executed by:
never executed: case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: 7:case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: d1|=((unsigned int)(*(--(in))))<<16L; casecase 7:executed 4 times by 1 test: 6:case 6:Executed by:
executed 4 times by 1 test: case 6:Executed by:
code before this statement executed 3 times by 1 test: d1|=((unsigned int)(*(--(in))))<< 8L; casecase 6:Executed by:
never executed: case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: 5:case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: d1|=((unsigned int)(*(--(in)))); casecase 5:executed 6 times by 1 test: 4:case 4:Executed by:
executed 6 times by 1 test: case 4:Executed by:
code before this statement executed 7 times by 1 test: d0 =((unsigned int)(*(--(in))))<<24L; casecase 4:Executed by:
never executed: case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: 3:case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: d0|=((unsigned int)(*(--(in))))<<16L; casecase 3:executed 12 times by 1 test: 2:case 2:Executed by:
executed 12 times by 1 test: case 2:Executed by:
code before this statement executed 13 times by 1 test: d0|=((unsigned int)(*(--(in))))<< 8L; casecase 2:Executed by:
executed 1849 times by 2 tests: 1:case 1:Executed by:
executed 1849 times by 2 tests: case 1:Executed by:
code before this statement executed 25 times by 1 test: d0|=((unsigned int)(*(--(in)))); }case 1:Executed by:
executed 1849 times by 2 tests: };end of blockExecuted by:
| 0-1849 | ||||||||||||
| 77 | in+=n; | - | ||||||||||||
| 78 | - | |||||||||||||
| 79 | - | |||||||||||||
| 80 | if (numbits == 32
| 6-1843 | ||||||||||||
| 81 | { v0=v1; v1=d0; } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||
| 82 | else if (numbits == 64
| 3-1840 | ||||||||||||
| 83 | { v0=d0; v1=d1; } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||
| 84 | else | - | ||||||||||||
| 85 | { | - | ||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | - | |||||||||||||
| 93 | sh[0]=v0, sh[1]=v1, sh[2]=d0, sh[3]=d1; | - | ||||||||||||
| 94 | - | |||||||||||||
| 95 | if (rem==0
| 0-1840 | ||||||||||||
| 96 | memmove(ovec,ovec+num,8); executed 1840 times by 2 tests: memmove(ovec,ovec+num,8);Executed by:
| 1840 | ||||||||||||
| 97 | else | - | ||||||||||||
| 98 | for(i=0 ; i < 8
| 0 | ||||||||||||
| 99 | ovec[i]=ovec[i+num]<<rem | never executed: ovec[i]=ovec[i+num]<<rem | ovec[i+num+1]>>(8-rem); | 0 | ||||||||||||
| 100 | ovec[i+num+1]>>(8-rem); never executed: ovec[i]=ovec[i+num]<<rem | ovec[i+num+1]>>(8-rem); | 0 | ||||||||||||
| 101 | - | |||||||||||||
| 102 | v0=sh[0], v1=sh[1]; | - | ||||||||||||
| 103 | - | |||||||||||||
| 104 | - | |||||||||||||
| 105 | - | |||||||||||||
| 106 | - | |||||||||||||
| 107 | - | |||||||||||||
| 108 | } executed 1840 times by 2 tests: end of blockExecuted by:
| 1840 | ||||||||||||
| 109 | d0^=ti[0]; | - | ||||||||||||
| 110 | d1^=ti[1]; | - | ||||||||||||
| 111 | { out+=n; switch (n) { case executed 3 times by 1 test: 8:case 8:Executed by:
executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8:Executed by:
never executed: case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: 7:case 7:code before this statement executed 3 times by 1 test: case 7:Executed by:
never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7:executed 4 times by 1 test: 6:case 6:Executed by:
executed 4 times by 1 test: case 6:Executed by:
code before this statement executed 3 times by 1 test: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6:Executed by:
never executed: case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: 5:case 5:code before this statement executed 7 times by 1 test: case 5:Executed by:
never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5:executed 6 times by 1 test: 4:case 4:Executed by:
executed 6 times by 1 test: case 4:Executed by:
code before this statement executed 7 times by 1 test: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4:Executed by:
never executed: case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: 3:case 3:code before this statement executed 13 times by 1 test: case 3:Executed by:
never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3:executed 12 times by 1 test: 2:case 2:Executed by:
executed 12 times by 1 test: case 2:Executed by:
code before this statement executed 13 times by 1 test: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2:Executed by:
executed 1849 times by 2 tests: 1:case 1:Executed by:
executed 1849 times by 2 tests: case 1:Executed by:
code before this statement executed 25 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1:Executed by:
executed 1849 times by 2 tests: };end of blockExecuted by:
| 0-1849 | ||||||||||||
| 112 | out+=n; | - | ||||||||||||
| 113 | } executed 1849 times by 2 tests: end of blockExecuted by:
| 1849 | ||||||||||||
| 114 | } executed 31 times by 2 tests: end of blockExecuted by:
| 31 | ||||||||||||
| 115 | iv = &(*ivec)[0]; | - | ||||||||||||
| 116 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||||||||
| 117 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||||||||
| 118 | v0=v1=d0=d1=ti[0]=ti[1]=0; | - | ||||||||||||
| 119 | } executed 62 times by 2 tests: end of blockExecuted by:
| 62 | ||||||||||||
| Switch to Source code | Preprocessed file |