Function at 0x402340
Capabilities:
Encrypt or decrypt data via bcrypt

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x42472e
mov eax, dword fs:[0]
push eax
sub esp, 0x1c
mov eax, dword [0x433010]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, dword [ebp + 8]
xorps xmm0, xmm0
mov eax, dword [ebp + 0xc]
mov esi, dword [ebp + 0x14]
mov dword [ebp - 0x28], edi
mov dword [ebp - 0x24], 1
movq qword [edi], xmm0
mov dword [edi + 8], 0
mov dword [ebp - 0x20], eax
mov dword [edi], 0
mov dword [edi + 4], 0
mov dword [edi + 8], 0
push 0
push 0
push 0x430428
lea eax, [ebp - 0x1c]
mov dword [ebp - 4], 0
push eax
mov dword [ebp - 0x24], 1
mov dword [ebp - 0x14], 0
call dword [sym.imp.bcrypt.dll_BCryptOpenAlgorithmProvider]
mov ebx, eax
test ebx, ebx
jns 0x402411
mov edx, str.BCryptOpenAlgorithmProvider_failed_with_error_code:
mov ecx, 0x4340d8
call fcn.004049c0
mov esi, eax
push ebx
mov eax, dword [esi]
mov edx, dword [eax + 4]
mov ecx, dword [edx + esi + 0x14]
and ecx, 0xfffff9ff
or ecx, 0x800
mov dword [edx + esi + 0x14], ecx
mov ecx, esi
call fcn.00402ba0
push eax
call fcn.00404c60
add esp, 4
jmp 0x402550
cmp dword [esi + 0x14], 0x10
mov eax, dword [esi + 0x10]
jb 0x40241c
mov esi, dword [esi]
push 0
push eax
push esi
push 0
push 0
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0x1c]
call dword [sym.imp.bcrypt.dll_BCryptGenerateSymmetricKey]
mov esi, eax
test esi, esi
jns 0x402475
mov edx, str.BCryptGenerateSymmetricKey_failed_with_error_code:
mov ecx, 0x4340d8
call fcn.004049c0
push esi
mov ecx, dword [eax]
mov edx, dword [ecx + 4]
mov ecx, dword [edx + eax + 0x14]
and ecx, 0xfffff9ff
or ecx, 0x800
mov dword [edx + eax + 0x14], ecx
mov ecx, eax
call fcn.00402ba0
push eax
call fcn.00404c60
add esp, 4
jmp 0x402545
push 1
lea eax, [ebp - 0x14]
push eax
push 0
push 0
push 0
push 0
push 0
push dword [ebp + 0x10]
push dword [ebp - 0x20]
push dword [ebp - 0x18]
call dword [sym.imp.bcrypt.dll_BCryptEncrypt]
mov esi, eax
test esi, esi
js 0x402503
mov ebx, dword [edi + 4]
mov ecx, ebx
mov edx, dword [edi]
sub ecx, edx
mov esi, dword [ebp - 0x14]
cmp esi, ecx
jae 0x4024af
lea eax, [edx + esi]
jmp 0x4024d6
jbe 0x4024d9
mov eax, dword [edi + 8]
sub eax, edx
cmp esi, eax
jbe 0x4024c5
push ecx
push esi
mov ecx, edi
call fcn.00405d50
jmp 0x4024d9
sub esi, ecx
push esi
push 0
push ebx
call fcn.00409880
add esp, 0xc
lea eax, [ebx + esi]
mov dword [edi + 4], eax
mov ecx, dword [edi]
lea edx, [ebp - 0x14]
mov eax, dword [edi + 4]
push 1
push edx
sub eax, ecx
push eax
push ecx
push 0
push 0
push 0
push dword [ebp + 0x10]
push dword [ebp - 0x20]
push dword [ebp - 0x18]
call dword [sym.imp.bcrypt.dll_BCryptEncrypt]
mov esi, eax
test esi, esi
jns 0x40253c
mov edx, str.BCryptEncrypt_failed_with_error_code:
mov ecx, 0x4340d8
call fcn.004049c0
push esi
mov ecx, dword [eax]
mov edx, dword [ecx + 4]
mov ecx, dword [edx + eax + 0x14]
and ecx, 0xfffff9ff
or ecx, 0x800
mov dword [edx + eax + 0x14], ecx
mov ecx, eax
call fcn.00402ba0
push eax
call fcn.00404c60
add esp, 4
push dword [ebp - 0x18]
call dword [sym.imp.bcrypt.dll_BCryptDestroyKey]
push 0
push dword [ebp - 0x1c]
call dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
mov eax, edi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00407e96
mov esp, ebp
pop ebp
ret 0x10