//
// sub_D39CDC from 0xd39cdc to 0xd39de8 (268 bytes)
//
// 2 xrefs:
// > ssl_add_cert_chain @ 0xd3b484
// > ssl_add_cert_chain @ 0xd3b4a0
//
// 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 sub_D39CDC(__int64 a1, _QWORD *a2, __int64 a3)
{
int v6; // w19
int v8; // w0
_BYTE *v9; // [xsp+38h] [xbp+38h] BYREF
v6 = i2d_X509(a3, 0);
if ( (v6 & 0x80000000) == 0 && BUF_MEM_grow_clean(a1, (int)(*a2 + 3 + v6)) )
{
v9 = (_BYTE *)(*(_QWORD *)(a1 + 8) + *a2);
*v9 = BYTE2(v6);
v9[1] = BYTE1(v6);
v9[2] = v6;
v9 += 3;
v8 = i2d_X509(a3, &v9);
if ( v8 < 0 )
{
ERR_put_error(20, 319, 7, "ssl/ssl_cert.c", 760);
return 0;
}
else
{
*a2 += v8 + 3;
return 1;
}
}
else
{
ERR_put_error(20, 319, 7, "ssl/ssl_cert.c", 752);
return 0;
}
}