Function at 0x100a5100
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x6c
mov eax, dword [0x10415990]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x104347d0
push 0x628
push 0x104347e0
mov edi, ecx
push 2
xor ebx, ebx
push edi
mov dword [ebp - 0x60], ebx
mov dword [ebp - 0x50], 1
call fcn.100a2610
add esp, 0x14
cmp dword [edi + 0x2c], ebx
je 0x100a5ae7
mov ecx, dword [edi + 0x40]
cmp ecx, ebx
je 0x100a5ae7
lea eax, [ecx + 0x90]
mov dword [ebp - 0x4c], eax
cmp eax, ebx
je 0x100a5167
mov eax, dword [eax]
cmp eax, ebx
je 0x100a5167
mov edx, dword [eax + 4]
jmp 0x100a5169
xor edx, edx
mov eax, dword [ecx + 8]
mov esi, dword [edi + 0x7c]
cmp esi, eax
jae 0x100a51a5
push eax
push esi
push str.in_msglen___d____minlen___d_
push 0x635
push 0x104348a0
push 1
push edi
call fcn.100a2610
add esp, 0x1c
mov eax, 0xffff8e80
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
cmp edx, 7
jne 0x100a521f
mov edx, dword [edi + 0x70]
lea eax, [ebp - 0x48]
push eax
push edx
push esi
mov esi, dword [ebp - 0x4c]
push edx
lea edx, [ecx + 0x28]
mov ecx, dword [ecx + 0xc]
xor ebx, ebx
mov dword [ebp - 0x48], ebx
call fcn.100b8450
mov esi, eax
add esp, 0x10
test esi, esi
je 0x100a51ff
push 0x647
push 1
push edi
mov edx, esi
mov ecx, 0x104348f0
mov edi, 0x10434920
call fcn.100a26b0
add esp, 0xc
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
mov ecx, dword [edi + 0x7c]
cmp ecx, dword [ebp - 0x48]
je 0x100a5813
push 0x1043490c
push 0x64d
push 0x10434970
jmp 0x100a5af6
cmp edx, 6
je 0x100a5654
cmp edx, 8
je 0x100a5654
cmp edx, 2
jne 0x100a5640
xor eax, eax
mov dword [ebp - 0x48], eax
cmp dword [edi + 0x14], edx
jl 0x100a5247
mov eax, dword [ecx + 0xc]
mov edx, dword [ecx + 0xc]
lea ebx, [edx + eax]
cmp esi, ebx
jb 0x100a5629
mov ebx, dword [ecx + 0x14]
lea eax, [ebx + eax + 1]
cmp esi, eax
jb 0x100a5629
mov eax, dword [edi + 0x2c]
cmp dword [eax + 0x80], 1
mov ecx, dword [edi + 0x70]
mov ebx, esi
mov dword [ebp - 0x4c], ecx
jne 0x100a53d9
push str.using_encrypt_then_mac
push 0x6c9
push 0x10434ce8
push 3
push edi
call fcn.100a2610
mov edx, dword [edi + 0x40]
mov eax, dword [edx + 0x14]
sub dword [edi + 0x7c], eax
sub ebx, eax
mov eax, dword [edi + 0x60]
mov ecx, dword [eax]
mov dword [ebp - 0x14], ecx
mov edx, dword [eax + 4]
mov eax, dword [edi + 0x64]
mov dword [ebp - 0x10], edx
mov cx, word [eax]
mov word [ebp - 0xc], cx
mov dl, byte [eax + 2]
mov cl, byte [edi + 0x7c]
mov al, byte [edi + 0x7d]
add esp, 0x14
mov byte [ebp - 0xa], dl
push 0xd
lea edx, [ebp - 0x14]
push edx
push 0x6d3
mov byte [ebp - 8], cl
push 0x10434d48
push 4
mov ecx, str.MACd_meta_data
mov edx, edi
mov byte [ebp - 9], al
call fcn.100a2730
lea eax, [ebp - 0x14]
add esp, 0x14
push eax
mov eax, dword [edi + 0x40]
add eax, 0x44
mov edx, 0xd
call fcn.100b0cb0
mov ecx, dword [edi + 0x6c]
mov eax, dword [edi + 0x40]
mov edx, dword [edi + 0x7c]
add esp, 4
push ecx
add eax, 0x44
call fcn.100b0cb0
mov esi, dword [edi + 0x40]
lea edx, [ebp - 0x44]
add esp, 4
push edx
add esi, 0x44
call fcn.100b0ce0
mov esi, dword [edi + 0x40]
add esp, 4
add esi, 0x44
call fcn.100b0d80
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0x14]
mov edx, dword [edi + 0x7c]
add edx, dword [edi + 0x6c]
push ecx
push edx
push 0x6dc
push 0x10434da8
push 4
mov ecx, 0x10434d98
mov edx, edi
call fcn.100a2730
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0x14]
add esp, 0x14
push ecx
lea edx, [ebp - 0x44]
push edx
push 0x6de
push 0x10434e08
push 4
mov ecx, 0x10434df8
mov edx, edi
call fcn.100a2730
mov ecx, dword [edi + 0x40]
mov esi, dword [edi + 0x7c]
mov ecx, dword [ecx + 0x14]
lea eax, [ebp - 0x44]
add esp, 0x14
push eax
mov eax, dword [edi + 0x6c]
add eax, esi
call fcn.100b8640
add esp, 4
test eax, eax
je 0x100a53d2
push str.message_mac_does_not_match
push 0x6e3
push 0x10434e90
push 1
push edi
call fcn.100a2610
mov eax, 0xffff8e80
add esp, 0x14
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
mov dword [ebp - 0x60], 1
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0xc]
xor edx, edx
mov eax, esi
div ecx
test edx, edx
je 0x100a53ff
push ecx
push esi
push str.msglen___d_____ivlen___d____0
push 0x6f1
push 0x10434f00
jmp 0x100a5184
cmp dword [edi + 0x14], 2
jl 0x100a5436
mov ecx, dword [edi + 0x40]
mov eax, dword [ecx + 0xc]
sub esi, eax
sub ebx, eax
xor eax, eax
mov dword [edi + 0x7c], esi
cmp dword [ecx + 0xc], eax
jbe 0x100a5436
lea esp, [esp]
mov ecx, dword [edi + 0x6c]
mov edx, dword [edi + 0x40]
mov cl, byte [eax + ecx]
mov byte [eax + edx + 0x28], cl
mov edx, dword [edi + 0x40]
inc eax
cmp eax, dword [edx + 0xc]
jb 0x100a5420
mov eax, dword [edi + 0x40]
lea ecx, [ebp - 0x48]
push ecx
mov ecx, dword [ebp - 0x4c]
push ecx
push ebx
push ecx
mov ecx, dword [eax + 0xc]
lea edx, [eax + 0x28]
lea esi, [eax + 0x90]
call fcn.100b8450
mov esi, eax
add esp, 0x10
test esi, esi
je 0x100a548c
push 0x709
push 1
push edi
mov edx, esi
mov ecx, str.iFly_mbedtls_cipher_crypt
mov edi, 0x10434f50
call fcn.100a26b0
add esp, 0xc
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
cmp ebx, dword [ebp - 0x48]
je 0x100a54a5
push 0x10434fa0
push 0x70f
push 0x10434fc8
jmp 0x100a5af6
cmp dword [edi + 0x14], 2
jge 0x100a54c5
mov eax, dword [edi + 0x40]
mov edx, dword [eax + 0xc]
push edx
lea ecx, [eax + 0xb8]
push ecx
add eax, 0x28
push eax
call sub.MSVCR100.dll_memcpy
add esp, 0xc
mov edx, dword [edi + 0x7c]
mov eax, dword [edi + 0x70]
movzx ebx, byte [eax + edx - 1]
mov eax, dword [edi + 0x40]
mov esi, dword [eax + 0x14]
inc ebx
lea ecx, [esi + ebx]
cmp edx, ecx
jae 0x100a54e9
cmp dword [ebp - 0x60], 0
jne 0x100a54e9
xor ebx, ebx
mov dword [ebp - 0x50], ebx
cmp dword [edi + 0x14], 0
jle 0x100a5615
mov ecx, edx
sub ecx, ebx
dec ecx
add esi, 0x4000
cmp ecx, esi
mov dword [ebp - 0x4c], ecx
sbb ecx, ecx
neg ecx
lea esi, [ebx + 1]
cmp edx, esi
sbb edx, edx
inc edx
and ecx, edx
mov edx, dword [ebp - 0x50]
and edx, ecx
mov ecx, dword [ebp - 0x4c]
imul ecx, edx
mov dword [ebp - 0x50], edx
xor edx, edx
mov dword [ebp - 0x64], edx
mov dword [ebp - 0x68], edx
mov dword [ebp - 0x4c], edx
mov edx, dword [edi + 0x70]
lea ecx, [ecx + edx + 3]
mov dword [ebp - 0x58], 3
mov dword [ebp - 0x54], ecx
mov ecx, dword [ebp - 0x58]
mov dword [ebp - 0x48], 0
mov eax, 1
lea esi, [ebx - 1]
add ecx, 0xfffffffe
cmp ebx, ecx
sbb edx, edx
mov ecx, dword [ebp - 0x54]
inc edx
and eax, edx
movzx edx, byte [ecx - 2]
xor ecx, ecx
cmp edx, esi
sete cl
mov edx, dword [ebp - 0x58]
dec edx
imul ecx, eax
add dword [ebp - 0x48], ecx
cmp ebx, edx
sbb ecx, ecx
mov edx, dword [ebp - 0x54]
inc ecx
and eax, ecx
movzx ecx, byte [edx - 1]
xor edx, edx
cmp ecx, esi
sete dl
imul edx, eax
add dword [ebp - 0x4c], edx
cmp ebx, dword [ebp - 0x58]
mov edx, dword [ebp - 0x54]
sbb ecx, ecx
inc ecx
and eax, ecx
movzx ecx, byte [edx]
xor edx, edx
cmp ecx, esi
mov ecx, dword [ebp - 0x58]
sete dl
inc ecx
imul edx, eax
add dword [ebp - 0x68], edx
cmp ebx, ecx
mov ecx, dword [ebp - 0x54]
sbb edx, edx
inc edx
and eax, edx
movzx edx, byte [ecx + 1]
xor ecx, ecx
cmp edx, esi
sete cl
add dword [ebp - 0x54], 4
imul ecx, eax
add dword [ebp - 0x64], ecx
mov ecx, dword [ebp - 0x58]
add ecx, 4
lea edx, [ecx - 2]
mov dword [ebp - 0x58], ecx
cmp edx, 0x100
jbe 0x100a554d
mov ecx, dword [ebp - 0x64]
add ecx, dword [ebp - 0x68]
mov eax, dword [ebp - 0x48]
add ecx, dword [ebp - 0x4c]
xor edx, edx
add eax, ecx
cmp eax, ebx
mov eax, dword [ebp - 0x50]
mov esi, dword [ebp - 0x60]
sete dl
and eax, edx
mov dword [ebp - 0x50], eax
imul eax, eax, 0x1ff
and ebx, eax
mov eax, dword [edi + 0x7c]
sub eax, ebx
mov dword [edi + 0x7c], eax
jmp 0x100a5815
push 0x10434fb4
push 0x769
push 0x10435018
jmp 0x100a5af6
mov eax, dword [ecx + 0x14]
push eax
push edx
push esi
push str.msglen___d____max__ivlen__d___maclen___d___1______expl_IV__
push 0x6b8
push 0x10434c80
jmp 0x100a5689
push 0x10435068
push 0x773
push 0x10435098
jmp 0x100a5af6
mov edx, dword [ecx]
test byte [edx + 0x24], 2
mov eax, dword [ecx + 0xc]
sete dl
sub eax, dword [ecx + 0x10]
lea edx, [edx*8 + 8]
movzx ecx, dl
lea edx, [ecx + eax]
mov dword [ebp - 0x4c], ecx
cmp esi, edx
jae 0x100a56aa
push ecx
push eax
push esi
push str.msglen___d____explicit_iv_len___d___taglen___d_
push 0x665
push 0x10434a28
push 1
push edi
call fcn.100a2610
add esp, 0x20
mov eax, 0xffff8e80
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
sub esi, ecx
sub esi, eax
mov eax, esi
mov esi, dword [edi + 0x70]
mov dword [edi + 0x7c], eax
mov dword [ebp - 0x48], eax
mov eax, dword [edi + 0x60]
mov edx, dword [eax + 4]
mov ecx, dword [eax]
mov al, byte [edi + 0x78]
mov dword [ebp - 0x10], edx
mov edx, dword [edi]
test byte [edx + 0xcc], 2
mov dword [ebp - 0x14], ecx
mov ecx, dword [edi + 0x10]
mov byte [ebp - 0xc], al
mov eax, dword [edi + 0x14]
je 0x100a56f3
cmp eax, 2
jne 0x100a56e8
mov eax, 1
mov dl, 1
sub dl, cl
mov byte [ebp - 0xb], dl
neg al
jmp 0x100a56f6
mov byte [ebp - 0xb], cl
mov cl, byte [edi + 0x7c]
push 0xd
lea edx, [ebp - 0x14]
push edx
push 0x676
mov byte [ebp - 0xa], al
mov al, byte [edi + 0x7d]
mov byte [ebp - 8], cl
push 0x10434a78
push 4
mov ecx, str.additional_data_used_for_AEAD
mov edx, edi
mov byte [ebp - 9], al
call fcn.100a2730
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0x10]
mov edx, dword [eax + 0xc]
add esp, 0x14
sub edx, ecx
push edx
mov edx, dword [edi + 0x6c]
push edx
lea eax, [ecx + eax + 0x28]
push eax
call sub.MSVCR100.dll_memcpy
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0xc]
add esp, 0xc
push ecx
add eax, 0x28
push eax
push 0x67d
push 0x10434ac8
push 4
mov ecx, str.IV_used
mov edx, edi
call fcn.100a2730
mov edx, dword [ebp - 0x48]
mov ecx, dword [ebp - 0x4c]
add esp, 0x14
push ecx
lea eax, [esi + edx]
push eax
push 0x67e
push 0x10434b18
push 4
mov ecx, str.TAG_used
mov edx, edi
mov dword [ebp - 0x5c], eax
call fcn.100a2730
mov edx, dword [ebp - 0x4c]
mov ecx, dword [ebp - 0x48]
mov eax, dword [edi + 0x40]
add esp, 0x14
push edx
push esi
push ecx
mov ecx, dword [eax + 0xc]
push esi
lea edx, [ebp - 0x14]
push edx
push ecx
mov ecx, dword [ebp - 0x5c]
lea edx, [eax + 0x28]
push edx
lea esi, [eax + 0x90]
lea edx, [ebp - 0x5c]
call fcn.100b8590
mov esi, eax
add esp, 0x1c
test esi, esi
je 0x100a57f2
push 0x68b
push 1
push edi
mov edx, esi
mov ecx, str.iFly_mbedtls_cipher_auth_decrypt
mov edi, 0x10434ba0
call fcn.100a26b0
add esp, 0xc
cmp esi, 0xffff9d00
jne 0x100a51ec
jmp 0x100a518f
mov eax, dword [ebp - 0x48]
mov esi, 1
cmp dword [ebp - 0x5c], eax
je 0x100a5815
push 0x10434b8c
push 0x696
push 0x10434bf0
jmp 0x100a5af6
mov esi, ebx
mov ecx, dword [edi + 0x7c]
mov edx, dword [edi + 0x70]
push ecx
push edx
push 0x778
push 0x104350e8
push 4
mov ecx, str.raw_buffer_after_decryption
mov edx, edi
call fcn.100a2730
add esp, 0x14
test esi, esi
jne 0x100a5a0d
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0x14]
sub dword [edi + 0x7c], ecx
mov edx, dword [edi + 0x7c]
mov eax, dword [edi + 0x68]
shr edx, 8
mov byte [eax], dl
mov ecx, dword [edi + 0x68]
mov dl, byte [edi + 0x7c]
mov byte [ecx + 1], dl
mov eax, dword [edi + 0x40]
mov eax, dword [eax + 0x14]
mov esi, dword [edi + 0x7c]
mov ecx, dword [edi + 0x70]
push eax
add ecx, esi
push ecx
lea edx, [ebp - 0x44]
push edx
call sub.MSVCR100.dll_memcpy
add esp, 0xc
cmp dword [edi + 0x14], 0
jle 0x100a59f9
mov eax, dword [ebp - 0x50]
mov ecx, dword [edi + 0x60]
imul eax, eax, 0xff
lea ebx, [esi + ebx + 0x15]
add esi, 0x15
shr ebx, 6
shr esi, 6
sub ebx, esi
and ebx, eax
mov eax, dword [edi + 0x40]
push ecx
add eax, 0x44
mov edx, 8
call fcn.100b0cb0
mov edx, dword [edi + 0x64]
mov eax, dword [edi + 0x40]
add esp, 4
push edx
add eax, 0x44
mov edx, 3
call fcn.100b0cb0
mov eax, dword [edi + 0x68]
add esp, 4
push eax
mov eax, dword [edi + 0x40]
add eax, 0x44
mov edx, 2
call fcn.100b0cb0
mov ecx, dword [edi + 0x70]
mov eax, dword [edi + 0x40]
mov edx, dword [edi + 0x7c]
add esp, 4
push ecx
add eax, 0x44
call fcn.100b0cb0
mov edx, dword [edi + 0x7c]
add edx, dword [edi + 0x70]
mov esi, dword [edi + 0x40]
add esp, 4
push edx
add esi, 0x44
call fcn.100b0ce0
add esp, 4
inc ebx
je 0x100a5931
nop
mov eax, dword [edi + 0x40]
add eax, 0x44
je 0x100a592e
mov ecx, dword [eax]
test ecx, ecx
je 0x100a592e
mov edx, dword [edi + 0x70]
mov eax, dword [eax + 4]
mov ecx, dword [ecx + 0x2c]
push edx
push eax
call ecx
add esp, 8
dec ebx
jne 0x100a5910
mov esi, dword [edi + 0x40]
add esi, 0x44
call fcn.100b0d80
mov edx, dword [edi + 0x40]
mov eax, dword [edx + 0x14]
push eax
lea ecx, [ebp - 0x44]
push ecx
push 0x7c0
push 0x104351c0
push 4
mov ecx, str.message__mac
mov edx, edi
call fcn.100a2730
mov edx, dword [edi + 0x40]
mov eax, dword [edx + 0x14]
mov ecx, dword [edi + 0x7c]
add ecx, dword [edi + 0x70]
add esp, 0x14
push eax
push ecx
push 0x7c2
push 0x10435220
push 4
mov ecx, str.computed_mac
mov edx, edi
call fcn.100a2730
mov eax, dword [edi + 0x7c]
add eax, dword [edi + 0x70]
mov edx, dword [edi + 0x40]
mov ecx, dword [edx + 0x14]
add esp, 0x14
push eax
lea eax, [ebp - 0x44]
call fcn.100b8640
add esp, 4
test eax, eax
jne 0x100a518f
cmp dword [ebp - 0x50], eax
je 0x100a518f
cmp dword [edi + 0x7c], 0
jne 0x100a5a26
inc dword [edi + 0xa4]
cmp dword [edi + 0xa4], 3
jle 0x100a5a30
push str.received_four_consecutive_empty_messages__possible_DoS_attack
push 0x7e8
push 0x10435300
push 1
push edi
call fcn.100a2610
mov eax, 0xffff8e80
add esp, 0x14
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
push 0x10435138
push 0x7bc
push 0x10435160
jmp 0x100a5af6
cmp esi, 1
je 0x100a59b4
push 0x1043514c
push 0x7d9
push 0x10435270
jmp 0x100a5af6
mov dword [edi + 0xa4], 0
mov ecx, dword [edi]
test byte [ecx + 0xcc], 2
jne 0x100a5aba
mov eax, 8
mov edx, dword [edi]
mov cl, byte [edx + 0xcc]
and cl, 2
xor edx, edx
cmp cl, 2
setne dl
lea ecx, [edx - 1]
and ecx, 2
cmp eax, ecx
jbe 0x100a5a6d
mov ecx, dword [edi + 0x60]
inc byte [ecx + eax - 1]
lea ecx, [ecx + eax - 1]
jne 0x100a5a6d
dec eax
jmp 0x100a5a40
mov edx, dword [edi]
mov cl, byte [edx + 0xcc]
and cl, 2
xor edx, edx
cmp cl, 2
setne dl
lea ecx, [edx - 1]
and ecx, 2
cmp eax, ecx
jne 0x100a5aba
push str.incoming_message_counter_would_wrap
push 0x7fe
push 0x10435388
push 1
push edi
call fcn.100a2610
mov eax, 0xffff9480
add esp, 0x14
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
push str.__decrypt_buf
push 0x803
push 0x104353e8
push 2
push edi
call fcn.100a2610
add esp, 0x14
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1015eea7
mov esp, ebp
pop ebp
ret
push 0x1043470c
push 0x62c
push 0x10434830
push 1
push edi
call fcn.100a2610
mov ecx, dword [ebp - 4]
add esp, 0x14
pop edi
pop esi
xor ecx, ebp
mov eax, 0xffff9400
pop ebx
call fcn.1015eea7
mov esp, ebp
pop ebp
ret