Function at 0x10408e3
Capabilities:
Encrypt or decrypt via wincrypt

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x1c
push esi
push edi
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x14]
push eax
lea eax, [ebp - 0x18]
push eax
push dword [ebp + 0x14]
xor edi, edi
push dword [ebp + 0x18]
mov dword [ebp - 0x1c], edi
push dword [ebp + 8]
mov dword [ebp - 0x18], edi
mov dword [ebp - 0x14], edi
mov dword [ebp - 0x10], edi
mov dword [ebp - 4], edi
mov dword [ebp - 8], edi
mov dword [ebp - 0xc], edi
call fcn.01040589
cmp eax, edi
mov dword [ebp + 0x18], eax
jl 0x1040ade
mov esi, dword [ebp + 0x20]
lea eax, [ebp - 4]
push eax
lea eax, [ebp - 0x10]
push eax
push esi
push dword [ebp + 0x1c]
push dword [ebp - 0x18]
push dword [ebp - 0x1c]
call fcn.010402ca
cmp eax, edi
mov dword [ebp + 0x18], eax
jl 0x1040ad0
mov eax, dword [ebp - 4]
push ebx
lea eax, [eax + esi + 4]
push eax
push 0x40
mov dword [ebp - 8], eax
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov ebx, eax
cmp ebx, edi
jne 0x1040974
mov dword [ebp + 0x18], 0xc000009a
jmp 0x1040ac4
mov eax, dword [ebp - 4]
mov esi, dword [ebp - 0x10]
mov dword [ebx], eax
mov ecx, dword [ebp - 4]
mov edx, ecx
shr ecx, 2
lea eax, [ebx + 4]
mov edi, eax
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edx, dword [ebp - 4]
mov ecx, dword [ebp + 0x20]
mov esi, dword [ebp + 0x1c]
lea edi, [eax + edx]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [ebp - 8]
push eax
mov dword [ebp - 0xc], eax
lea eax, [ebp - 0xc]
push eax
push ebx
xor edi, edi
push edi
push 1
push edi
push dword [ebp - 0x14]
call dword [sym.imp.ADVAPI32.dll_CryptEncrypt]
mov esi, eax
cmp esi, edi
jne 0x10409de
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xea
jne 0x1040a81
cmp dword [ebp + 0x24], edi
je 0x1040ab0
mov eax, dword [ebp + 0x28]
mov eax, dword [eax]
cmp eax, edi
jbe 0x1040ab0
mov ecx, dword [ebp - 0xc]
add ecx, 0x40
cmp eax, ecx
jb 0x1040ab0
cmp esi, edi
jne 0x1040a8a
push ebx
call dword [sym.imp.KERNEL32.dll_LocalFree]
push dword [ebp - 8]
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov ebx, eax
cmp ebx, edi
jne 0x1040a2e
mov dword [ebp + 0x18], 0xc000009a
jmp 0x1040ac2
mov eax, dword [ebp - 4]
mov esi, dword [ebp - 0x10]
mov dword [ebx], eax
mov ecx, dword [ebp - 4]
mov edx, ecx
shr ecx, 2
lea eax, [ebx + 4]
mov edi, eax
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edx, dword [ebp - 4]
mov ecx, dword [ebp + 0x20]
mov esi, dword [ebp + 0x1c]
lea edi, [eax + edx]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
push dword [ebp - 0xc]
lea eax, [ebp - 8]
push eax
push ebx
push 0
push 1
push 0
push dword [ebp - 0x14]
call dword [sym.imp.ADVAPI32.dll_CryptEncrypt]
test eax, eax
jne 0x1040a8a
mov dword [ebp + 0x18], 0xc0000321
jmp 0x1040ac2
mov esi, dword [ebp + 0x14]
mov edi, dword [ebp + 0x24]
push 0x10
pop ecx
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [ebp - 8]
mov edi, dword [ebp + 0x24]
mov eax, ecx
shr ecx, 2
add edi, 0x40
mov esi, ebx
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
jmp 0x1040ab7
mov dword [ebp + 0x18], 0xc0000023
mov eax, dword [ebp - 0xc]
mov ecx, dword [ebp + 0x28]
add eax, 0x40
mov dword [ecx], eax
xor edi, edi
cmp ebx, edi
je 0x1040acf
push ebx
call dword [sym.imp.KERNEL32.dll_LocalFree]
pop ebx
cmp dword [ebp - 0x10], edi
je 0x1040ade
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_LocalFree]
cmp dword [ebp - 0x14], edi
mov esi, dword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
je 0x1040aee
push dword [ebp - 0x14]
call esi
cmp dword [ebp - 0x18], edi
je 0x1040af8
push dword [ebp - 0x18]
call esi
cmp dword [ebp - 0x1c], edi
je 0x1040b07
push edi
push dword [ebp - 0x1c]
call dword [sym.imp.ADVAPI32.dll_CryptReleaseContext]
mov eax, dword [ebp + 0x18]
pop edi
pop esi
leave
ret 0x24