Function at 0x4befba
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0xd0
mov eax, dword [0x5c9040]
xor eax, esp
mov dword [esp + 0xcc], eax
push ebx
mov ebx, dword [esp + 0xd8]
xor eax, eax
push ebp
push esi
push edi
push 0x59fbb4
push 0x3f6
push str.srclibmbedtlslibrary_ssl_msg.c
mov ebp, ecx
mov dword [esp + 0x34], eax
xor esi, esi
mov dword [esp + 0x48], ebp
mov edi, edx
mov dword [esp + 0x2c], eax
push 2
inc esi
mov dword [esp + 0x48], edi
push ebp
mov dword [esp + 0x2c], eax
mov dword [esp + 0x40], esi
call fcn.004c6a21
add esp, 0x14
test ebx, ebx
je 0x4bf6bd
cmp dword [ebx + 0xc], 0
je 0x4bf6bd
mov eax, dword [ebx + 0x10]
mov edx, dword [ebx + 0x14]
cmp eax, edx
jb 0x4bf6bd
mov ecx, dword [ebx + 0x18]
sub eax, edx
cmp eax, ecx
jb 0x4bf6bd
add edx, dword [ebx + 0xc]
mov eax, dword [edi + 0x94]
mov dword [esp + 0x10], edx
test eax, eax
je 0x4bf6b1
mov eax, dword [eax + 4]
mov dword [esp + 0x34], 0x100
cmp eax, 6
je 0x4bf44b
cmp eax, 8
je 0x4bf44b
cmp eax, 0xb
je 0x4bf44b
cmp eax, 2
jne 0x4bf6b1
mov edx, dword [edi + 4]
lea eax, [edx + edx]
cmp ecx, eax
jb 0x4bf42a
mov eax, dword [edi + 0xc]
inc eax
add eax, edx
cmp ecx, eax
jb 0x4bf42a
cmp dword [edi + 0x4c], esi
jne 0x4bf225
push str.using_encrypt_then_mac
push 0x4c7
mov esi, str.srclibmbedtlslibrary_ssl_msg.c
push esi
push 3
push ebp
call fcn.004c6a21
mov eax, dword [edi + 0xc]
lea edx, [esp + 0x30]
sub dword [ebx + 0x18], eax
lea ecx, [esp + 0x60]
add esp, 0xc
push ebx
call fcn.004be85b
add esp, 0xc
lea eax, [esp + 0x4c]
mov ecx, ebp
push dword [esp + 0x1c]
push eax
push str.MACd_meta_data
push 0x4da
push esi
push 4
pop edx
call fcn.004c6b7e
add esp, 0x14
lea ecx, [edi + 0x40]
lea edx, [esp + 0x4c]
push dword [esp + 0x1c]
call fcn.004c781f
mov esi, eax
pop ecx
test esi, esi
jne 0x4bf1e9
push dword [ebx + 0x18]
mov edx, dword [esp + 0x14]
lea ecx, [edi + 0x40]
call fcn.004c781f
mov esi, eax
pop ecx
test esi, esi
jne 0x4bf1e9
lea edx, [esp + 0x7c]
lea ecx, [edi + 0x40]
call fcn.004c7838
mov esi, eax
test esi, esi
jne 0x4bf1e9
lea ecx, [edi + 0x40]
call fcn.004c78c7
mov esi, eax
test esi, esi
jne 0x4bf1e9
push dword [edi + 0xc]
mov eax, dword [ebx + 0x18]
mov ecx, ebp
add eax, dword [esp + 0x14]
push eax
push str.message__mac
push 0x4eb
push str.srclibmbedtlslibrary_ssl_msg.c
push 4
pop edx
call fcn.004c6b7e
add esp, 0x14
lea eax, [esp + 0x7c]
mov ecx, ebp
push dword [edi + 0xc]
push eax
push str.expected_mac
push 0x4ed
push str.srclibmbedtlslibrary_ssl_msg.c
push 4
pop edx
call fcn.004c6b7e
mov ecx, dword [ebx + 0x18]
lea edx, [esp + 0x90]
add ecx, dword [esp + 0x24]
add esp, 0x14
push dword [edi + 0xc]
call fcn.004c7901
pop ecx
test eax, eax
je 0x4bf1e1
push str.message_mac_does_not_match
push 0x4f3
push str.srclibmbedtlslibrary_ssl_msg.c
push 1
push ebp
call fcn.004c6a21
add esp, 0x14
mov esi, 0xffff8e80
jmp 0x4bf1e9
mov dword [esp + 0x20], 1
mov edx, dword [edi + 0xc]
lea ecx, [esp + 0x7c]
call fcn.004c8483
test esi, esi
je 0x4bf225
cmp esi, 0xffff8e80
je 0x4bf21e
push esi
push str.mbedtls_hmac_xxx
push 0x4fe
xor edx, edx
mov ecx, ebp
push str.srclibmbedtlslibrary_ssl_msg.c
inc edx
call fcn.004c6af7
add esp, 0x10
mov eax, esi
jmp 0x4bf6dc
mov esi, dword [ebx + 0x18]
xor edx, edx
mov ecx, dword [edi + 4]
mov eax, esi
div ecx
push ecx
test edx, edx
je 0x4bf246
push esi
push str.msglen___zu_____ivlen___zu____0
push 0x50f
jmp 0x4bf465
push dword [esp + 0x14]
lea esi, [edi + 0x24]
push esi
call fcn.0051c650
mov eax, dword [edi + 4]
lea edx, [esp + 0x20]
mov ecx, dword [esp + 0x1c]
add esp, 0xc
add dword [ebx + 0x14], eax
add ecx, eax
mov eax, dword [ebx + 0x18]
sub eax, dword [edi + 4]
push edx
push ecx
push eax
push ecx
mov dword [ebx + 0x18], eax
mov edx, esi
push dword [edi + 4]
mov dword [esp + 0x24], ecx
lea ecx, [edi + 0x94]
call fcn.004c8de7
mov esi, eax
add esp, 0x14
test esi, esi
je 0x4bf2a0
push esi
push str.mbedtls_cipher_crypt
push 0x525
jmp 0x4bf20c
mov ecx, dword [ebx + 0x18]
cmp ecx, dword [esp + 0x14]
je 0x4bf2b8
push str.should_never_happen
push 0x52c
jmp 0x4bf6c7
cmp dword [esp + 0x20], 1
mov esi, ecx
mov eax, dword [esp + 0x10]
movzx edx, byte [ecx + eax - 1]
je 0x4bf2cd
sub esi, dword [edi + 0xc]
sub esi, edx
mov dword [esp + 0x14], ecx
dec esi
mov eax, ecx
shr esi, 0x1f
neg esi
shr esi, 0x1f
dec esi
and edx, esi
mov dword [esp + 0x2c], esi
mov dword [esp + 0x24], edx
inc edx
sub eax, edx
mov dword [esp + 0x18], edx
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x34]
cmp ecx, eax
cmovbe eax, ecx
sub dword [esp + 0x14], eax
cmp dword [esp + 0x14], ecx
jae 0x4bf364
mov ebp, dword [esp + 0x14]
mov esi, ebp
mov eax, dword [esp + 0x10]
add eax, dword [esp + 0x30]
sub esi, dword [esp + 0x30]
xor edi, edi
mov dword [esp + 0x30], eax
movzx eax, byte [eax + esi]
mov ecx, dword [esp + 0x24]
xor ecx, eax
mov eax, esi
shr eax, 0x1f
mov edx, ecx
neg edx
neg eax
or edx, ecx
shr eax, 0x1f
mov ecx, dword [ebx + 0x18]
not edx
shr edx, 0x1f
dec eax
and edx, eax
mov eax, dword [esp + 0x30]
add edi, edx
inc ebp
inc esi
cmp ebp, ecx
jb 0x4bf31f
mov esi, dword [esp + 0x2c]
mov ebp, dword [esp + 0x3c]
mov edx, dword [esp + 0x18]
mov dword [esp + 0x28], edi
mov edi, dword [esp + 0x38]
mov eax, dword [esp + 0x28]
xor eax, edx
mov dword [esp + 0x28], eax
neg eax
or eax, dword [esp + 0x28]
not eax
shr eax, 0x1f
and esi, eax
mov eax, esi
mov dword [esp + 0x2c], esi
neg eax
shr eax, 0x1f
neg eax
and edx, eax
mov eax, dword [esp + 0x20]
sub ecx, edx
mov dword [esp + 0x18], edx
mov dword [ebx + 0x18], ecx
test eax, eax
jne 0x4bf67a
sub ecx, dword [edi + 0xc]
lea edx, [esp + 0x1c]
push ecx
push ecx
mov dword [ebx + 0x18], ecx
lea ecx, [esp + 0x54]
push ebx
call fcn.004be85b
mov ecx, dword [ebx + 0x18]
add esp, 0xc
mov edx, dword [esp + 0x18]
add edx, ecx
cmp dword [esp + 0x34], edx
mov dword [esp + 0x18], edx
lea eax, [edx - 0x100]
sbb edx, edx
and edx, eax
lea eax, [esp + 0xac]
push eax
push dword [esp + 0x1c]
mov dword [esp + 0x2c], edx
push edx
push ecx
push dword [esp + 0x20]
lea ecx, [edi + 0x40]
push dword [esp + 0x30]
lea edx, [esp + 0x64]
call fcn.004c7aef
add esp, 0x18
mov dword [esp + 0x28], eax
test eax, eax
je 0x4bf5e3
push eax
push str.mbedtls_ct_hmac
xor edx, edx
mov ecx, ebp
push 0x5bf
push str.srclibmbedtlslibrary_ssl_msg.c
inc edx
call fcn.004c6af7
add esp, 0x10
jmp 0x4bf653
push dword [edi + 0xc]
push edx
push ecx
push str.msglen___zu____max__ivlen__zu___maclen___zu___1______expl_IV__
push 0x4bb
push str.srclibmbedtlslibrary_ssl_msg.c
push 1
push ebp
call fcn.004c6a21
add esp, 0x20
jmp 0x4bf475
mov eax, dword [edi + 4]
cmp eax, dword [edi + 8]
je 0x4bf49a
cmp ecx, 8
jae 0x4bf47f
push 8
push ecx
push str.msglen___zu_____explicit_iv_len___zu_
push 0x43f
push str.srclibmbedtlslibrary_ssl_msg.c
push 1
push ebp
call fcn.004c6a21
add esp, 0x1c
mov eax, 0xffff8e80
jmp 0x4bf6dc
add dword [ebx + 0x14], 8
mov dword [esp + 0x24], edx
add edx, 8
add ecx, 0xfffffff8
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x24]
mov dword [ebx + 0x18], ecx
jmp 0x4bf49c
mov edx, ebx
mov eax, dword [edi + 0x10]
cmp ecx, eax
jae 0x4bf4b1
push eax
push ecx
push str.msglen___zu____taglen___zu_
push 0x453
jmp 0x4bf465
sub ecx, eax
lea eax, [edi + 0x24]
push ecx
push edx
mov dword [ebx + 0x18], ecx
lea ecx, [esp + 0x48]
push dword [edi + 8]
push eax
call fcn.004be8a2
pop ecx
pop ecx
push ebx
lea edx, [esp + 0x28]
lea ecx, [esp + 0x58]
call fcn.004be85b
add esp, 0xc
lea eax, [esp + 0x4c]
mov ecx, ebp
push dword [esp + 0x1c]
push eax
push str.additional_data_used_for_AEAD
push 0x469
push str.srclibmbedtlslibrary_ssl_msg.c
push 4
pop edx
call fcn.004c6b7e
add esp, 0x14
lea eax, [esp + 0x40]
mov ecx, ebp
push dword [edi + 4]
push eax
push str.IV_used
push 0x471
push str.srclibmbedtlslibrary_ssl_msg.c
push 4
pop edx
call fcn.004c6b7e
mov eax, dword [ebx + 0x18]
add esp, 0x14
add eax, dword [esp + 0x10]
mov ecx, ebp
push dword [edi + 0x10]
push eax
push str.TAG_used
push 0x473
push str.srclibmbedtlslibrary_ssl_msg.c
push 4
pop edx
call fcn.004c6b7e
mov ecx, dword [esp + 0x24]
lea eax, [esp + 0x28]
add esp, 0x14
lea edx, [esp + 0x40]
push dword [edi + 0x10]
push eax
mov eax, dword [ebx + 0x10]
add eax, dword [ebx + 0xc]
sub eax, ecx
push eax
mov eax, dword [ebx + 0x18]
add eax, dword [edi + 0x10]
push ecx
push eax
push ecx
push dword [esp + 0x34]
lea eax, [esp + 0x68]
push eax
push dword [edi + 4]
lea ecx, [edi + 0x94]
call fcn.004c906c
add esp, 0x24
mov dword [esp + 0x24], eax
test eax, eax
je 0x4bf5c0
push eax
push str.mbedtls_cipher_auth_decrypt_ext
xor edx, edx
mov ecx, ebp
push 0x47f
push str.srclibmbedtlslibrary_ssl_msg.c
inc edx
call fcn.004c6af7
mov eax, dword [esp + 0x34]
add esp, 0x10
cmp eax, 0xffff9d00
je 0x4bf475
jmp 0x4bf6dc
mov ecx, dword [ebx + 0x18]
xor eax, eax
inc eax
mov dword [esp + 0x20], eax
cmp dword [esp + 0x14], ecx
je 0x4bf397
push str.should_never_happen
push 0x48b
jmp 0x4bf6c7
mov eax, dword [edi + 0xc]
mov dword [esp + 0x30], eax
mov eax, dword [ebx + 0x18]
mov ebx, dword [esp + 0x24]
mov dword [esp + 0x34], eax
cmp ebx, dword [esp + 0x18]
ja 0x4bf631
mov ebp, dword [esp + 0x10]
mov edi, dword [esp + 0x18]
mov esi, dword [esp + 0x30]
push eax
push ebx
push esi
lea edx, [ebx + ebp]
lea ecx, [esp + 0x88]
call fcn.004c7aa7
mov eax, dword [esp + 0x40]
add esp, 0xc
inc ebx
cmp ebx, edi
jbe 0x4bf607
mov esi, dword [esp + 0x2c]
mov edi, dword [esp + 0x38]
mov ebp, dword [esp + 0x3c]
push dword [edi + 0xc]
lea edx, [esp + 0xb0]
lea ecx, [esp + 0x80]
call fcn.004c7901
pop ecx
xor ecx, ecx
test eax, eax
cmovne esi, ecx
inc dword [esp + 0x20]
mov edx, dword [edi + 0xc]
lea ecx, [esp + 0x7c]
call fcn.004c8483
mov edx, dword [edi + 0xc]
lea ecx, [esp + 0xac]
call fcn.004c8483
mov eax, dword [esp + 0x28]
test eax, eax
jne 0x4bf6dc
mov eax, dword [esp + 0x20]
test esi, esi
je 0x4bf475
cmp eax, 1
je 0x4bf693
push str.should_never_happen
push 0x5e9
jmp 0x4bf6c7
push str.__decrypt_buf
push 0x603
push str.srclibmbedtlslibrary_ssl_msg.c
push 2
push ebp
call fcn.004c6a21
add esp, 0x14
xor eax, eax
jmp 0x4bf6dc
push str.should_never_happen
push 0x586
jmp 0x4bf6c7
push str.bad_record_structure_provided_to_decrypt_buf
push 0x3fc
push str.srclibmbedtlslibrary_ssl_msg.c
push 1
push ebp
call fcn.004c6a21
add esp, 0x14
mov eax, 0xffff9400
mov ecx, dword [esp + 0xdc]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0051b034
add esp, 0xd0
ret