Function at 0x486652
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push ebx
mov eax, 0x11e4
call fcn.004d7290
sub esp, eax
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x1c], 0xffffffff
mov dword [esp + 4], 0x501887
mov eax, dword [ebp + 8]
mov dword [esp], eax
call sym._fopen
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
jne 0x4866e6
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
call sym._strerror
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.opening_input_file:__s
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x29
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 7
mov dword [esp + 4], 1
lea eax, [ebp - 0x11bc]
mov dword [esp], eax
call sym._fread
mov dword [ebp - 0x24], eax
cmp dword [ebp - 0x24], 6
jg 0x48673d
mov dword [esp + 0xc], str.Invalid_input_file__reading_magic_number_.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x30
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov dword [esp + 8], 7
mov dword [esp + 4], str.WPK256
lea eax, [ebp - 0x11bc]
mov dword [esp], eax
call sym._memcmp
test eax, eax
je 0x486788
mov dword [esp + 0xc], str.Invalid_input_file__bad_magic_number_.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x35
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call dbg.w_wpk_cert
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
jne 0x4867cc
mov eax, dword [ebp + 8]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.Couldnt_extract_certificate_at_file__s.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x3c
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
cmp dword [ebp + 0x10], 0
je 0x486811
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call dbg.wpk_verify_cert
test eax, eax
jns 0x48683c
mov dword [esp + 0xc], str.Error_verifying_WPK_certificate.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x44
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp + 8]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.No_root_CA_defined_to_verify_file__s.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x48
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._mwarn
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x100
mov dword [esp + 4], 1
lea eax, [ebp - 0x19c]
mov dword [esp], eax
call sym._fread
mov dword [ebp - 0x24], eax
cmp dword [ebp - 0x24], 0xff
jg 0x486896
mov dword [esp + 0xc], str.Invalid_input_file__reading_signature_.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x4e
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call sym._ftell
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0x28]
shr eax, 0x1f
and eax, 1
test al, al
je 0x486905
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
call sym._strerror
mov ebx, eax
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp + 0x18], ebx
mov dword [esp + 0x14], eax
mov eax, dword [ebp + 8]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str._1139_:_Could_not_get_position_from_file__s_due_to____d____s__.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x55
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
lea eax, [ebp - 0x9c]
mov dword [esp], eax
call sym._SHA256_Init
jmp 0x486934
mov eax, dword [ebp - 0x24]
mov dword [esp + 8], eax
lea eax, [ebp - 0x11bc]
mov dword [esp + 4], eax
lea eax, [ebp - 0x9c]
mov dword [esp], eax
call sym._SHA256_Update
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1000
mov dword [esp + 4], 1
lea eax, [ebp - 0x11bc]
mov dword [esp], eax
call sym._fread
mov dword [ebp - 0x24], eax
cmp dword [ebp - 0x24], 0
jg 0x486915
cmp dword [ebp - 0x24], 0
jns 0x486991
mov dword [esp + 0xc], str.Invalid_input_file__reading_content_.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x60
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
lea eax, [ebp - 0x9c]
mov dword [esp + 4], eax
lea eax, [ebp - 0x1bc]
mov dword [esp], eax
call sym._SHA256_Final
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sym._X509_get_pubkey
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0
jne 0x4869e6
mov dword [esp + 0xc], str.Couldnt_get_public_key_from_certificate.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x69
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._EVP_PKEY_get1_RSA
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
jne 0x486a23
mov dword [esp + 0xc], str.Couldnt_get_public_RSA_key_from_certificate.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x6e
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x14]
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], 0x100
lea eax, [ebp - 0x19c]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x20
lea eax, [ebp - 0x1bc]
mov dword [esp + 4], eax
mov dword [esp], 0x2a0
call sym._RSA_verify
cmp eax, 1
je 0x486b01
mov dword [esp + 8], 0
mov dword [esp], 2
mov dword [esp + 4], 0
call sym._OPENSSL_init_crypto
jmp 0x486aee
mov eax, dword [ebp - 0x2c]
and eax, 0xfff
cmp eax, 0x68
jne 0x486ab4
mov dword [esp + 0xc], str.Bad_WPK_signature.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x78
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486aee
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sym._ERR_reason_error_string
mov edx, dword [ebp - 0x2c]
mov dword [esp + 0x14], edx
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.At_RSA_verify__:__s___lu_
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x7c
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
call sym._ERR_get_error
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0
jne 0x486a81
jmp 0x486c89
mov dword [esp + 4], 0x501aab
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call sym._fopen
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jne 0x486b5b
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
call sym._strerror
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.Opening_output_file:__s
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x86
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov dword [esp + 8], 0
mov eax, dword [ebp - 0x28]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call sym._fseek
test eax, eax
jns 0x486c24
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp], eax
call sym._strerror
mov ebx, eax
mov eax, dword [sym.imp.msvcrt.dll__errno]
call eax
mov eax, dword [eax]
mov dword [esp + 0x18], ebx
mov dword [esp + 0x14], eax
mov eax, dword [ebp + 8]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0x501ac8
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x8b
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x24]
mov edx, dword [ebp - 0x18]
mov dword [esp + 0xc], edx
mov dword [esp + 8], eax
mov dword [esp + 4], 1
lea eax, [ebp - 0x11bc]
mov dword [esp], eax
call sym._fwrite
mov edx, eax
mov eax, dword [ebp - 0x24]
cmp edx, eax
je 0x486c24
mov dword [esp + 0xc], str.writing_output_file.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x91
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0x1000
mov dword [esp + 4], 1
lea eax, [ebp - 0x11bc]
mov dword [esp], eax
call sym._fread
mov dword [ebp - 0x24], eax
cmp dword [ebp - 0x24], 0
jg 0x486bd1
cmp dword [ebp - 0x24], 0
jns 0x486c82
mov dword [esp + 0xc], str.Invalid_input_file__writing_output_.
mov dword [esp + 8], str.w_wpk_unsign
mov dword [esp + 4], 0x97
mov dword [esp], str.os_crypto_signature_signature.c
call dbg._merror
jmp 0x486c89
mov dword [ebp - 0x1c], 0
cmp dword [ebp - 0x20], 0
je 0x486c9a
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call sym._fclose
cmp dword [ebp - 0x18], 0
je 0x486cab
mov eax, dword [ebp - 0x18]
mov dword [esp], eax
call sym._fclose
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sym._X509_free
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sym._EVP_PKEY_free
mov eax, dword [ebp - 0x14]
mov dword [esp], eax
call sym._RSA_free
mov eax, dword [ebp - 0x1c]
mov ebx, dword [ebp - 4]
leave
ret