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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x30
mov eax, dword [0x41b004]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
mov dword [ebp - 0x30], eax
xor ebx, ebx
mov eax, dword [ebp + 0xc]
push esi
push edi
mov dword [ebp - 0x20], eax
xor edi, edi
mov eax, dword [ebp + 0x10]
mov dword [ebp - 0x24], edx
mov dword [ebp - 0x28], ecx
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x1c], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 8], 0
mov dword [ebp - 0xc], ebx
test eax, eax
je 0x401249
cmp dword [ebp + 0x14], ebx
je 0x401249
push edi
push str.Microsoft_Primitive_Provider
push 0x418d80
lea eax, [ebp - 0x10]
push eax
call dword [sym.imp.bcrypt.dll_BCryptOpenAlgorithmProvider]
test eax, eax
je 0x4010d2
push eax
push str._x__BCryptOpenAlgoritmProvider_error:_NTSTATUS_0x_x_n
call fcn.00401010
add esp, 8
jmp 0x401256
push 0
push 0x20
push str.ChainingModeCBC
push str.ChainingMode
push dword [ebp - 0x10]
call dword [sym.imp.bcrypt.dll_BCryptSetProperty]
test eax, eax
je 0x401100
push eax
push str._x__BCryptSetProperty_CBC_Mode_error:_NTSTATUS_0x_x_n
call fcn.00401010
add esp, 8
jmp 0x401256
push 0
lea eax, [ebp - 8]
push eax
push 4
lea eax, [ebp - 0x1c]
push eax
push str.ObjectLength
push dword [ebp - 0x10]
call dword [sym.imp.bcrypt.dll_BCryptGetProperty]
test eax, eax
je 0x401131
push eax
push str._x__BCryptGetProperty_get_block_size_error:_NTSTATUS_0x_x
call fcn.00401010
add esp, 8
jmp 0x401256
mov esi, dword [sym.imp.KERNEL32.dll_VirtualAlloc]
push 4
push 0x3000
push dword [ebp - 0x1c]
push 0
call esi
mov ebx, eax
test ebx, ebx
jne 0x401164
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._x__VirtualAlloc_error:_0x_x_n
call fcn.00401010
add esp, 8
jmp 0x401256
push 0
lea eax, [ebp - 8]
push eax
push 4
lea eax, [ebp - 0x14]
push eax
push str.BlockLength
push dword [ebp - 0x10]
call dword [sym.imp.bcrypt.dll_BCryptGetProperty]
test eax, eax
jne 0x40111e
push eax
push 0x20
push dword [ebp - 0x2c]
lea eax, [ebp - 0x18]
push dword [ebp - 0x1c]
push ebx
push eax
push dword [ebp - 0x10]
call dword [sym.imp.bcrypt.dll_BCryptGenerateSymmetricKey]
test eax, eax
je 0x4011b0
push eax
push str.BCryptGenerateSymmetricKey_error:_NTSTATUS_0x_x_n
call fcn.00401010
add esp, 8
jmp 0x401256
push 4
push 0x3000
push dword [ebp - 0x14]
push 0
call esi
mov edi, eax
test edi, edi
je 0x40114b
mov ecx, dword [ebp - 0x20]
push 1
push ecx
push 0
push 0
push dword [ebp - 0x14]
push edi
push 0
push dword [ebp - 0x24]
push dword [ebp - 0x28]
push dword [ebp - 0x18]
call dword [sym.imp.bcrypt.dll_BCryptDecrypt]
test eax, eax
je 0x4011f7
push eax
push str._x__BCryptDecrypt_get_decrypt_size_error:_NTSTATUS_0x_x_n
call fcn.00401010
add esp, 8
jmp 0x401256
mov eax, dword [ebp - 0x20]
push 4
push 0x3000
push dword [eax]
push 0
call esi
mov ecx, dword [ebp - 0x30]
mov dword [ecx], eax
test eax, eax
je 0x40114b
push 1
lea ecx, [ebp - 0xc]
push ecx
mov ecx, dword [ebp - 0x20]
push dword [ecx]
push eax
push dword [ebp - 0x14]
push edi
push 0
push dword [ebp - 0x24]
push dword [ebp - 0x28]
push dword [ebp - 0x18]
call dword [sym.imp.bcrypt.dll_BCryptDecrypt]
test eax, eax
je 0x401256
push eax
push str._x__BCryptDecrypt_error:_NTSTATUS_0x_x_n
call fcn.00401010
add esp, 8
jmp 0x401256
push str._x__key_iv_mustnt_NULL_pointer_n
call fcn.00401010
add esp, 4
push 0
push dword [ebp - 0x10]
call dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
push dword [ebp - 0x18]
call dword [sym.imp.bcrypt.dll_BCryptDestroyKey]
mov esi, dword [sym.imp.KERNEL32.dll_VirtualFree]
push 0x8000
push dword [ebp - 0x1c]
push ebx
call esi
push 0x8000
push dword [ebp - 0x14]
push edi
call esi
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00401f10
mov esp, ebp
pop ebp
ret