//
// ssl_cert_set0_chain from 0xd3a3a4 to 0xd3a4a0 (252 bytes)
//
// 5 xrefs:
// > ssl3_ctrl @ 0xd38fb4
// > ssl3_ctx_ctrl @ 0xd395b0
// > ssl_cert_set1_chain @ 0xd3a4d8
// > ssl_cert_set1_chain @ 0xd3a544
// > ??> @ 0x318d8
//
// 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 ssl_cert_set0_chain(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // x23
int v7; // w19
__int64 v8; // x0
unsigned int v9; // w0
bool v10; // cc
__int64 v11; // x1
if ( a1 )
{
v3 = **(_QWORD **)(a1 + 328);
if ( v3 )
goto LABEL_3;
return (unsigned int)v3;
}
v3 = **(_QWORD **)(a2 + 288);
if ( !v3 )
return (unsigned int)v3;
LABEL_3:
v7 = 0;
do
{
v10 = v7 < (int)OPENSSL_sk_num(a3);
v11 = (unsigned int)v7++;
if ( !v10 )
{
OPENSSL_sk_pop_free(*(_QWORD *)(v3 + 16), X509_free);
*(_QWORD *)(v3 + 16) = a3;
return 1;
}
v8 = OPENSSL_sk_value(a3, v11);
v9 = ssl_security_cert(a1, a2, v8, 0, 0);
}
while ( v9 == 1 );
ERR_put_error(20, 340, v9, "ssl/ssl_cert.c", 273);
return 0;
}