Function at 0x10021240
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0xc
push ebx
push ebp
mov ebp, dword [esp + 0x1c]
push esi
push edi
push eax
mov ebx, ecx
call fcn.10008790
mov ecx, dword [esp + 0x30]
mov esi, eax
mov eax, dword [esi]
mov edi, ebx
sub edi, eax
lea edx, [eax + ecx + 2]
add esp, 4
dec edi
cmp ebx, edx
jb 0x10021463
cmp byte [ebx + ebp - 1], 0xbc
jne 0x10021463
test byte [ebp], 0x80
jne 0x10021463
push edi
call sub.nss3.dll_PORT_Alloc_Util
mov ebx, eax
add esp, 4
test ebx, ebx
jne 0x100212ab
push 0xffffe013
call sub.nss3.dll_PORT_SetError_Util
add esp, 4
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret
mov ecx, dword [esi]
push ecx
lea eax, [edi + ebp]
push eax
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x30]
push edi
push ebx
call fcn.10020510
xor eax, eax
add esp, 0x10
mov dword [esp + 0x10], eax
test edi, edi
je 0x100212e3
mov edi, edi
mov dl, byte [eax + ebp]
xor byte [eax + ebx], dl
mov eax, dword [esp + 0x10]
inc eax
mov dword [esp + 0x10], eax
cmp eax, edi
jb 0x100212d0
mov edx, dword [esp + 0x2c]
and byte [ebx], 0x7f
mov eax, edi
xor ecx, ecx
sub eax, edx
dec eax
mov dword [esp + 0x10], ecx
je 0x10021306
cmp byte [ecx + ebx], 0
jne 0x10021345
inc ecx
mov dword [esp + 0x10], ecx
cmp ecx, eax
jb 0x100212f7
mov eax, ebx
sub eax, edx
add edi, eax
cmp byte [edi - 1], 1
mov dword [esp + 0x14], edi
jne 0x10021345
mov ecx, dword [esi]
push ecx
call sub.nss3.dll_PORT_Alloc_Util
mov ebp, eax
add esp, 4
test ebp, ebp
jne 0x10021363
push ebx
call sub.nss3.dll_PORT_Free_Util
push 0xffffe013
call sub.nss3.dll_PORT_SetError_Util
add esp, 8
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret
push ebx
call sub.nss3.dll_PORT_Free_Util
push 0xffffe00a
call sub.nss3.dll_PORT_SetError_Util
add esp, 8
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret
mov edx, dword [esi + 4]
call edx
mov edi, eax
test edi, edi
jne 0x10021392
push ebx
call sub.nss3.dll_PORT_Free_Util
push ebp
call sub.nss3.dll_PORT_Free_Util
push 0xffffe013
call sub.nss3.dll_PORT_SetError_Util
add esp, 0xc
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret
mov eax, dword [esi + 0x10]
push edi
call eax
mov ecx, dword [esi + 0x14]
push 8
push 0x10044b60
push edi
call ecx
mov edx, dword [esi]
mov eax, dword [esp + 0x30]
mov ecx, dword [esi + 0x14]
push edx
push eax
push edi
call ecx
mov edx, dword [esp + 0x48]
mov eax, dword [esp + 0x30]
mov ecx, dword [esi + 0x14]
push edx
push eax
push edi
call ecx
mov edx, dword [esi]
mov ecx, dword [esi + 0x18]
push edx
lea eax, [esp + 0x3c]
push eax
push ebp
push edi
call ecx
mov edx, dword [esi + 0xc]
push 1
push edi
call edx
add esp, 0x40
push ebx
call sub.nss3.dll_PORT_Free_Util
mov esi, dword [esi]
mov eax, dword [esp + 0x1c]
add esp, 4
mov ecx, ebp
cmp esi, 4
jb 0x10021407
mov edx, dword [ecx]
cmp edx, dword [eax]
jne 0x1002142b
sub esi, 4
add eax, 4
add ecx, 4
cmp esi, 4
jae 0x100213f3
test esi, esi
je 0x1002144e
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x1002142b
cmp esi, 1
jbe 0x1002144e
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x1002142b
cmp esi, 2
jbe 0x1002144e
mov al, byte [eax + 2]
cmp al, byte [ecx + 2]
je 0x1002144e
push 0xffffe00a
call sub.nss3.dll_PORT_SetError_Util
add esp, 4
push ebp
or esi, 0xffffffff
call sub.nss3.dll_PORT_Free_Util
add esp, 4
pop edi
mov eax, esi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
push ebp
xor esi, esi
call sub.nss3.dll_PORT_Free_Util
add esp, 4
pop edi
mov eax, esi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
push 0xffffe00a
call sub.nss3.dll_PORT_SetError_Util
add esp, 4
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret