| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/cast/c_enc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | void CAST_encrypt(unsigned int *data, const CAST_KEY *key) | - | ||||||
| 4 | { | - | ||||||
| 5 | unsigned int l,r,t; | - | ||||||
| 6 | const unsigned int *k; | - | ||||||
| 7 | - | |||||||
| 8 | k= &(key->data[0]); | - | ||||||
| 9 | l=data[0]; | - | ||||||
| 10 | r=data[1]; | - | ||||||
| 11 | - | |||||||
| 12 | { unsigned int a,b,c,d; t=(k[0*2] + r)&0xffffffff; t=((((t)<<((k[0*2+1])))&0xffffffffL)|((t)>>(32-((k[0*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 13 | { unsigned int a,b,c,d; t=(k[1*2] ^ l)&0xffffffff; t=((((t)<<((k[1*2+1])))&0xffffffffL)|((t)>>(32-((k[1*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 14 | { unsigned int a,b,c,d; t=(k[2*2] - r)&0xffffffff; t=((((t)<<((k[2*2+1])))&0xffffffffL)|((t)>>(32-((k[2*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 15 | { unsigned int a,b,c,d; t=(k[3*2] + l)&0xffffffff; t=((((t)<<((k[3*2+1])))&0xffffffffL)|((t)>>(32-((k[3*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 16 | { unsigned int a,b,c,d; t=(k[4*2] ^ r)&0xffffffff; t=((((t)<<((k[4*2+1])))&0xffffffffL)|((t)>>(32-((k[4*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 17 | { unsigned int a,b,c,d; t=(k[5*2] - l)&0xffffffff; t=((((t)<<((k[5*2+1])))&0xffffffffL)|((t)>>(32-((k[5*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 18 | { unsigned int a,b,c,d; t=(k[6*2] + r)&0xffffffff; t=((((t)<<((k[6*2+1])))&0xffffffffL)|((t)>>(32-((k[6*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 19 | { unsigned int a,b,c,d; t=(k[7*2] ^ l)&0xffffffff; t=((((t)<<((k[7*2+1])))&0xffffffffL)|((t)>>(32-((k[7*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 20 | { unsigned int a,b,c,d; t=(k[8*2] - r)&0xffffffff; t=((((t)<<((k[8*2+1])))&0xffffffffL)|((t)>>(32-((k[8*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 21 | { unsigned int a,b,c,d; t=(k[9*2] + l)&0xffffffff; t=((((t)<<((k[9*2+1])))&0xffffffffL)|((t)>>(32-((k[9*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 22 | { unsigned int a,b,c,d; t=(k[10*2] ^ r)&0xffffffff; t=((((t)<<((k[10*2+1])))&0xffffffffL)|((t)>>(32-((k[10*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 23 | { unsigned int a,b,c,d; t=(k[11*2] - l)&0xffffffff; t=((((t)<<((k[11*2+1])))&0xffffffffL)|((t)>>(32-((k[11*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 24 | if(!key->short_key
| 2-4001561 | ||||||
| 25 | { | - | ||||||
| 26 | { unsigned int a,b,c,d; t=(k[12*2] + r)&0xffffffff; t=((((t)<<((k[12*2+1])))&0xffffffffL)|((t)>>(32-((k[12*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 27 | { unsigned int a,b,c,d; t=(k[13*2] ^ l)&0xffffffff; t=((((t)<<((k[13*2+1])))&0xffffffffL)|((t)>>(32-((k[13*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 28 | { unsigned int a,b,c,d; t=(k[14*2] - r)&0xffffffff; t=((((t)<<((k[14*2+1])))&0xffffffffL)|((t)>>(32-((k[14*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 29 | { unsigned int a,b,c,d; t=(k[15*2] + l)&0xffffffff; t=((((t)<<((k[15*2+1])))&0xffffffffL)|((t)>>(32-((k[15*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 30 | } executed 4001561 times by 2 tests: end of blockExecuted by:
| 4001561 | ||||||
| 31 | - | |||||||
| 32 | data[1]=l&0xffffffffL; | - | ||||||
| 33 | data[0]=r&0xffffffffL; | - | ||||||
| 34 | } executed 4001563 times by 2 tests: end of blockExecuted by:
| 4001563 | ||||||
| 35 | - | |||||||
| 36 | void CAST_decrypt(unsigned int *data, const CAST_KEY *key) | - | ||||||
| 37 | { | - | ||||||
| 38 | unsigned int l,r,t; | - | ||||||
| 39 | const unsigned int *k; | - | ||||||
| 40 | - | |||||||
| 41 | k= &(key->data[0]); | - | ||||||
| 42 | l=data[0]; | - | ||||||
| 43 | r=data[1]; | - | ||||||
| 44 | - | |||||||
| 45 | if(!key->short_key
| 2-673 | ||||||
| 46 | { | - | ||||||
| 47 | { unsigned int a,b,c,d; t=(k[15*2] + r)&0xffffffff; t=((((t)<<((k[15*2+1])))&0xffffffffL)|((t)>>(32-((k[15*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 48 | { unsigned int a,b,c,d; t=(k[14*2] - l)&0xffffffff; t=((((t)<<((k[14*2+1])))&0xffffffffL)|((t)>>(32-((k[14*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 49 | { unsigned int a,b,c,d; t=(k[13*2] ^ r)&0xffffffff; t=((((t)<<((k[13*2+1])))&0xffffffffL)|((t)>>(32-((k[13*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 50 | { unsigned int a,b,c,d; t=(k[12*2] + l)&0xffffffff; t=((((t)<<((k[12*2+1])))&0xffffffffL)|((t)>>(32-((k[12*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 51 | } executed 673 times by 2 tests: end of blockExecuted by:
| 673 | ||||||
| 52 | { unsigned int a,b,c,d; t=(k[11*2] - r)&0xffffffff; t=((((t)<<((k[11*2+1])))&0xffffffffL)|((t)>>(32-((k[11*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 53 | { unsigned int a,b,c,d; t=(k[10*2] ^ l)&0xffffffff; t=((((t)<<((k[10*2+1])))&0xffffffffL)|((t)>>(32-((k[10*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 54 | { unsigned int a,b,c,d; t=(k[9*2] + r)&0xffffffff; t=((((t)<<((k[9*2+1])))&0xffffffffL)|((t)>>(32-((k[9*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 55 | { unsigned int a,b,c,d; t=(k[8*2] - l)&0xffffffff; t=((((t)<<((k[8*2+1])))&0xffffffffL)|((t)>>(32-((k[8*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 56 | { unsigned int a,b,c,d; t=(k[7*2] ^ r)&0xffffffff; t=((((t)<<((k[7*2+1])))&0xffffffffL)|((t)>>(32-((k[7*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 57 | { unsigned int a,b,c,d; t=(k[6*2] + l)&0xffffffff; t=((((t)<<((k[6*2+1])))&0xffffffffL)|((t)>>(32-((k[6*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 58 | { unsigned int a,b,c,d; t=(k[5*2] - r)&0xffffffff; t=((((t)<<((k[5*2+1])))&0xffffffffL)|((t)>>(32-((k[5*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 59 | { unsigned int a,b,c,d; t=(k[4*2] ^ l)&0xffffffff; t=((((t)<<((k[4*2+1])))&0xffffffffL)|((t)>>(32-((k[4*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 60 | { unsigned int a,b,c,d; t=(k[3*2] + r)&0xffffffff; t=((((t)<<((k[3*2+1])))&0xffffffffL)|((t)>>(32-((k[3*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 61 | { unsigned int a,b,c,d; t=(k[2*2] - l)&0xffffffff; t=((((t)<<((k[2*2+1])))&0xffffffffL)|((t)>>(32-((k[2*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a + b)&0xffffffffL) ^ c)&0xffffffffL) - d)&0xffffffffL; }; | - | ||||||
| 62 | { unsigned int a,b,c,d; t=(k[1*2] ^ r)&0xffffffff; t=((((t)<<((k[1*2+1])))&0xffffffffL)|((t)>>(32-((k[1*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; l^=(((((a - b)&0xffffffffL) + c)&0xffffffffL) ^ d)&0xffffffffL; }; | - | ||||||
| 63 | { unsigned int a,b,c,d; t=(k[0*2] + l)&0xffffffff; t=((((t)<<((k[0*2+1])))&0xffffffffL)|((t)>>(32-((k[0*2+1]))))); a=CAST_S_table0[(t>> 8)&0xff]; b=CAST_S_table1[(t )&0xff]; c=CAST_S_table2[(t>>24)&0xff]; d=CAST_S_table3[(t>>16)&0xff]; r^=(((((a ^ b)&0xffffffffL) - c)&0xffffffffL) + d)&0xffffffffL; }; | - | ||||||
| 64 | - | |||||||
| 65 | data[1]=l&0xffffffffL; | - | ||||||
| 66 | data[0]=r&0xffffffffL; | - | ||||||
| 67 | } executed 675 times by 2 tests: end of blockExecuted by:
| 675 | ||||||
| 68 | - | |||||||
| 69 | - | |||||||
| 70 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | - | ||||||
| 71 | const CAST_KEY *ks, unsigned char *iv, int enc) | - | ||||||
| 72 | { | - | ||||||
| 73 | unsigned int tin0,tin1; | - | ||||||
| 74 | unsigned int tout0,tout1,xor0,xor1; | - | ||||||
| 75 | long l=length; | - | ||||||
| 76 | unsigned int tin[2]; | - | ||||||
| 77 | - | |||||||
| 78 | if (enc
| 4-8 | ||||||
| 79 | { | - | ||||||
| 80 | (tout0 =((unsigned long)(*((iv)++)))<<24L, tout0|=((unsigned long)(*((iv)++)))<<16L, tout0|=((unsigned long)(*((iv)++)))<< 8L, tout0|=((unsigned long)(*((iv)++)))); | - | ||||||
| 81 | (tout1 =((unsigned long)(*((iv)++)))<<24L, tout1|=((unsigned long)(*((iv)++)))<<16L, tout1|=((unsigned long)(*((iv)++)))<< 8L, tout1|=((unsigned long)(*((iv)++)))); | - | ||||||
| 82 | iv-=8; | - | ||||||
| 83 | for (l-=8; l>=0
| 8-448 | ||||||
| 84 | { | - | ||||||
| 85 | (tin0 =((unsigned long)(*((in)++)))<<24L, tin0|=((unsigned long)(*((in)++)))<<16L, tin0|=((unsigned long)(*((in)++)))<< 8L, tin0|=((unsigned long)(*((in)++)))); | - | ||||||
| 86 | (tin1 =((unsigned long)(*((in)++)))<<24L, tin1|=((unsigned long)(*((in)++)))<<16L, tin1|=((unsigned long)(*((in)++)))<< 8L, tin1|=((unsigned long)(*((in)++)))); | - | ||||||
| 87 | tin0^=tout0; | - | ||||||
| 88 | tin1^=tout1; | - | ||||||
| 89 | tin[0]=tin0; | - | ||||||
| 90 | tin[1]=tin1; | - | ||||||
| 91 | CAST_encrypt(tin,ks); | - | ||||||
| 92 | tout0=tin[0]; | - | ||||||
| 93 | tout1=tin[1]; | - | ||||||
| 94 | (*((out)++)=(unsigned char)(((tout0)>>24L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0) )&0xff)); | - | ||||||
| 95 | (*((out)++)=(unsigned char)(((tout1)>>24L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1) )&0xff)); | - | ||||||
| 96 | } executed 448 times by 1 test: end of blockExecuted by:
| 448 | ||||||
| 97 | if (l != -8
| 0-8 | ||||||
| 98 | { | - | ||||||
| 99 | { in+=l+8; tin0=tin1=0; switch (l+8) { case never executed: 8:case 8:never executed: tin1 =((unsigned long)(*(--(in)))) ; casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: tin1|=((unsigned long)(*(--(in))))<< 8; casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: tin1|=((unsigned long)(*(--(in))))<<16; casecase 6:never executed: 5:case 5:never executed: case 5:code before this statement never executed: tin1|=((unsigned long)(*(--(in))))<<24; casecase 5:never executed: 4:case 4:never executed: case 4:code before this statement never executed: tin0 =((unsigned long)(*(--(in)))) ; casecase 4:never executed: 3:case 3:never executed: case 3:code before this statement never executed: tin0|=((unsigned long)(*(--(in))))<< 8; casecase 3:never executed: 2:case 2:never executed: case 2:code before this statement never executed: tin0|=((unsigned long)(*(--(in))))<<16; casecase 2:never executed: 1:case 1:never executed: case 1:code before this statement never executed: tin0|=((unsigned long)(*(--(in))))<<24; }case 1:never executed: };end of block | 0 | ||||||
| 100 | tin0^=tout0; | - | ||||||
| 101 | tin1^=tout1; | - | ||||||
| 102 | tin[0]=tin0; | - | ||||||
| 103 | tin[1]=tin1; | - | ||||||
| 104 | CAST_encrypt(tin,ks); | - | ||||||
| 105 | tout0=tin[0]; | - | ||||||
| 106 | tout1=tin[1]; | - | ||||||
| 107 | (*((out)++)=(unsigned char)(((tout0)>>24L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0) )&0xff)); | - | ||||||
| 108 | (*((out)++)=(unsigned char)(((tout1)>>24L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1) )&0xff)); | - | ||||||
| 109 | } never executed: end of block | 0 | ||||||
| 110 | (*((iv)++)=(unsigned char)(((tout0)>>24L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout0) )&0xff)); | - | ||||||
| 111 | (*((iv)++)=(unsigned char)(((tout1)>>24L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout1) )&0xff)); | - | ||||||
| 112 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||
| 113 | else | - | ||||||
| 114 | { | - | ||||||
| 115 | (xor0 =((unsigned long)(*((iv)++)))<<24L, xor0|=((unsigned long)(*((iv)++)))<<16L, xor0|=((unsigned long)(*((iv)++)))<< 8L, xor0|=((unsigned long)(*((iv)++)))); | - | ||||||
| 116 | (xor1 =((unsigned long)(*((iv)++)))<<24L, xor1|=((unsigned long)(*((iv)++)))<<16L, xor1|=((unsigned long)(*((iv)++)))<< 8L, xor1|=((unsigned long)(*((iv)++)))); | - | ||||||
| 117 | iv-=8; | - | ||||||
| 118 | for (l-=8; l>=0
| 4-448 | ||||||
| 119 | { | - | ||||||
| 120 | (tin0 =((unsigned long)(*((in)++)))<<24L, tin0|=((unsigned long)(*((in)++)))<<16L, tin0|=((unsigned long)(*((in)++)))<< 8L, tin0|=((unsigned long)(*((in)++)))); | - | ||||||
| 121 | (tin1 =((unsigned long)(*((in)++)))<<24L, tin1|=((unsigned long)(*((in)++)))<<16L, tin1|=((unsigned long)(*((in)++)))<< 8L, tin1|=((unsigned long)(*((in)++)))); | - | ||||||
| 122 | tin[0]=tin0; | - | ||||||
| 123 | tin[1]=tin1; | - | ||||||
| 124 | CAST_decrypt(tin,ks); | - | ||||||
| 125 | tout0=tin[0]^xor0; | - | ||||||
| 126 | tout1=tin[1]^xor1; | - | ||||||
| 127 | (*((out)++)=(unsigned char)(((tout0)>>24L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0) )&0xff)); | - | ||||||
| 128 | (*((out)++)=(unsigned char)(((tout1)>>24L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1) )&0xff)); | - | ||||||
| 129 | xor0=tin0; | - | ||||||
| 130 | xor1=tin1; | - | ||||||
| 131 | } executed 448 times by 1 test: end of blockExecuted by:
| 448 | ||||||
| 132 | if (l != -8
| 0-4 | ||||||
| 133 | { | - | ||||||
| 134 | (tin0 =((unsigned long)(*((in)++)))<<24L, tin0|=((unsigned long)(*((in)++)))<<16L, tin0|=((unsigned long)(*((in)++)))<< 8L, tin0|=((unsigned long)(*((in)++)))); | - | ||||||
| 135 | (tin1 =((unsigned long)(*((in)++)))<<24L, tin1|=((unsigned long)(*((in)++)))<<16L, tin1|=((unsigned long)(*((in)++)))<< 8L, tin1|=((unsigned long)(*((in)++)))); | - | ||||||
| 136 | tin[0]=tin0; | - | ||||||
| 137 | tin[1]=tin1; | - | ||||||
| 138 | CAST_decrypt(tin,ks); | - | ||||||
| 139 | tout0=tin[0]^xor0; | - | ||||||
| 140 | tout1=tin[1]^xor1; | - | ||||||
| 141 | { out+=l+8; switch (l+8) { case never executed: 8:case 8:never executed: *(--(out))=(unsigned char)(((tout1) )&0xff); casecase 8:never executed: 7:case 7:never executed: case 7:code before this statement never executed: *(--(out))=(unsigned char)(((tout1)>> 8)&0xff); casecase 7:never executed: 6:case 6:never executed: case 6:code before this statement never executed: *(--(out))=(unsigned char)(((tout1)>>16)&0xff); casecase 6:never executed: 5:case 5:never executed: case 5:code before this statement never executed: *(--(out))=(unsigned char)(((tout1)>>24)&0xff); casecase 5:never executed: 4:case 4:never executed: case 4:code before this statement never executed: *(--(out))=(unsigned char)(((tout0) )&0xff); casecase 4:never executed: 3:case 3:never executed: case 3:code before this statement never executed: *(--(out))=(unsigned char)(((tout0)>> 8)&0xff); casecase 3:never executed: 2:case 2:never executed: case 2:code before this statement never executed: *(--(out))=(unsigned char)(((tout0)>>16)&0xff); casecase 2:never executed: 1:case 1:never executed: case 1:code before this statement never executed: *(--(out))=(unsigned char)(((tout0)>>24)&0xff); }case 1:never executed: };end of block | 0 | ||||||
| 142 | xor0=tin0; | - | ||||||
| 143 | xor1=tin1; | - | ||||||
| 144 | } never executed: end of block | 0 | ||||||
| 145 | (*((iv)++)=(unsigned char)(((xor0)>>24L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor0) )&0xff)); | - | ||||||
| 146 | (*((iv)++)=(unsigned char)(((xor1)>>24L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor1) )&0xff)); | - | ||||||
| 147 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||
| 148 | tin0=tin1=tout0=tout1=xor0=xor1=0; | - | ||||||
| 149 | tin[0]=tin[1]=0; | - | ||||||
| 150 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||
| Switch to Source code | Preprocessed file |