Function at 0x40830c
Capabilities:
Get remote cert context via schannel

Disassembly:
mov qword [rsp + 0x10], rbx
mov qword [rsp + 0x18], r8
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x4230]
mov eax, 0x4330
call fcn.00422ec0
sub rsp, rax
mov rax, qword [rcx + 0xbe0]
lea r12, [rcx + 0xb98]
mov qword [rbp - 0x60], rax
xor r15d, r15d
mov eax, dword [rcx + 0xbe8]
mov rdi, rcx
mov dword [rbp - 0x68], eax
mov rcx, r12
lea rax, [rbp - 0x68]
mov dword [rbp - 0x64], 2
mov qword [rbp - 0x30], rax
mov r14, r8
lea rax, [rbp + 0x230]
mov qword [rbp - 0x58], r15
mov qword [rbp - 0x70], rax
mov r13, rdx
lea rax, [rbp - 0x78]
mov qword [rbp - 0x50], r15
mov qword [rbp - 0x40], rax
mov dword [rbp - 0x34], 2
mov dword [rbp - 0x38], r15d
mov dword [rbp - 0x74], 2
mov dword [rbp - 0x78], 0x4000
mov dword [rbp - 0x44], 1
mov dword [rbp - 0x48], r15d
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov qword [rsp + 0x58], r15
lea rax, [rbp + 0x4270]
mov qword [rsp + 0x50], rax
lea rsi, [rdi + 0xbc0]
lea rax, [rbp - 0x48]
mov r9d, 0x809c
mov qword [rsp + 0x48], rax
lea rcx, [rdi + 0xbd0]
mov qword [rsp + 0x40], r15
lea rax, [rbp - 0x38]
mov dword [rsp + 0x38], r15d
xor r8d, r8d
mov qword [rsp + 0x30], rax
mov rdx, rsi
mov dword [rsp + 0x28], r15d
mov dword [rsp + 0x20], r15d
call qword [sym.imp.Secur32.dll_InitializeSecurityContextW]
mov rcx, r12
mov ebx, eax
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
test ebx, ebx
je 0x4084bc
cmp ebx, 0x90312
je 0x4084bc
cmp ebx, 0x80090318
je 0x408a6e
add rdi, 0x22c
cmp ebx, 0x80090308
mov ebx, 0xff
jne 0x408483
lea rcx, str.tls___invalid_token
sub rcx, rdi
lea rax, [rbx + 0x7ffffeff]
test rax, rax
je 0x40854c
movzx eax, word [rcx + rdi]
test ax, ax
je 0x40854c
mov word [rdi], ax
add rdi, 2
sub rbx, 1
jne 0x408454
jmp 0x40854c
lea rcx, str.tls___handshake_failed
sub rcx, rdi
lea rax, [rbx + 0x7ffffeff]
test rax, rax
je 0x40854c
movzx eax, word [rcx + rdi]
test ax, ax
je 0x40854c
mov word [rdi], ax
add rdi, 2
sub rbx, 1
jne 0x40848d
jmp 0x40854c
cmp dword [rbp - 0x54], 5
jne 0x4084ea
mov eax, dword [rbp - 0x58]
test eax, eax
je 0x4084ea
mov rcx, qword [rdi + 0xbe0]
mov r8d, eax
mov rdx, rcx
sub rdx, rax
add rdx, qword [rdi + 0xbe8]
call fcn.00424180
mov eax, dword [rbp - 0x58]
jmp 0x4084ed
mov rax, r15
mov qword [rdi + 0xbe8], rax
mov eax, dword [rbp - 0x78]
test eax, eax
je 0x408562
mov r8d, eax
lea rdx, [rbp + 0x230]
xor r9d, r9d
mov rcx, rdi
call fcn.00407ffc
test al, al
jne 0x408562
add rdi, 0x22c
lea rcx, str.tls___handshake_send_failed
sub rcx, rdi
mov ebx, 0xff
lea rax, [rbx + 0x7ffffeff]
test rax, rax
je 0x40854c
movzx eax, word [rcx + rdi]
test ax, ax
je 0x40854c
mov word [rdi], ax
add rdi, 2
sub rbx, 1
jne 0x40852a
test rbx, rbx
lea rax, [rdi - 2]
cmovne rax, rdi
mov word [rax], r15w
xor al, al
jmp 0x408a70
test ebx, ebx
jne 0x408a6e
xorps xmm0, xmm0
xor eax, eax
mov rcx, r12
mov dword [rbp - 0x80], eax
movups xmmword [rsp + 0x70], xmm0
call qword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea r8, [rsp + 0x70]
mov rcx, rsi
lea edx, [rbx + 4]
call qword [sym.imp.Secur32.dll_QueryContextAttributesW]
test eax, eax
jne 0x408a8b
cmp dword [rsp + 0x78], r15d
je 0x408a8b
cmp dword [rsp + 0x7c], 4
ja 0x408a8b
lea r15, [rdi + 0x470]
xor edx, edx
mov rcx, r15
mov r8d, 0x720
call fcn.00424830
cmp byte [rdi + 0xb90], 0
mov ebx, 0xff
je 0x4088ec
xor r14d, r14d
lea r8, [rsp + 0x68]
mov rcx, rsi
mov qword [rsp + 0x68], r14
lea edx, [r14 + 0x53]
call qword [sym.imp.Secur32.dll_QueryContextAttributesW]
test eax, eax
jne 0x408895
mov rsi, qword [rsp + 0x68]
test rsi, rsi
je 0x408895
test r13, r13
je 0x408836
xor edx, edx
mov r8d, 0x720
mov rcx, r15
call fcn.00424830
cmp byte [rdi + 0xb90], r14b
jne 0x408632
mov r14b, 1
jmp 0x408836
xor edx, edx
lea rcx, [rbp + 0x40]
lea r8d, [rdx + 0x50]
call fcn.00424830
and qword [rsp + 0x60], r14
lea rax, [rsi + 0x20]
mov dword [rbp + 0x40], 0x50
mov dword [rbp + 0x70], 1
cmp qword [rax], r14
je 0x408668
mov dword [rbp + 0x60], 1
mov qword [rbp + 0x68], rax
lea rdx, [rsp + 0x60]
lea rcx, [rbp + 0x40]
call qword [sym.imp.CRYPT32.dll_CertCreateCertificateChainEngine]
xor edx, edx
test eax, eax
je 0x408812
mov rcx, qword [rsp + 0x60]
test rcx, rcx
je 0x408812
lea rax, str.1.3.6.1.5.5.7.3.1
mov qword [rbp + 0x4288], rdx
mov qword [rbp], rax
xor r9d, r9d
lea rax, [rbp + 0x4288]
mov qword [rbp - 0x18], 0x20
mov qword [rsp + 0x38], rax
xor r8d, r8d
mov qword [rsp + 0x30], rdx
lea rax, [rbp - 0x18]
mov dword [rsp + 0x28], edx
mov rdx, rsi
mov qword [rbp - 0x10], 1
mov qword [rbp - 8], 1
mov qword [rsp + 0x20], rax
call qword [sym.imp.CRYPT32.dll_CertGetCertificateChain]
xor esi, esi
test eax, eax
je 0x4087e6
xor eax, eax
mov qword [rbp + 0x10], rsi
lea edx, [rsi + 0x18]
mov qword [rbp + 0x30], rax
xorps xmm0, xmm0
mov dword [rbp + 8], edx
movups xmmword [rbp + 0x20], xmm0
lea rax, [rbp + 8]
mov dword [rbp + 0x20], edx
mov rdx, qword [rbp + 0x4288]
lea r9, [rbp + 0x20]
lea r8, [rbp - 0x28]
mov qword [rbp - 0x20], rax
lea ecx, [rsi + 4]
mov qword [rbp - 0x28], select
mov dword [rbp + 0xc], 2
mov qword [rbp + 0x18], r13
call qword [sym.imp.CRYPT32.dll_CertVerifyCertificateChainPolicy]
test eax, eax
je 0x4087b8
mov r9d, dword [rbp + 0x24]
test r9d, r9d
je 0x408772
lea eax, [r9 + 0x7ff4feff]
cmp eax, 0xe
ja 0x408760
mov ecx, 0x4101
bt ecx, eax
jb 0x408772
cmp r9d, 0x80096004
je 0x408772
lea r8, str.tls___certificate_error__0x_0X
jmp 0x4087c8
mov rax, qword [rbp + 0x4288]
mov r14b, 1
cmp dword [rax + 0xc], esi
jbe 0x4087d7
mov rcx, qword [rax + 0x10]
test rcx, rcx
je 0x4087d7
mov rdx, qword [rcx]
mov r8d, dword [rdx + 0xc]
test r8d, r8d
je 0x4087d7
mov rdx, qword [rdx + 0x10]
mov rcx, rdi
call fcn.004081a0
test al, al
jne 0x4087d7
xor edx, edx
mov r8d, 0x720
mov rcx, r15
call fcn.00424830
jmp 0x4087d7
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r9d, eax
lea r8, str.tls___certificate_chain_policy_failed__0x_0X
mov rdx, rbx
lea rcx, [rdi + 0x22c]
call fcn.0040457c
mov rcx, qword [rbp + 0x4288]
call qword [sym.imp.CRYPT32.dll_CertFreeCertificateChain]
jmp 0x408805
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, [rdi + 0x22c]
mov rdx, rbx
mov r9d, eax
lea r8, str.tls___get_certificate_chain_failed__0x_0X
call fcn.0040457c
mov rcx, qword [rsp + 0x60]
call qword [sym.imp.CRYPT32.dll_CertFreeCertificateChainEngine]
jmp 0x408831
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, [rdi + 0x22c]
mov rdx, rbx
mov r9d, eax
lea r8, str.tls___create_certificate_chain_engine_failed__0x_0X
call fcn.0040457c
mov rsi, qword [rsp + 0x68]
mov rcx, rsi
call qword [sym.imp.CRYPT32.dll_CertFreeCertificateContext]
xor r15d, r15d
test r14b, r14b
jne 0x4088dc
add rdi, 0x22c
cmp word [rdi], r15w
jne 0x408ad2
lea rdx, str.tls___handshake_validation_failed
sub rdx, rdi
lea rax, [rbx + 0x7ffffeff]
test rax, rax
je 0x408ac3
movzx eax, word [rdx + rdi]
test ax, ax
je 0x408ac3
mov word [rdi], ax
add rdi, 2
sub rbx, 1
jne 0x408866
jmp 0x408ac3
add rdi, 0x22c
lea rcx, str.tls___handshake_certificate_context_failed
sub rcx, rdi
lea rax, [rbx + 0x7ffffeff]
test rax, rax
je 0x4088c8
movzx eax, word [rcx + rdi]
test ax, ax
je 0x4088c8
mov word [rdi], ax
add rdi, 2
sub rbx, 1
jne 0x4088a6
test rbx, rbx
lea rax, [rdi - 2]
cmovne rax, rdi
mov word [rax], r14w
jmp 0x408ad2
mov r14, qword [rbp + 0x4280]
lea rsi, [rdi + 0xbc0]
jmp 0x4088ef
xor r15d, r15d
xor edx, edx
lea rcx, [rbp + 0x90]
mov r8d, 0x194
call fcn.00424830
lea r8, [rbp + 0x90]
mov edx, WSAGetLastError
mov rcx, rsi
call qword [sym.imp.Secur32.dll_QueryContextAttributesW]
test eax, eax
jne 0x408a43
mov r9d, dword [rbp + 0x94]
lea rsi, [rdi + 0x990]
mov eax, 0x1000
mov word [rsi], r15w
mov dword [rdi + 0x98c], r9d
cmp r9d, eax
ja 0x408999
je 0x4089fb
mov eax, r9d
sub eax, 0x40
je 0x408990
sub eax, 0x40
je 0x408990
sub eax, 0x40
je 0x408990
sub eax, 0x40
je 0x408987
mov ecx, 0x100
sub eax, ecx
je 0x408987
sub eax, ecx
je 0x408987
sub eax, ecx
je 0x40897e
mov ecx, 0x400
sub eax, ecx
je 0x40897e
cmp eax, ecx
jne 0x4089e7
lea r8, str.TLS_v1.2
jmp 0x408a02
lea r8, str.TLS_v1.1
jmp 0x408a02
lea r8, str.TLS_v1.0
jmp 0x408a02
lea eax, [r9 - 0x2000]
test eax, 0xffffefff
je 0x4089fb
lea eax, [r9 - 0x10000]
test eax, 0xfffcffff
jne 0x4089c7
cmp r9d, 0x40000
je 0x4089c7
lea r8, str.DTLS_v1.0
jmp 0x408a02
lea eax, [r9 - 0x40000]
test eax, 0xfff3ffff
jne 0x4089e7
cmp r9d, 0x100000
je 0x4089e7
lea r8, str.DTLS_v1.2
jmp 0x408a02
lea r8, [0x0048f8a8]
mov rdx, rbx
mov rcx, rsi
call fcn.0040457c
jmp 0x408a0d
lea r8, str.TLS_v1.3
mov rdx, rbx
mov rcx, rsi
call fcn.004044ac
lea r8, [rbp + 0x98]
mov rdx, rbx
mov rcx, rsi
call fcn.004044ac
lea r8, [0x0048f8b0]
mov rdx, rbx
mov rcx, rsi
call fcn.004044ac
lea r8, [rbp + 0x1a0]
mov rdx, rbx
mov rcx, rsi
call fcn.004044ac
mov eax, dword [rsp + 0x70]
mov rcx, r12
mov dword [rdi + 0xc08], eax
mov eax, dword [rsp + 0x74]
mov dword [rdi + 0xc0c], eax
mov eax, dword [rsp + 0x78]
mov dword [rdi + 0xc10], eax
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov byte [r14], 1
mov al, 1
mov rbx, qword [rsp + 0x4378]
add rsp, 0x4330
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret
add rdi, 0x22c
lea rcx, str.tls___handshake_stream_size_failed
sub rcx, rdi
mov ebx, 0xff
lea rax, [rbx + 0x7ffffeff]
test rax, rax
je 0x408ac3
movzx eax, word [rcx + rdi]
test ax, ax
je 0x408ac3
mov word [rdi], ax
add rdi, 2
sub rbx, 1
jne 0x408aa1
test rbx, rbx
lea rax, [rdi - 2]
cmovne rax, rdi
mov word [rax], r15w
mov rcx, r12
call qword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
jmp 0x40855b