| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/des/cfb64ede.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||
| 9 | long length, DES_key_schedule *ks1, | - | ||||||
| 10 | DES_key_schedule *ks2, DES_key_schedule *ks3, | - | ||||||
| 11 | DES_cblock *ivec, int *num, int enc) | - | ||||||
| 12 | { | - | ||||||
| 13 | register DES_LONG v0, v1; | - | ||||||
| 14 | register long l = length; | - | ||||||
| 15 | register int n = *num; | - | ||||||
| 16 | DES_LONG ti[2]; | - | ||||||
| 17 | unsigned char *iv, c, cc; | - | ||||||
| 18 | - | |||||||
| 19 | iv = &(*ivec)[0]; | - | ||||||
| 20 | if (enc
| 60-84 | ||||||
| 21 | while (l--
| 84-12580 | ||||||
| 22 | if (n == 0
| 1573-11007 | ||||||
| 23 | (v0 =((DES_LONG)(*((iv)++))) , v0|=((DES_LONG)(*((iv)++)))<< 8L, v0|=((DES_LONG)(*((iv)++)))<<16L, v0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 24 | (v1 =((DES_LONG)(*((iv)++))) , v1|=((DES_LONG)(*((iv)++)))<< 8L, v1|=((DES_LONG)(*((iv)++)))<<16L, v1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 25 | - | |||||||
| 26 | ti[0] = v0; | - | ||||||
| 27 | ti[1] = v1; | - | ||||||
| 28 | DES_encrypt3(ti, ks1, ks2, ks3); | - | ||||||
| 29 | v0 = ti[0]; | - | ||||||
| 30 | v1 = ti[1]; | - | ||||||
| 31 | - | |||||||
| 32 | iv = &(*ivec)[0]; | - | ||||||
| 33 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||
| 34 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||
| 35 | iv = &(*ivec)[0]; | - | ||||||
| 36 | } executed 1573 times by 1 test: end of blockExecuted by:
| 1573 | ||||||
| 37 | c = *(in++) ^ iv[n]; | - | ||||||
| 38 | *(out++) = c; | - | ||||||
| 39 | iv[n] = c; | - | ||||||
| 40 | n = (n + 1) & 0x07; | - | ||||||
| 41 | } executed 12580 times by 1 test: end of blockExecuted by:
| 12580 | ||||||
| 42 | } executed 84 times by 1 test: else {end of blockExecuted by:
| 84 | ||||||
| 43 | while (l--
| 60-12580 | ||||||
| 44 | if (n == 0
| 1573-11007 | ||||||
| 45 | (v0 =((DES_LONG)(*((iv)++))) , v0|=((DES_LONG)(*((iv)++)))<< 8L, v0|=((DES_LONG)(*((iv)++)))<<16L, v0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 46 | (v1 =((DES_LONG)(*((iv)++))) , v1|=((DES_LONG)(*((iv)++)))<< 8L, v1|=((DES_LONG)(*((iv)++)))<<16L, v1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 47 | - | |||||||
| 48 | ti[0] = v0; | - | ||||||
| 49 | ti[1] = v1; | - | ||||||
| 50 | DES_encrypt3(ti, ks1, ks2, ks3); | - | ||||||
| 51 | v0 = ti[0]; | - | ||||||
| 52 | v1 = ti[1]; | - | ||||||
| 53 | - | |||||||
| 54 | iv = &(*ivec)[0]; | - | ||||||
| 55 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||
| 56 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||
| 57 | iv = &(*ivec)[0]; | - | ||||||
| 58 | } executed 1573 times by 1 test: end of blockExecuted by:
| 1573 | ||||||
| 59 | cc = *(in++); | - | ||||||
| 60 | c = iv[n]; | - | ||||||
| 61 | iv[n] = cc; | - | ||||||
| 62 | *(out++) = c ^ cc; | - | ||||||
| 63 | n = (n + 1) & 0x07; | - | ||||||
| 64 | } executed 12580 times by 1 test: end of blockExecuted by:
| 12580 | ||||||
| 65 | } executed 60 times by 1 test: end of blockExecuted by:
| 60 | ||||||
| 66 | v0 = v1 = ti[0] = ti[1] = c = cc = 0; | - | ||||||
| 67 | *num = n; | - | ||||||
| 68 | } executed 144 times by 1 test: end of blockExecuted by:
| 144 | ||||||
| 69 | - | |||||||
| 70 | - | |||||||
| 71 | - | |||||||
| 72 | - | |||||||
| 73 | - | |||||||
| 74 | - | |||||||
| 75 | void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, | - | ||||||
| 76 | int numbits, long length, DES_key_schedule *ks1, | - | ||||||
| 77 | DES_key_schedule *ks2, DES_key_schedule *ks3, | - | ||||||
| 78 | DES_cblock *ivec, int enc) | - | ||||||
| 79 | { | - | ||||||
| 80 | register DES_LONG d0, d1, v0, v1; | - | ||||||
| 81 | register unsigned long l = length, n = ((unsigned int)numbits + 7) / 8; | - | ||||||
| 82 | register int num = numbits, i; | - | ||||||
| 83 | DES_LONG ti[2]; | - | ||||||
| 84 | unsigned char *iv; | - | ||||||
| 85 | unsigned char ovec[16]; | - | ||||||
| 86 | - | |||||||
| 87 | if (num > 64
| 0-34530 | ||||||
| 88 | return; never executed: return; | 0 | ||||||
| 89 | iv = &(*ivec)[0]; | - | ||||||
| 90 | (v0 =((DES_LONG)(*((iv)++))) , v0|=((DES_LONG)(*((iv)++)))<< 8L, v0|=((DES_LONG)(*((iv)++)))<<16L, v0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 91 | (v1 =((DES_LONG)(*((iv)++))) , v1|=((DES_LONG)(*((iv)++)))<< 8L, v1|=((DES_LONG)(*((iv)++)))<<16L, v1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 92 | if (enc
| 16737-17793 | ||||||
| 93 | while (l >= n
| 16737-18696 | ||||||
| 94 | l -= n; | - | ||||||
| 95 | ti[0] = v0; | - | ||||||
| 96 | ti[1] = v1; | - | ||||||
| 97 | DES_encrypt3(ti, ks1, ks2, ks3); | - | ||||||
| 98 | { in+=n; d0=d1=0; switch (n) { case never executed: 8:case 8:never executed: d1 =((DES_LONG)(*(--(in))))<<24L; casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: d1|=((DES_LONG)(*(--(in))))<<16L; casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: d1|=((DES_LONG)(*(--(in))))<< 8L; casecase 6:never executed: 5:case 5:never executed: case 5:code before this statement never executed: d1|=((DES_LONG)(*(--(in)))); casecase 5:never executed: 4:case 4:never executed: case 4:code before this statement never executed: d0 =((DES_LONG)(*(--(in))))<<24L; casecase 4:never executed: 3:case 3:never executed: case 3:code before this statement never executed: d0|=((DES_LONG)(*(--(in))))<<16L; casecase 3:never executed: 2:case 2:never executed: case 2:code before this statement never executed: d0|=((DES_LONG)(*(--(in))))<< 8L; casecase 2:executed 18696 times by 1 test: case 1:Executed by:
code before this statement never executed: case 1:executed 18696 times by 1 test: 1:case 1:Executed by:
code before this statement never executed: case 1:executed 18696 times by 1 test: d0|=((DES_LONG)(*(--(in)))); }case 1:Executed by:
executed 18696 times by 1 test: };end of blockExecuted by:
| 0-18696 | ||||||
| 99 | in += n; | - | ||||||
| 100 | d0 ^= ti[0]; | - | ||||||
| 101 | d1 ^= ti[1]; | - | ||||||
| 102 | { out+=n; switch (n) { case never executed: 8:case 8:never executed: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6:never executed: 5:case 5:never executed: case 5:code before this statement never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5:never executed: 4:case 4:never executed: case 4:code before this statement never executed: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4:never executed: 3:case 3:never executed: case 3:code before this statement never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3:never executed: 2:case 2:never executed: case 2:code before this statement never executed: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2:executed 18696 times by 1 test: case 1:Executed by:
code before this statement never executed: case 1:executed 18696 times by 1 test: 1:case 1:Executed by:
code before this statement never executed: case 1:executed 18696 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1:Executed by:
executed 18696 times by 1 test: };end of blockExecuted by:
| 0-18696 | ||||||
| 103 | out += n; | - | ||||||
| 104 | - | |||||||
| 105 | - | |||||||
| 106 | - | |||||||
| 107 | - | |||||||
| 108 | if (num == 32
| 0-18696 | ||||||
| 109 | v0 = v1; | - | ||||||
| 110 | v1 = d0; | - | ||||||
| 111 | } never executed: else if (num == 64end of block
| 0-18696 | ||||||
| 112 | v0 = d0; | - | ||||||
| 113 | v1 = d1; | - | ||||||
| 114 | } never executed: else {end of block | 0 | ||||||
| 115 | iv = &ovec[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 | (*((iv)++)=(unsigned char)(((d0) )&0xff), *((iv)++)=(unsigned char)(((d0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((d0)>>16L)&0xff), *((iv)++)=(unsigned char)(((d0)>>24L)&0xff)); | - | ||||||
| 119 | (*((iv)++)=(unsigned char)(((d1) )&0xff), *((iv)++)=(unsigned char)(((d1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((d1)>>16L)&0xff), *((iv)++)=(unsigned char)(((d1)>>24L)&0xff)); | - | ||||||
| 120 | - | |||||||
| 121 | memmove(ovec, ovec + num / 8, 8 + (num % 8 ? 1 : 0)); | - | ||||||
| 122 | - | |||||||
| 123 | if (num % 8 != 0
| 1960-16736 | ||||||
| 124 | for (i = 0; i < 8
| 16736-133888 | ||||||
| 125 | ovec[i] <<= num % 8; | - | ||||||
| 126 | ovec[i] |= ovec[i + 1] >> (8 - num % 8); | - | ||||||
| 127 | } executed 133888 times by 1 test: end of blockExecuted by:
| 133888 | ||||||
| 128 | iv = &ovec[0]; | - | ||||||
| 129 | (v0 =((DES_LONG)(*((iv)++))) , v0|=((DES_LONG)(*((iv)++)))<< 8L, v0|=((DES_LONG)(*((iv)++)))<<16L, v0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 130 | (v1 =((DES_LONG)(*((iv)++))) , v1|=((DES_LONG)(*((iv)++)))<< 8L, v1|=((DES_LONG)(*((iv)++)))<<16L, v1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 131 | } executed 18696 times by 1 test: end of blockExecuted by:
| 18696 | ||||||
| 132 | } | - | ||||||
| 133 | } executed 16737 times by 1 test: else {end of blockExecuted by:
| 16737 | ||||||
| 134 | while (l >= n
| 17793-19752 | ||||||
| 135 | l -= n; | - | ||||||
| 136 | ti[0] = v0; | - | ||||||
| 137 | ti[1] = v1; | - | ||||||
| 138 | DES_encrypt3(ti, ks1, ks2, ks3); | - | ||||||
| 139 | { in+=n; d0=d1=0; switch (n) { case never executed: 8:case 8:never executed: d1 =((DES_LONG)(*(--(in))))<<24L; casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: d1|=((DES_LONG)(*(--(in))))<<16L; casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: d1|=((DES_LONG)(*(--(in))))<< 8L; casecase 6:never executed: 5:case 5:never executed: case 5:code before this statement never executed: d1|=((DES_LONG)(*(--(in)))); casecase 5:never executed: 4:case 4:never executed: case 4:code before this statement never executed: d0 =((DES_LONG)(*(--(in))))<<24L; casecase 4:never executed: 3:case 3:never executed: case 3:code before this statement never executed: d0|=((DES_LONG)(*(--(in))))<<16L; casecase 3:never executed: 2:case 2:never executed: case 2:code before this statement never executed: d0|=((DES_LONG)(*(--(in))))<< 8L; casecase 2:executed 19752 times by 1 test: case 1:Executed by:
code before this statement never executed: case 1:executed 19752 times by 1 test: 1:case 1:Executed by:
code before this statement never executed: case 1:executed 19752 times by 1 test: d0|=((DES_LONG)(*(--(in)))); }case 1:Executed by:
executed 19752 times by 1 test: };end of blockExecuted by:
| 0-19752 | ||||||
| 140 | in += n; | - | ||||||
| 141 | - | |||||||
| 142 | - | |||||||
| 143 | - | |||||||
| 144 | - | |||||||
| 145 | if (num == 32
| 0-19752 | ||||||
| 146 | v0 = v1; | - | ||||||
| 147 | v1 = d0; | - | ||||||
| 148 | } never executed: else if (num == 64end of block
| 0-19752 | ||||||
| 149 | v0 = d0; | - | ||||||
| 150 | v1 = d1; | - | ||||||
| 151 | } never executed: else {end of block | 0 | ||||||
| 152 | iv = &ovec[0]; | - | ||||||
| 153 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||
| 154 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||
| 155 | (*((iv)++)=(unsigned char)(((d0) )&0xff), *((iv)++)=(unsigned char)(((d0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((d0)>>16L)&0xff), *((iv)++)=(unsigned char)(((d0)>>24L)&0xff)); | - | ||||||
| 156 | (*((iv)++)=(unsigned char)(((d1) )&0xff), *((iv)++)=(unsigned char)(((d1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((d1)>>16L)&0xff), *((iv)++)=(unsigned char)(((d1)>>24L)&0xff)); | - | ||||||
| 157 | - | |||||||
| 158 | memmove(ovec, ovec + num / 8, 8 + (num % 8 ? 1 : 0)); | - | ||||||
| 159 | - | |||||||
| 160 | if (num % 8 != 0
| 1960-17792 | ||||||
| 161 | for (i = 0; i < 8
| 17792-142336 | ||||||
| 162 | ovec[i] <<= num % 8; | - | ||||||
| 163 | ovec[i] |= ovec[i + 1] >> (8 - num % 8); | - | ||||||
| 164 | } executed 142336 times by 1 test: end of blockExecuted by:
| 142336 | ||||||
| 165 | iv = &ovec[0]; | - | ||||||
| 166 | (v0 =((DES_LONG)(*((iv)++))) , v0|=((DES_LONG)(*((iv)++)))<< 8L, v0|=((DES_LONG)(*((iv)++)))<<16L, v0|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 167 | (v1 =((DES_LONG)(*((iv)++))) , v1|=((DES_LONG)(*((iv)++)))<< 8L, v1|=((DES_LONG)(*((iv)++)))<<16L, v1|=((DES_LONG)(*((iv)++)))<<24L); | - | ||||||
| 168 | } executed 19752 times by 1 test: end of blockExecuted by:
| 19752 | ||||||
| 169 | d0 ^= ti[0]; | - | ||||||
| 170 | d1 ^= ti[1]; | - | ||||||
| 171 | { out+=n; switch (n) { case never executed: 8:case 8:never executed: *(--(out))=(unsigned char)(((d1)>>24L)&0xff); casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: *(--(out))=(unsigned char)(((d1)>>16L)&0xff); casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: *(--(out))=(unsigned char)(((d1)>> 8L)&0xff); casecase 6:never executed: 5:case 5:never executed: case 5:code before this statement never executed: *(--(out))=(unsigned char)(((d1) )&0xff); casecase 5:never executed: 4:case 4:never executed: case 4:code before this statement never executed: *(--(out))=(unsigned char)(((d0)>>24L)&0xff); casecase 4:never executed: 3:case 3:never executed: case 3:code before this statement never executed: *(--(out))=(unsigned char)(((d0)>>16L)&0xff); casecase 3:never executed: 2:case 2:never executed: case 2:code before this statement never executed: *(--(out))=(unsigned char)(((d0)>> 8L)&0xff); casecase 2:executed 19752 times by 1 test: case 1:Executed by:
code before this statement never executed: case 1:executed 19752 times by 1 test: 1:case 1:Executed by:
code before this statement never executed: case 1:executed 19752 times by 1 test: *(--(out))=(unsigned char)(((d0) )&0xff); }case 1:Executed by:
executed 19752 times by 1 test: };end of blockExecuted by:
| 0-19752 | ||||||
| 172 | out += n; | - | ||||||
| 173 | } executed 19752 times by 1 test: end of blockExecuted by:
| 19752 | ||||||
| 174 | } executed 17793 times by 1 test: end of blockExecuted by:
| 17793 | ||||||
| 175 | iv = &(*ivec)[0]; | - | ||||||
| 176 | (*((iv)++)=(unsigned char)(((v0) )&0xff), *((iv)++)=(unsigned char)(((v0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v0)>>16L)&0xff), *((iv)++)=(unsigned char)(((v0)>>24L)&0xff)); | - | ||||||
| 177 | (*((iv)++)=(unsigned char)(((v1) )&0xff), *((iv)++)=(unsigned char)(((v1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((v1)>>16L)&0xff), *((iv)++)=(unsigned char)(((v1)>>24L)&0xff)); | - | ||||||
| 178 | v0 = v1 = d0 = d1 = ti[0] = ti[1] = 0; | - | ||||||
| 179 | } executed 34530 times by 1 test: end of blockExecuted by:
| 34530 | ||||||
| Switch to Source code | Preprocessed file |