//
// sub_790AE0 from 0x790ae0 to 0x790be0 (256 bytes)
//
// 2 xrefs:
// > ssl_add_cert_chain @ 0x792364
// > ssl_add_cert_chain @ 0x79238c
//
// 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
//
int __fastcall sub_790AE0(int a1, _DWORD *a2, int a3)
{
int v6; // r4
int v8; // r2
_BYTE *v9; // [sp+Ch] [bp-8h] BYREF
v6 = i2d_X509(a3, 0);
if ( v6 >= 0 && BUF_MEM_grow_clean(a1, *a2 + 3 + v6) )
{
v9 = (_BYTE *)(*(_DWORD *)(a1 + 4) + *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 += 3 + v8;
return 1;
}
}
else
{
ERR_put_error(20, 319, 7, "ssl/ssl_cert.c", 752);
return 0;
}
}