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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x9c
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
xorps xmm0, xmm0
push ebx
push esi
push edi
xor edi, edi
mov dword [ebp - 0x98], eax
push 0x2c
lea eax, [ebp - 0x30]
mov dword [ebp - 0x9c], ecx
mov ebx, edx
mov dword [ebp - 0x38], edi
mov edx, dword [ebp + 0xc]
push edi
push eax
mov dword [ebp - 0x94], edx
mov dword [ebp - 0x3c], edi
mov dword [ebp - 0x34], edi
movq qword [ebp - 0x50], xmm0
mov dword [ebp - 0x48], edi
movlpd qword [ebp - 0x44], xmm0
call fcn.004ad600
add esp, 0xc
push str.___Decrypting_A_data
push 3
call fcn.00408d60
add esp, 8
lea eax, [ebp - 0x38]
push edi
push edi
push 0x4cb24c
push eax
call dword [sym.imp.bcrypt.dll_BCryptOpenAlgorithmProvider]
test eax, eax
jns 0x4041c9
push eax
push str.Error_opening_alg:0x_X
jmp 0x4043f4
push 0
push 0x1e
push str.ChainingModeGCM
push str.ChainingMode
push dword [ebp - 0x38]
call dword [sym.imp.bcrypt.dll_BCryptSetProperty]
test eax, eax
jns 0x4041ef
push eax
push str.Error_setting_mode:0x_X
jmp 0x4043f4
mov esi, dword [sym.imp.bcrypt.dll_BCryptGetProperty]
lea eax, [ebp - 0x34]
push 0
push eax
push 4
lea eax, [ebp - 0x44]
push eax
push str.ObjectLength
push dword [ebp - 0x38]
call esi
test eax, eax
jns 0x40421a
push eax
push str.Error_getting_k_size:0x_X
jmp 0x4043f4
push 0
lea eax, [ebp - 0x34]
push eax
push 0xc
lea eax, [ebp - 0x50]
push eax
push str.AuthTagLength
push dword [ebp - 0x38]
call esi
test eax, eax
jns 0x40423f
push eax
push str.Error_getting_auth_size:0x_X
jmp 0x4043f4
mov eax, dword [ebx + 4]
xorps xmm0, xmm0
mov esi, dword [ebp - 0x98]
mov ecx, dword [ebp - 0x4c]
push dword [ebp - 0x44]
mov dword [ebp - 0x88], eax
mov eax, dword [ebx]
mov dword [ebp - 0x84], eax
mov eax, dword [esi]
sub eax, ecx
movlpd qword [ebp - 0x80], xmm0
add eax, dword [esi + 4]
push 0x40
movlpd qword [ebp - 0x70], xmm0
movlpd qword [ebp - 0x68], xmm0
movlpd qword [ebp - 0x60], xmm0
mov dword [ebp - 0x54], edi
mov dword [ebp - 0x90], 0x40
mov dword [ebp - 0x8c], 1
mov dword [ebp - 0x78], eax
mov dword [ebp - 0x74], ecx
mov dword [ebp - 0x58], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
inc dword [0x4de7b4]
mov ecx, eax
mov dword [ebp - 0x40], ecx
test ecx, ecx
jne 0x4042c2
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Error_allocating_k_obj:0x_X
jmp 0x4043f4
mov eax, dword [ebp - 0x9c]
mov dword [ebp - 0x30], 0x4d42444b
mov dword [ebp - 0x2c], 1
mov dword [ebp - 0x28], 0x20
mov eax, dword [eax + 4]
test eax, eax
je 0x4042f5
movups xmm0, xmmword [eax]
movups xmmword [ebp - 0x24], xmm0
movups xmm0, xmmword [eax + 0x10]
movups xmmword [ebp - 0x14], xmm0
jmp 0x404313
xorps xmm0, xmm0
movups xmmword [ebp - 0x24], xmm0
movups xmmword [ebp - 0x14], xmm0
call fcn.004b3319
mov dword [eax], 0x16
call fcn.004b3238
mov ecx, dword [ebp - 0x40]
push 0
push 0x2c
lea eax, [ebp - 0x30]
push eax
push dword [ebp - 0x44]
lea eax, [ebp - 0x3c]
push ecx
push eax
push str.KeyDataBlob
push 0
push dword [ebp - 0x38]
call dword [sym.imp.bcrypt.dll_BCryptImportKey]
test eax, eax
jns 0x404342
push eax
push str.Error_setting_mode:0x_X
jmp 0x4043f4
push 0
lea eax, [ebp - 0x34]
push eax
mov eax, dword [ebp - 0x94]
push dword [eax]
push dword [eax + 4]
lea eax, [ebp - 0x90]
push dword [ebx]
push dword [ebx + 4]
push eax
mov eax, dword [esi]
sub eax, dword [ebp - 0x4c]
push eax
push dword [esi + 4]
push dword [ebp - 0x3c]
call dword [sym.imp.bcrypt.dll_BCryptDecrypt]
mov ecx, dword [ebp - 0x34]
test ecx, ecx
je 0x4043ee
push ecx
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov edx, dword [ebp - 0x94]
mov ecx, eax
inc dword [0x4de7b4]
mov dword [edx + 4], ecx
test ecx, ecx
jne 0x4043a4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Error_allocating_memory_for_decryption:0x_X
jmp 0x4043f4
mov eax, dword [ebp - 0x34]
push 0
mov dword [edx], eax
lea edx, [ebp - 0x34]
push edx
push eax
push ecx
push dword [ebx]
lea eax, [ebp - 0x90]
push dword [ebx + 4]
push eax
mov eax, dword [esi]
sub eax, dword [ebp - 0x4c]
push eax
push dword [esi + 4]
push dword [ebp - 0x3c]
call dword [sym.imp.bcrypt.dll_BCryptDecrypt]
test eax, eax
jns 0x4043da
cmp eax, 0xc000a002
jne 0x4043ee
push eax
push str.Decrypting_data_returned:0x_X
push 3
call fcn.00408d60
mov edi, 1
jmp 0x4043fb
push eax
push str.Error_decrypting_data:0x_X
push 1
call fcn.00408d60
add esp, 0xc
mov eax, dword [ebp - 0x3c]
test eax, eax
je 0x40440c
push eax
call dword [sym.imp.bcrypt.dll_BCryptDestroyKey]
mov eax, dword [ebp - 0x38]
test eax, eax
je 0x40441c
push 0
push eax
call dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
mov ecx, dword [ebp - 0x40]
test ecx, ecx
je 0x404430
push ecx
call dword [sym.imp.KERNEL32.dll_LocalFree]
dec dword [0x4de7b4]
push str.Decrypting_A_data___
push 3
call fcn.00408d60
mov ecx, dword [ebp - 4]
add esp, 8
mov eax, edi
xor ecx, ebp
pop edi
pop esi
pop ebx
call fcn.004ac4d4
mov esp, ebp
pop ebp
ret