//
// ssl3_setup_write_buffer from 0xfb1fd0 to 0xfb20fc (300 bytes)
//
// 3 xrefs:
// > do_ssl3_write @ 0xfb0a20
// > ssl3_setup_buffers @ 0xfb2120
// > ??> @ 0xa1d10
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:12 +0000
//
__int64 __fastcall ssl3_setup_write_buffer(__int64 a1, int a2, __int64 a3)
{
__int64 v5; // x22
__int64 v6; // x20
__int64 v7; // x22
__int64 v8; // x19
__int64 v9; // x19
__int64 v10; // x20
__int64 *v11; // x19
int v12; // w20
__int64 v13; // x0
*(_DWORD *)(a1 + 948) = a2;
v5 = a3;
if ( !a3 )
{
v6 = 88;
v7 = 5;
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) != 0 )
{
v6 = 97;
v7 = 14;
}
v8 = v7 + (unsigned int)(*(_DWORD *)(a1 + 524) + 80);
v5 = v8 + 3;
v9 = v8 + 1027;
if ( (unsigned int)ssl_allow_compression() )
v5 = v9;
v10 = v5 + v6;
if ( (*(_DWORD *)(a1 + 484) & 0x800) == 0 )
v5 = v10;
}
v11 = (__int64 *)(a1 + 984);
v12 = 0;
if ( !a2 )
return 1;
while ( 1 )
{
while ( *v11 )
{
++v12;
v11 += 4;
if ( v12 == a2 )
return 1;
}
v13 = CRYPTO_malloc(v5, "ssl/record/ssl3_buffer.c", 109);
if ( !v13 )
break;
++v12;
*v11 = v13;
v11[2] = v5;
v11 += 4;
if ( v12 == a2 )
return 1;
}
*(_DWORD *)(a1 + 948) = v12;
ERR_put_error(20, 291, 65, "ssl/record/ssl3_buffer.c", 121);
return 0;
}