//
// dtls1_buffer_record from 0xd30540 to 0xd30728 (488 bytes)
//
// 4 xrefs:
// > dtls1_read_bytes @ 0xd309ec
// > dtls1_process_buffered_records @ 0xd31a4c
// > dtls1_get_record @ 0xd36220
// > ??> @ 0x4ae20
//
// 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 dtls1_buffer_record(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v6; // w21
__int64 v8; // x19
_QWORD *v9; // x24
int v10; // w0
__int64 v11; // x7
__int64 v12; // x7
__int64 v13; // x7
__int64 v14; // x7
__int64 v15; // x7
__int64 v16; // x7
v6 = 0;
if ( (int)pqueue_size(*(_QWORD *)(a2 + 8)) <= 99 )
{
v8 = CRYPTO_malloc(120, "ssl/record/rec_layer_d1.c", 153);
v9 = (_QWORD *)pitem_new(a3, v8);
if ( v9 && v8 )
{
v10 = *(_DWORD *)(a1 + 4320);
*(_QWORD *)v8 = *(_QWORD *)(a1 + 4312);
*(_DWORD *)(v8 + 8) = v10;
v11 = *(_QWORD *)(a1 + 960);
*(_QWORD *)(v8 + 16) = *(_QWORD *)(a1 + 952);
*(_QWORD *)(v8 + 24) = v11;
v12 = *(_QWORD *)(a1 + 976);
*(_QWORD *)(v8 + 32) = *(_QWORD *)(a1 + 968);
*(_QWORD *)(v8 + 40) = v12;
v13 = *(_QWORD *)(a1 + 2016);
*(_QWORD *)(v8 + 48) = *(_QWORD *)(a1 + 2008);
*(_QWORD *)(v8 + 56) = v13;
v14 = *(_QWORD *)(a1 + 2032);
*(_QWORD *)(v8 + 64) = *(_QWORD *)(a1 + 2024);
*(_QWORD *)(v8 + 72) = v14;
v15 = *(_QWORD *)(a1 + 2048);
*(_QWORD *)(v8 + 80) = *(_QWORD *)(a1 + 2040);
*(_QWORD *)(v8 + 88) = v15;
v16 = *(_QWORD *)(a1 + 2064);
*(_QWORD *)(v8 + 96) = *(_QWORD *)(a1 + 2056);
*(_QWORD *)(v8 + 104) = v16;
*(_QWORD *)(v8 + 112) = *(_QWORD *)(a1 + 2072);
v9[1] = v8;
*(_QWORD *)(a1 + 4312) = 0;
*(_DWORD *)(a1 + 4320) = 0;
*(_QWORD *)(a1 + 952) = 0;
*(_QWORD *)(a1 + 960) = 0;
*(_QWORD *)(a1 + 968) = 0;
*(_QWORD *)(a1 + 976) = 0;
memset((void *)(a1 + 2008), 0, 0x900u);
if ( (unsigned int)ssl3_setup_buffers(a1) )
{
v6 = 1;
if ( !pqueue_insert(*(_QWORD *)(a2 + 8), v9) )
{
v6 = -1;
ERR_put_error(20, 247, 68, "ssl/record/rec_layer_d1.c", 194);
CRYPTO_free(*(_QWORD *)(v8 + 16), "ssl/record/rec_layer_d1.c", 195);
CRYPTO_free(v8, "ssl/record/rec_layer_d1.c", 196);
pitem_free(v9);
}
}
else
{
v6 = -1;
ERR_put_error(20, 247, 68, "ssl/record/rec_layer_d1.c", 185);
CRYPTO_free(*(_QWORD *)(v8 + 16), "ssl/record/rec_layer_d1.c", 186);
CRYPTO_free(v8, "ssl/record/rec_layer_d1.c", 187);
pitem_free(v9);
}
}
else
{
v6 = -1;
CRYPTO_free(v8, "ssl/record/rec_layer_d1.c", 156);
pitem_free(v9);
ERR_put_error(20, 247, 68, "ssl/record/rec_layer_d1.c", 158);
}
}
return v6;
}