1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
__int64 __fastcall w2c_check(unsigned int flag, unsigned int key, unsigned int enc)
{
int v3; // eax
unsigned int check_sp; // [rsp+24h] [rbp-47Ch]
unsigned int v7; // [rsp+40h] [rbp-460h]
unsigned int v8; // [rsp+44h] [rbp-45Ch]
unsigned int v9; // [rsp+48h] [rbp-458h]
unsigned int v10; // [rsp+4Ch] [rbp-454h]
unsigned int v11; // [rsp+50h] [rbp-450h]
unsigned int v12; // [rsp+54h] [rbp-44Ch]
signed int v13; // [rsp+90h] [rbp-410h]
int v14; // [rsp+B4h] [rbp-3ECh]
unsigned int flag_cpy_len; // [rsp+DCh] [rbp-3C4h]
unsigned int v16; // [rsp+E0h] [rbp-3C0h]
unsigned int flag_cpy_addr; // [rsp+E4h] [rbp-3BCh]
unsigned int v18; // [rsp+E8h] [rbp-3B8h]
unsigned int v19; // [rsp+ECh] [rbp-3B4h]
unsigned int v20; // [rsp+F4h] [rbp-3ACh]
unsigned int v21; // [rsp+F8h] [rbp-3A8h]
int key_addr; // [rsp+120h] [rbp-380h]
unsigned int v23; // [rsp+128h] [rbp-378h]
unsigned int v24; // [rsp+12Ch] [rbp-374h]
unsigned int v25; // [rsp+140h] [rbp-360h]
int i; // [rsp+160h] [rbp-340h]
int v27; // [rsp+194h] [rbp-30Ch]
int v28; // [rsp+198h] [rbp-308h]
int v29; // [rsp+1A0h] [rbp-300h]
unsigned int v30; // [rsp+1A8h] [rbp-2F8h]
int v31; // [rsp+1B4h] [rbp-2ECh]
int v32; // [rsp+300h] [rbp-1A0h]
int v33; // [rsp+30Ch] [rbp-194h]
int v34; // [rsp+324h] [rbp-17Ch]
char v35; // [rsp+32Ch] [rbp-174h]
unsigned int v36; // [rsp+34Ch] [rbp-154h]
char v37; // [rsp+374h] [rbp-12Ch]
unsigned int v38; // [rsp+39Ch] [rbp-104h]
int v39; // [rsp+3A0h] [rbp-100h]
int v40; // [rsp+3ACh] [rbp-F4h]
int v41; // [rsp+3BCh] [rbp-E4h]
char v42; // [rsp+3CCh] [rbp-D4h]
unsigned int v43; // [rsp+3ECh] [rbp-B4h]
char v44; // [rsp+414h] [rbp-8Ch]
unsigned int v45; // [rsp+43Ch] [rbp-64h]
unsigned int v46; // [rsp+458h] [rbp-48h]
unsigned int v47; // [rsp+460h] [rbp-40h]
int v48; // [rsp+46Ch] [rbp-34h]
unsigned int v49; // [rsp+470h] [rbp-30h]
unsigned int v50; // [rsp+470h] [rbp-30h]
unsigned int v51; // [rsp+470h] [rbp-30h]
unsigned int v52; // [rsp+470h] [rbp-30h]
unsigned int v53; // [rsp+470h] [rbp-30h]
unsigned int v54; // [rsp+470h] [rbp-30h]
unsigned int v55; // [rsp+474h] [rbp-2Ch]
__int64 v56; // [rsp+480h] [rbp-20h]
__int64 v57; // [rsp+498h] [rbp-8h]
w2c___stack_pointer -= 112; // new vm stack frame
check_sp = w2c___stack_pointer;
i32_store(&w2c_memory, (unsigned int)w2c___stack_pointer + 104LL, flag);// push flag
i32_store(&w2c_memory, check_sp + 100LL, key);// push key
i32_store(&w2c_memory, check_sp + 96LL, enc); // push enc
v56 = i64_load(&w2c_memory, 1032LL);
i64_store(&w2c_memory, check_sp + 88, v56); // table
v57 = i64_load(&w2c_memory, 1024LL);
i64_store(&w2c_memory, check_sp + 80, v57); // another table
v7 = i32_load(&w2c_memory, check_sp + 104LL); // push len(flag)
v8 = w2c_strlen(v7);
i32_store(&w2c_memory, check_sp + 76LL, v8);
v9 = i32_load(&w2c_memory, check_sp + 100LL); // push len(key)
v10 = w2c_strlen(v9);
i32_store(&w2c_memory, check_sp + 72LL, v10);
v11 = i32_load(&w2c_memory, check_sp + 96LL); // push len(enc)
v12 = w2c_strlen(v11);
i32_store(&w2c_memory, check_sp + 68LL, v12);
if ( (int)i32_load(&w2c_memory, check_sp + 72LL) >= 8// len(key) >= 8
&& (v13 = 4 * i32_load(&w2c_memory, check_sp + 76LL), v13 > (int)(i32_load(&w2c_memory, check_sp + 68LL) - 32))// 4 * len(flag) > len(enc) - 32
&& (v14 = 4 * i32_load(&w2c_memory, check_sp + 76LL), v14 <= (int)i32_load(&w2c_memory, check_sp + 68LL)) )// 4 * len(flag) <= len(enc)
{
flag_cpy_len = (i32_load(&w2c_memory, check_sp + 76LL) + 15) & 0xFFFFFFF0;// flag_cpy_len = (flag_len + 15) & ~15
i32_store(&w2c_memory, check_sp + 64LL, flag_cpy_len);
v16 = i32_load(&w2c_memory, check_sp + 64LL);
flag_cpy_addr = w2c_dlmalloc(v16); // malloc(flag_cpy_len)
i32_store(&w2c_memory, check_sp + 60LL, flag_cpy_addr);
v18 = i32_load(&w2c_memory, check_sp + 60LL);
v19 = i32_load(&w2c_memory, check_sp + 64LL);
w2c_memset(v18, 0LL, v19); // memset(flag_cpy_addr, 0, flag_cpy_len)
v20 = i32_load(&w2c_memory, check_sp + 60LL);
v21 = i32_load(&w2c_memory, check_sp + 104LL);
v55 = i32_load(&w2c_memory, check_sp + 76LL);
w2c___memcpy(v20, v21, v55); // memcpy(flag_cpy_addr, flag, flag_len)
i32_store(&w2c_memory, check_sp + 28LL, 0LL);// i = 0
while ( (int)i32_load(&w2c_memory, check_sp + 28LL) < 8 )// while(i < 8)
{
key_addr = i32_load(&w2c_memory, check_sp + 100LL);
v23 = i32_load(&w2c_memory, check_sp + 28LL) + key_addr;// key[i]
v24 = i32_load8_u(&w2c_memory, v23);
v25 = i32_load(&w2c_memory, check_sp + 28LL) + check_sp + 32;// new s
i32_store8(&w2c_memory, v25, v24); // s[i] = key[i]
v49 = i32_load(&w2c_memory, check_sp + 28LL) + 1;// i++
i32_store(&w2c_memory, check_sp + 28LL, v49);
}
i32_store(&w2c_memory, check_sp + 24LL, 0LL);// is_correct
i32_store(&w2c_memory, check_sp + 20LL, 0LL);// i = 0
while ( 1 )
{
i = i32_load(&w2c_memory, check_sp + 20LL);
if ( i >= (int)i32_load(&w2c_memory, check_sp + 76LL) )// if(i >= flag_len)
break;
i32_store(&w2c_memory, check_sp + 16LL, 0LL);// j = 0
while ( (int)i32_load(&w2c_memory, check_sp + 16LL) < 8 )// while(j < 8)
{
v27 = i32_load(&w2c_memory, check_sp + 60LL);// flag_cpy_addr
v28 = i32_load(&w2c_memory, check_sp + 20LL);// i
v29 = i32_load(&w2c_memory, check_sp + 16LL) + v28;// j + i
v30 = i32_load8_u(&w2c_memory, (unsigned int)(v29 + v27));// flag_cpy[i+j]
v31 = i32_load(&w2c_memory, check_sp + 16LL) + 8;// j + 8
i32_store8(&w2c_memory, v31 + check_sp + 32, v30);// s[j+8] = flag_cpy[i+j]
v50 = i32_load(&w2c_memory, check_sp + 16LL) + 1;// j++
i32_store(&w2c_memory, check_sp + 16LL, v50);
}
i32_store(&w2c_memory, check_sp + 12LL, 0LL);// j = 0
while ( (int)i32_load(&w2c_memory, check_sp + 12LL) < 42 )// while(j < 42)
{
w2c_qua_rou(check_sp + 32, 12LL, 8LL, 4LL, 0LL);
w2c_qua_rou(check_sp + 32, 13LL, 9LL, 5LL, 1LL);
w2c_qua_rou(check_sp + 32, 14LL, 10LL, 6LL, 2LL);
w2c_qua_rou(check_sp + 32, 15LL, 11LL, 7LL, 3LL);
w2c_qua_rou(check_sp + 32, 15LL, 10LL, 5LL, 0LL);
w2c_qua_rou(check_sp + 32, 12LL, 11LL, 6LL, 1LL);
w2c_qua_rou(check_sp + 32, 13LL, 8LL, 7LL, 2LL);
w2c_qua_rou(check_sp + 32, 14LL, 9LL, 4LL, 3LL);
v51 = i32_load(&w2c_memory, check_sp + 12LL) + 1;// j++
i32_store(&w2c_memory, check_sp + 12LL, v51);
}
i32_store(&w2c_memory, check_sp + 8LL, 0LL);// j = 0
while ( (int)i32_load(&w2c_memory, check_sp + 8LL) < 16 )// while(j < 16)
{
v32 = i32_load(&w2c_memory, check_sp + 96LL);// enc
v33 = 4 * i32_load(&w2c_memory, check_sp + 20LL);// 4 * i
v34 = 2 * i32_load(&w2c_memory, check_sp + 8LL) + v33;// 2*j + 4*i
v35 = i32_load8_u(&w2c_memory, (unsigned int)(v34 + v32));// enc[2*j + 4*i]
v36 = i32_load(&w2c_memory, check_sp + 8LL) + check_sp + 32;// s[j]
v48 = (unsigned __int8)i32_load8_u(&w2c_memory, v36);
v37 = i32_load8_u(&w2c_memory, v48 / 16 + check_sp + 80);// table[s[j] / 16]
v38 = (v35 != v37) | (unsigned int)i32_load(&w2c_memory, check_sp + 24LL);// is_correct |= (enc[2*j + 4*i] != table[s[j] / 16])
i32_store(&w2c_memory, check_sp + 24LL, v38);
v39 = i32_load(&w2c_memory, check_sp + 96LL);
v40 = 4 * i32_load(&w2c_memory, check_sp + 20LL);
v41 = 2 * i32_load(&w2c_memory, check_sp + 8LL) + v40;
v42 = i32_load8_u(&w2c_memory, (unsigned int)(v41 + 1 + v39));
v43 = i32_load(&w2c_memory, check_sp + 8LL) + check_sp + 32;
v3 = (unsigned __int8)i32_load8_u(&w2c_memory, v43) % 16;
v44 = i32_load8_u(&w2c_memory, v3 + check_sp + 80);
v45 = (v42 != v44) | (unsigned int)i32_load(&w2c_memory, check_sp + 24LL);// is_correct |= (enc[2*j + 4*i + 1] != table[s[j] % 16])
i32_store(&w2c_memory, check_sp + 24LL, v45);
v52 = i32_load(&w2c_memory, check_sp + 8LL) + 1;// j++
i32_store(&w2c_memory, check_sp + 8LL, v52);
}
v53 = i32_load(&w2c_memory, check_sp + 20LL) + 8;// i += 8
i32_store(&w2c_memory, check_sp + 20LL, v53);
}
v46 = i32_load(&w2c_memory, check_sp + 60LL);// free(flag_cpy_addr)
w2c_dlfree(v46);
v54 = i32_load(&w2c_memory, check_sp + 24LL);// is_correct
i32_store(&w2c_memory, check_sp + 108LL, v54);
}
else
{
i32_store(&w2c_memory, check_sp + 108LL, 0xFFFFFFFFLL);
}
v47 = i32_load(&w2c_memory, check_sp + 108LL);
w2c___stack_pointer = check_sp + 112; // destory vm stack frame
return v47;
}
|