//
// ssl3_output_cert_chain from 0xd4e6bc to 0xd4e7b8 (252 bytes)
//
// 3 xrefs:
// > tls_construct_client_certificate @ 0xd4b17c
// > tls_construct_server_certificate @ 0xd53e14
// > ??> @ 0x919f8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall ssl3_output_cert_chain(__int64 a1, __int64 *a2)
{
__int64 v4; // x5
unsigned int v5; // w3
_BYTE *v6; // x4
__int64 v7; // x4
__int64 v8; // [xsp+28h] [xbp+28h] BYREF
v8 = (unsigned int)(*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 108LL) + 3);
if ( !(unsigned int)ssl_add_cert_chain(a1, a2, &v8) )
return 0;
v4 = *(_QWORD *)(*(_QWORD *)(a1 + 120) + 8LL);
v5 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 108LL);
v8 -= v5 + 3;
v6 = (_BYTE *)(v4 + v5);
*v6 = BYTE2(v8);
v6[1] = BYTE1(v8);
v6[2] = v8;
v7 = *(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL);
v8 += 3;
if ( !(*(unsigned int (__fastcall **)(__int64, __int64, __int64))(v7 + 112))(a1, 11, v8) )
{
ERR_put_error(20, 147, 68, "ssl/statem/statem_lib.c", 267);
return 0;
}
return *(unsigned int *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 108LL) + v8;
}