| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/des/des_enc.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | void DES_encrypt1(unsigned int *data, DES_key_schedule *ks, int enc) | - | ||||||
| 5 | { | - | ||||||
| 6 | unsigned int l,r,t,u; | - | ||||||
| 7 | - | |||||||
| 8 | - | |||||||
| 9 | - | |||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | - | |||||||
| 13 | unsigned int *s; | - | ||||||
| 14 | - | |||||||
| 15 | r=data[0]; | - | ||||||
| 16 | l=data[1]; | - | ||||||
| 17 | - | |||||||
| 18 | { unsigned int tt; ((tt)=((((l)>>(4))^(r))&(0x0f0f0f0fL)), (r)^=(tt), (l)^=((tt)<<(4))); ((tt)=((((r)>>(16))^(l))&(0x0000ffffL)), (l)^=(tt), (r)^=((tt)<<(16))); ((tt)=((((l)>>(2))^(r))&(0x33333333L)), (r)^=(tt), (l)^=((tt)<<(2))); ((tt)=((((r)>>(8))^(l))&(0x00ff00ffL)), (l)^=(tt), (r)^=((tt)<<(8))); ((tt)=((((l)>>(1))^(r))&(0x55555555L)), (r)^=(tt), (l)^=((tt)<<(1))); }; | - | ||||||
| 19 | r=ROTATE(r,29)&0xffffffffL; | - | ||||||
| 20 | l=ROTATE(l,29)&0xffffffffL; | - | ||||||
| 21 | - | |||||||
| 22 | s=ks->ks->deslong; | - | ||||||
| 23 | - | |||||||
| 24 | - | |||||||
| 25 | if (enc
| 741-5389 | ||||||
| 26 | { | - | ||||||
| 27 | - | |||||||
| 28 | { u=r^s[0 ]; t=r^s[0 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 29 | { u=l^s[2 ]; t=l^s[2 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 30 | { u=r^s[4 ]; t=r^s[4 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 31 | { u=l^s[6 ]; t=l^s[6 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 32 | { u=r^s[8 ]; t=r^s[8 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 33 | { u=l^s[10 ]; t=l^s[10 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 34 | { u=r^s[12 ]; t=r^s[12 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 35 | { u=l^s[14 ]; t=l^s[14 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 36 | { u=r^s[16 ]; t=r^s[16 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 37 | { u=l^s[18 ]; t=l^s[18 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 38 | { u=r^s[20 ]; t=r^s[20 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 39 | { u=l^s[22 ]; t=l^s[22 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 40 | { u=r^s[24 ]; t=r^s[24 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 41 | { u=l^s[26 ]; t=l^s[26 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 42 | { u=r^s[28 ]; t=r^s[28 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 43 | { u=l^s[30 ]; t=l^s[30 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 44 | - | |||||||
| 45 | - | |||||||
| 46 | - | |||||||
| 47 | - | |||||||
| 48 | - | |||||||
| 49 | - | |||||||
| 50 | - | |||||||
| 51 | } executed 5389 times by 3 tests: end of blockExecuted by:
| 5389 | ||||||
| 52 | else | - | ||||||
| 53 | { | - | ||||||
| 54 | - | |||||||
| 55 | { u=r^s[30 ]; t=r^s[30 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 56 | { u=l^s[28 ]; t=l^s[28 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 57 | { u=r^s[26 ]; t=r^s[26 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 58 | { u=l^s[24 ]; t=l^s[24 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 59 | { u=r^s[22 ]; t=r^s[22 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 60 | { u=l^s[20 ]; t=l^s[20 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 61 | { u=r^s[18 ]; t=r^s[18 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 62 | { u=l^s[16 ]; t=l^s[16 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 63 | { u=r^s[14 ]; t=r^s[14 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 64 | { u=l^s[12 ]; t=l^s[12 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 65 | { u=r^s[10 ]; t=r^s[10 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 66 | { u=l^s[8 ]; t=l^s[8 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 67 | { u=r^s[6 ]; t=r^s[6 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 68 | { u=l^s[4 ]; t=l^s[4 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 69 | { u=r^s[2 ]; t=r^s[2 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 70 | { u=l^s[0 ]; t=l^s[0 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 71 | - | |||||||
| 72 | - | |||||||
| 73 | - | |||||||
| 74 | - | |||||||
| 75 | - | |||||||
| 76 | - | |||||||
| 77 | - | |||||||
| 78 | } executed 741 times by 3 tests: end of blockExecuted by:
| 741 | ||||||
| 79 | - | |||||||
| 80 | - | |||||||
| 81 | l=ROTATE(l,3)&0xffffffffL; | - | ||||||
| 82 | r=ROTATE(r,3)&0xffffffffL; | - | ||||||
| 83 | - | |||||||
| 84 | { unsigned int tt; ((tt)=((((r)>>(1))^(l))&(0x55555555L)), (l)^=(tt), (r)^=((tt)<<(1))); ((tt)=((((l)>>(8))^(r))&(0x00ff00ffL)), (r)^=(tt), (l)^=((tt)<<(8))); ((tt)=((((r)>>(2))^(l))&(0x33333333L)), (l)^=(tt), (r)^=((tt)<<(2))); ((tt)=((((l)>>(16))^(r))&(0x0000ffffL)), (r)^=(tt), (l)^=((tt)<<(16))); ((tt)=((((r)>>(4))^(l))&(0x0f0f0f0fL)), (l)^=(tt), (r)^=((tt)<<(4))); }; | - | ||||||
| 85 | data[0]=l; | - | ||||||
| 86 | data[1]=r; | - | ||||||
| 87 | l=r=t=u=0; | - | ||||||
| 88 | } executed 6130 times by 3 tests: end of blockExecuted by:
| 6130 | ||||||
| 89 | - | |||||||
| 90 | void DES_encrypt2(unsigned int *data, DES_key_schedule *ks, int enc) | - | ||||||
| 91 | { | - | ||||||
| 92 | unsigned int l,r,t,u; | - | ||||||
| 93 | - | |||||||
| 94 | - | |||||||
| 95 | - | |||||||
| 96 | - | |||||||
| 97 | - | |||||||
| 98 | - | |||||||
| 99 | unsigned int *s; | - | ||||||
| 100 | - | |||||||
| 101 | r=data[0]; | - | ||||||
| 102 | l=data[1]; | - | ||||||
| 103 | r=ROTATE(r,29)&0xffffffffL; | - | ||||||
| 104 | l=ROTATE(l,29)&0xffffffffL; | - | ||||||
| 105 | - | |||||||
| 106 | s=ks->ks->deslong; | - | ||||||
| 107 | - | |||||||
| 108 | - | |||||||
| 109 | if (enc
| 4862-6658 | ||||||
| 110 | { | - | ||||||
| 111 | - | |||||||
| 112 | { u=r^s[0 ]; t=r^s[0 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 113 | { u=l^s[2 ]; t=l^s[2 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 114 | { u=r^s[4 ]; t=r^s[4 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 115 | { u=l^s[6 ]; t=l^s[6 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 116 | { u=r^s[8 ]; t=r^s[8 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 117 | { u=l^s[10 ]; t=l^s[10 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 118 | { u=r^s[12 ]; t=r^s[12 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 119 | { u=l^s[14 ]; t=l^s[14 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 120 | { u=r^s[16 ]; t=r^s[16 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 121 | { u=l^s[18 ]; t=l^s[18 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 122 | { u=r^s[20 ]; t=r^s[20 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 123 | { u=l^s[22 ]; t=l^s[22 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 124 | { u=r^s[24 ]; t=r^s[24 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 125 | { u=l^s[26 ]; t=l^s[26 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 126 | { u=r^s[28 ]; t=r^s[28 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 127 | { u=l^s[30 ]; t=l^s[30 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 128 | - | |||||||
| 129 | - | |||||||
| 130 | - | |||||||
| 131 | - | |||||||
| 132 | - | |||||||
| 133 | - | |||||||
| 134 | - | |||||||
| 135 | } executed 6658 times by 4 tests: end of blockExecuted by:
| 6658 | ||||||
| 136 | else | - | ||||||
| 137 | { | - | ||||||
| 138 | - | |||||||
| 139 | { u=r^s[30 ]; t=r^s[30 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 140 | { u=l^s[28 ]; t=l^s[28 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 141 | { u=r^s[26 ]; t=r^s[26 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 142 | { u=l^s[24 ]; t=l^s[24 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 143 | { u=r^s[22 ]; t=r^s[22 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 144 | { u=l^s[20 ]; t=l^s[20 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 145 | { u=r^s[18 ]; t=r^s[18 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 146 | { u=l^s[16 ]; t=l^s[16 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 147 | { u=r^s[14 ]; t=r^s[14 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 148 | { u=l^s[12 ]; t=l^s[12 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 149 | { u=r^s[10 ]; t=r^s[10 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 150 | { u=l^s[8 ]; t=l^s[8 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 151 | { u=r^s[6 ]; t=r^s[6 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 152 | { u=l^s[4 ]; t=l^s[4 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 153 | { u=r^s[2 ]; t=r^s[2 +1]; t=ROTATE(t,4); l^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 154 | { u=l^s[0 ]; t=l^s[0 +1]; t=ROTATE(t,4); r^= DES_SPtrans[0][(u>> 2L)&0x3f]^ DES_SPtrans[2][(u>>10L)&0x3f]^ DES_SPtrans[4][(u>>18L)&0x3f]^ DES_SPtrans[6][(u>>26L)&0x3f]^ DES_SPtrans[1][(t>> 2L)&0x3f]^ DES_SPtrans[3][(t>>10L)&0x3f]^ DES_SPtrans[5][(t>>18L)&0x3f]^ DES_SPtrans[7][(t>>26L)&0x3f]; }; | - | ||||||
| 155 | - | |||||||
| 156 | - | |||||||
| 157 | - | |||||||
| 158 | - | |||||||
| 159 | - | |||||||
| 160 | - | |||||||
| 161 | - | |||||||
| 162 | } executed 4862 times by 4 tests: end of blockExecuted by:
| 4862 | ||||||
| 163 | - | |||||||
| 164 | data[0]=ROTATE(l,3)&0xffffffffL; | - | ||||||
| 165 | data[1]=ROTATE(r,3)&0xffffffffL; | - | ||||||
| 166 | l=r=t=u=0; | - | ||||||
| 167 | } executed 11520 times by 4 tests: end of blockExecuted by:
| 11520 | ||||||
| 168 | - | |||||||
| 169 | - | |||||||
| 170 | - | |||||||
| 171 | void DES_encrypt3(unsigned int *data, DES_key_schedule *ks1, | - | ||||||
| 172 | DES_key_schedule *ks2, DES_key_schedule *ks3) | - | ||||||
| 173 | { | - | ||||||
| 174 | unsigned int l,r; | - | ||||||
| 175 | - | |||||||
| 176 | l=data[0]; | - | ||||||
| 177 | r=data[1]; | - | ||||||
| 178 | { unsigned int tt; ((tt)=((((r)>>(4))^(l))&(0x0f0f0f0fL)), (l)^=(tt), (r)^=((tt)<<(4))); ((tt)=((((l)>>(16))^(r))&(0x0000ffffL)), (r)^=(tt), (l)^=((tt)<<(16))); ((tt)=((((r)>>(2))^(l))&(0x33333333L)), (l)^=(tt), (r)^=((tt)<<(2))); ((tt)=((((l)>>(8))^(r))&(0x00ff00ffL)), (r)^=(tt), (l)^=((tt)<<(8))); ((tt)=((((r)>>(1))^(l))&(0x55555555L)), (l)^=(tt), (r)^=((tt)<<(1))); }; | - | ||||||
| 179 | data[0]=l; | - | ||||||
| 180 | data[1]=r; | - | ||||||
| 181 | DES_encrypt2((unsigned int *)data,ks1,1); | - | ||||||
| 182 | DES_encrypt2((unsigned int *)data,ks2,0); | - | ||||||
| 183 | DES_encrypt2((unsigned int *)data,ks3,1); | - | ||||||
| 184 | l=data[0]; | - | ||||||
| 185 | r=data[1]; | - | ||||||
| 186 | { unsigned int tt; ((tt)=((((r)>>(1))^(l))&(0x55555555L)), (l)^=(tt), (r)^=((tt)<<(1))); ((tt)=((((l)>>(8))^(r))&(0x00ff00ffL)), (r)^=(tt), (l)^=((tt)<<(8))); ((tt)=((((r)>>(2))^(l))&(0x33333333L)), (l)^=(tt), (r)^=((tt)<<(2))); ((tt)=((((l)>>(16))^(r))&(0x0000ffffL)), (r)^=(tt), (l)^=((tt)<<(16))); ((tt)=((((r)>>(4))^(l))&(0x0f0f0f0fL)), (l)^=(tt), (r)^=((tt)<<(4))); }; | - | ||||||
| 187 | data[0]=l; | - | ||||||
| 188 | data[1]=r; | - | ||||||
| 189 | } executed 2818 times by 4 tests: end of blockExecuted by:
| 2818 | ||||||
| 190 | - | |||||||
| 191 | void DES_decrypt3(unsigned int *data, DES_key_schedule *ks1, | - | ||||||
| 192 | DES_key_schedule *ks2, DES_key_schedule *ks3) | - | ||||||
| 193 | { | - | ||||||
| 194 | unsigned int l,r; | - | ||||||
| 195 | - | |||||||
| 196 | l=data[0]; | - | ||||||
| 197 | r=data[1]; | - | ||||||
| 198 | { unsigned int tt; ((tt)=((((r)>>(4))^(l))&(0x0f0f0f0fL)), (l)^=(tt), (r)^=((tt)<<(4))); ((tt)=((((l)>>(16))^(r))&(0x0000ffffL)), (r)^=(tt), (l)^=((tt)<<(16))); ((tt)=((((r)>>(2))^(l))&(0x33333333L)), (l)^=(tt), (r)^=((tt)<<(2))); ((tt)=((((l)>>(8))^(r))&(0x00ff00ffL)), (r)^=(tt), (l)^=((tt)<<(8))); ((tt)=((((r)>>(1))^(l))&(0x55555555L)), (l)^=(tt), (r)^=((tt)<<(1))); }; | - | ||||||
| 199 | data[0]=l; | - | ||||||
| 200 | data[1]=r; | - | ||||||
| 201 | DES_encrypt2((unsigned int *)data,ks3,0); | - | ||||||
| 202 | DES_encrypt2((unsigned int *)data,ks2,1); | - | ||||||
| 203 | DES_encrypt2((unsigned int *)data,ks1,0); | - | ||||||
| 204 | l=data[0]; | - | ||||||
| 205 | r=data[1]; | - | ||||||
| 206 | { unsigned int tt; ((tt)=((((r)>>(1))^(l))&(0x55555555L)), (l)^=(tt), (r)^=((tt)<<(1))); ((tt)=((((l)>>(8))^(r))&(0x00ff00ffL)), (r)^=(tt), (l)^=((tt)<<(8))); ((tt)=((((r)>>(2))^(l))&(0x33333333L)), (l)^=(tt), (r)^=((tt)<<(2))); ((tt)=((((l)>>(16))^(r))&(0x0000ffffL)), (r)^=(tt), (l)^=((tt)<<(16))); ((tt)=((((r)>>(4))^(l))&(0x0f0f0f0fL)), (l)^=(tt), (r)^=((tt)<<(4))); }; | - | ||||||
| 207 | data[0]=l; | - | ||||||
| 208 | data[1]=r; | - | ||||||
| 209 | } executed 1022 times by 4 tests: end of blockExecuted by:
| 1022 | ||||||
| 210 | - | |||||||
| 211 | - | |||||||
| 212 | - | |||||||
| 213 | - | |||||||
| 214 | - | |||||||
| 215 | void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, | - | ||||||
| 216 | long length, DES_key_schedule *ks1, | - | ||||||
| 217 | DES_key_schedule *ks2, DES_key_schedule *ks3, | - | ||||||
| 218 | DES_cblock *ivec, int enc) | - | ||||||
| 219 | { | - | ||||||
| 220 | unsigned int tin0,tin1; | - | ||||||
| 221 | unsigned int tout0,tout1,xor0,xor1; | - | ||||||
| 222 | const unsigned char *in; | - | ||||||
| 223 | unsigned char *out; | - | ||||||
| 224 | long l=length; | - | ||||||
| 225 | unsigned int tin[2]; | - | ||||||
| 226 | unsigned char *iv; | - | ||||||
| 227 | - | |||||||
| 228 | in=input; | - | ||||||
| 229 | out=output; | - | ||||||
| 230 | iv = &(*ivec)[0]; | - | ||||||
| 231 | - | |||||||
| 232 | if (enc
| 10-17 | ||||||
| 233 | { | - | ||||||
| 234 | (tout0 =((unsigned int)(*((iv)++))) , tout0|=((unsigned int)(*((iv)++)))<< 8L, tout0|=((unsigned int)(*((iv)++)))<<16L, tout0|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
| 235 | (tout1 =((unsigned int)(*((iv)++))) , tout1|=((unsigned int)(*((iv)++)))<< 8L, tout1|=((unsigned int)(*((iv)++)))<<16L, tout1|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
| 236 | for (l-=8; l>=0
| 17-549 | ||||||
| 237 | { | - | ||||||
| 238 | (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
| 239 | (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
| 240 | tin0^=tout0; | - | ||||||
| 241 | tin1^=tout1; | - | ||||||
| 242 | - | |||||||
| 243 | tin[0]=tin0; | - | ||||||
| 244 | tin[1]=tin1; | - | ||||||
| 245 | DES_encrypt3((unsigned int *)tin,ks1,ks2,ks3); | - | ||||||
| 246 | tout0=tin[0]; | - | ||||||
| 247 | tout1=tin[1]; | - | ||||||
| 248 | - | |||||||
| 249 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
| 250 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
| 251 | } executed 549 times by 4 tests: end of blockExecuted by:
| 549 | ||||||
| 252 | if (l != -8
| 1-16 | ||||||
| 253 | { | - | ||||||
| 254 | { 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 | ||||||
| 255 | tin0^=tout0; | - | ||||||
| 256 | tin1^=tout1; | - | ||||||
| 257 | - | |||||||
| 258 | tin[0]=tin0; | - | ||||||
| 259 | tin[1]=tin1; | - | ||||||
| 260 | DES_encrypt3((unsigned int *)tin,ks1,ks2,ks3); | - | ||||||
| 261 | tout0=tin[0]; | - | ||||||
| 262 | tout1=tin[1]; | - | ||||||
| 263 | - | |||||||
| 264 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
| 265 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
| 266 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||
| 267 | iv = &(*ivec)[0]; | - | ||||||
| 268 | (*((iv)++)=(unsigned char)(((tout0) )&0xff), *((iv)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
| 269 | (*((iv)++)=(unsigned char)(((tout1) )&0xff), *((iv)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>16L)&0xff), *((iv)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
| 270 | } executed 17 times by 4 tests: end of blockExecuted by:
| 17 | ||||||
| 271 | else | - | ||||||
| 272 | { | - | ||||||
| 273 | unsigned int t0,t1; | - | ||||||
| 274 | - | |||||||
| 275 | (xor0 =((unsigned int)(*((iv)++))) , xor0|=((unsigned int)(*((iv)++)))<< 8L, xor0|=((unsigned int)(*((iv)++)))<<16L, xor0|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
| 276 | (xor1 =((unsigned int)(*((iv)++))) , xor1|=((unsigned int)(*((iv)++)))<< 8L, xor1|=((unsigned int)(*((iv)++)))<<16L, xor1|=((unsigned int)(*((iv)++)))<<24L); | - | ||||||
| 277 | for (l-=8; l>=0
| 10-541 | ||||||
| 278 | { | - | ||||||
| 279 | (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
| 280 | (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
| 281 | - | |||||||
| 282 | t0=tin0; | - | ||||||
| 283 | t1=tin1; | - | ||||||
| 284 | - | |||||||
| 285 | tin[0]=tin0; | - | ||||||
| 286 | tin[1]=tin1; | - | ||||||
| 287 | DES_decrypt3((unsigned int *)tin,ks1,ks2,ks3); | - | ||||||
| 288 | tout0=tin[0]; | - | ||||||
| 289 | tout1=tin[1]; | - | ||||||
| 290 | - | |||||||
| 291 | tout0^=xor0; | - | ||||||
| 292 | tout1^=xor1; | - | ||||||
| 293 | (*((out)++)=(unsigned char)(((tout0) )&0xff), *((out)++)=(unsigned char)(((tout0)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout0)>>16L)&0xff), *((out)++)=(unsigned char)(((tout0)>>24L)&0xff)); | - | ||||||
| 294 | (*((out)++)=(unsigned char)(((tout1) )&0xff), *((out)++)=(unsigned char)(((tout1)>> 8L)&0xff), *((out)++)=(unsigned char)(((tout1)>>16L)&0xff), *((out)++)=(unsigned char)(((tout1)>>24L)&0xff)); | - | ||||||
| 295 | xor0=t0; | - | ||||||
| 296 | xor1=t1; | - | ||||||
| 297 | } executed 541 times by 4 tests: end of blockExecuted by:
| 541 | ||||||
| 298 | if (l != -8
| 1-9 | ||||||
| 299 | { | - | ||||||
| 300 | (tin0 =((unsigned int)(*((in)++))) , tin0|=((unsigned int)(*((in)++)))<< 8L, tin0|=((unsigned int)(*((in)++)))<<16L, tin0|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
| 301 | (tin1 =((unsigned int)(*((in)++))) , tin1|=((unsigned int)(*((in)++)))<< 8L, tin1|=((unsigned int)(*((in)++)))<<16L, tin1|=((unsigned int)(*((in)++)))<<24L); | - | ||||||
| 302 | - | |||||||
| 303 | t0=tin0; | - | ||||||
| 304 | t1=tin1; | - | ||||||
| 305 | - | |||||||
| 306 | tin[0]=tin0; | - | ||||||
| 307 | tin[1]=tin1; | - | ||||||
| 308 | DES_decrypt3((unsigned int *)tin,ks1,ks2,ks3); | - | ||||||
| 309 | tout0=tin[0]; | - | ||||||
| 310 | tout1=tin[1]; | - | ||||||
| 311 | - | |||||||
| 312 | tout0^=xor0; | - | ||||||
| 313 | tout1^=xor1; | - | ||||||
| 314 | { 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 | ||||||
| 315 | xor0=t0; | - | ||||||
| 316 | xor1=t1; | - | ||||||
| 317 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||
| 318 | - | |||||||
| 319 | iv = &(*ivec)[0]; | - | ||||||
| 320 | (*((iv)++)=(unsigned char)(((xor0) )&0xff), *((iv)++)=(unsigned char)(((xor0)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor0)>>24L)&0xff)); | - | ||||||
| 321 | (*((iv)++)=(unsigned char)(((xor1) )&0xff), *((iv)++)=(unsigned char)(((xor1)>> 8L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>16L)&0xff), *((iv)++)=(unsigned char)(((xor1)>>24L)&0xff)); | - | ||||||
| 322 | } executed 10 times by 4 tests: end of blockExecuted by:
| 10 | ||||||
| 323 | tin0=tin1=tout0=tout1=xor0=xor1=0; | - | ||||||
| 324 | tin[0]=tin[1]=0; | - | ||||||
| 325 | } executed 27 times by 4 tests: end of blockExecuted by:
| 27 | ||||||
| Switch to Source code | Preprocessed file |