Function at 0x100046e0
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x50
push ebx
push ebp
push esi
push edi
xor ebp, ebp
push 0x10017518
mov dword [esp + 0x1c], ebp
mov dword [esp + 0x18], ebp
call fcn.100040a0
xor eax, eax
xor ecx, ecx
mov dword [esp + 0x20], eax
mov dword [esp + 0x30], ecx
mov dword [esp + 0x24], eax
mov dword [esp + 0x34], ecx
lea edx, [esp + 0x20]
mov dword [esp + 0x28], eax
mov dword [esp + 0x38], ecx
push 0x10
push edx
mov dword [esp + 0x34], eax
mov dword [esp + 0x44], ecx
call fcn.10004050
mov esi, eax
add esp, 0xc
cmp esi, ebp
je 0x1000474b
push str.GetRandBuf_fail_n
call fcn.100040a0
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
mov ebx, dword [esp + 0x64]
xor eax, eax
mov dword [esp + 0x4c], eax
push ebp
mov ecx, dword [ebx + 0x88]
mov edx, dword [ebx + 0x84]
mov dword [esp + 0x54], eax
push 1
mov dword [esp + 0x5c], eax
push 1
mov dword [esp + 0x64], eax
push ecx
mov dword [esp + 0x6c], eax
lea eax, [esp + 0x20]
push edx
lea ecx, [esp + 0x64]
push eax
mov al, byte [ebx + 0x32]
push ecx
lea edx, [esp + 0x38]
push 0x10
push edx
push eax
call fcn.10003bb0
mov esi, eax
add esp, 0x28
cmp esi, ebp
je 0x100047b2
push str.Crypto_RandSyn_fail_n
call fcn.100040a0
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
mov cl, byte [ebx + 0x30]
mov dl, byte [ebx + 0x31]
mov al, byte [ebx + 0x32]
mov byte [esp + 0x4c], cl
lea ecx, [esp + 0x4c]
push 0x14
push ecx
push ebx
mov byte [esp + 0x59], dl
mov byte [esp + 0x5a], al
call fcn.100043c0
mov esi, eax
add esp, 0xc
cmp esi, ebp
je 0x100047f5
push esi
push str.TSPSend_PRESHARE_AUTH_HEAD_SYN_fail_ret:_d_n
call fcn.100040a0
add esp, 8
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
lea edx, [esp + 0x14]
lea eax, [esp + 0x18]
push edx
push eax
push ebx
call fcn.100040e0
mov esi, eax
add esp, 0xc
cmp esi, ebp
jne 0x100049a1
cmp dword [esp + 0x14], 0x20
jne 0x100049a1
mov eax, dword [esp + 0x18]
cmp eax, ebp
je 0x100049a1
mov ecx, dword [ebx + 0x88]
mov edx, dword [ebx + 0x84]
push ebp
push 1
push ebp
push ecx
push edx
lea ecx, [esp + 0x24]
lea edx, [esp + 0x40]
push ecx
push edx
push 0x10
mov edi, eax
push eax
mov al, byte [ebx + 0x32]
push eax
call fcn.10003bb0
mov esi, eax
add esp, 0x28
cmp esi, ebp
je 0x10004873
push str.Crypto_RandAck_fail_n
call fcn.100040a0
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
xor eax, eax
mov ecx, dword [ebx + 0x84]
mov dl, byte [esp + eax + 0x1c]
lea esi, [ecx + eax]
mov cl, byte [ecx + eax]
xor cl, dl
mov byte [esi], cl
mov ecx, dword [ebx + 0x84]
mov dl, byte [esp + eax + 0x2c]
lea esi, [ecx + eax + 0x10]
mov cl, byte [ecx + eax + 0x10]
xor cl, dl
inc eax
cmp eax, 0x10
mov byte [esi], cl
jl 0x10004875
mov eax, dword [ebx + 0x88]
mov ecx, dword [ebx + 0x84]
push ebp
push 1
push ebp
push eax
mov al, byte [ebx + 0x32]
lea edx, [esp + 0x20]
lea esi, [edi + 0x10]
push ecx
push edx
push esi
push 0x10
push esi
push eax
call fcn.10003bb0
mov edi, eax
add esp, 0x28
cmp edi, ebp
je 0x100048ec
push str.Crypto_RandVerifyAck_fail_n
call fcn.100040a0
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
mov ecx, 0x10
lea edi, [esp + 0x1c]
xor ebp, ebp
repe cmpsb byte [esi], byte es:[edi]
je 0x10004900
sbb ebp, ebp
sbb ebp, 0xffffffff
test ebp, ebp
je 0x1000491b
push str.memcmp_RandVerifyAck_fail_n
call fcn.100040a0
add esp, 4
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
mov ecx, dword [ebx + 0x88]
mov edx, dword [ebx + 0x84]
push 0
push 1
push 1
push ecx
lea eax, [esp + 0x20]
push edx
lea ecx, [esp + 0x50]
push eax
mov al, byte [ebx + 0x32]
push ecx
lea edx, [esp + 0x48]
push 0x10
push edx
push eax
call fcn.10003bb0
mov esi, eax
add esp, 0x28
test esi, esi
je 0x10004969
push str.Crypto_RandVerifyFin_fail_n
call fcn.100040a0
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
lea ecx, [esp + 0x3c]
push 0x10
push ecx
push ebx
call fcn.100043c0
mov esi, eax
add esp, 0xc
test esi, esi
je 0x10004997
push esi
push str.TSPSend_PRESHARE_AUTH_HEAD_FIN_fail_ret:_d_n
call fcn.100040a0
add esp, 8
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x50
ret
push esi
push str.TSPRecv_PRESHARE_AUTH_HEAD_ACK_fail_ret:_d_n
call fcn.100040a0
add esp, 8
cmp esi, ebp
mov eax, 0xfffffae6
je 0x100049ba
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret