//
// dtls1_buffer_record from 0x99b860 to 0x99ba30 (464 bytes)
//
// 4 xrefs:
// > dtls1_read_bytes @ 0x99bca8
// > dtls1_process_buffered_records @ 0x99ce1c
// > dtls1_get_record @ 0x9a1a60
// > ??> @ 0x73fac
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:06:45 +0000
//
int __fastcall dtls1_buffer_record(_DWORD *a1, int a2, int a3)
{
_DWORD *v7; // r5
int v8; // r0
bool v9; // zf
_DWORD *v10; // r7
int v11; // r8
int v12; // r3
if ( pqueue_size(*(_DWORD *)(a2 + 4)) > 99 )
return 0;
v7 = (_DWORD *)CRYPTO_malloc(76, "ssl/record/rec_layer_d1.c", 153);
v8 = pitem_new(a3, v7);
v9 = v7 == nullptr;
if ( v7 )
v9 = v8 == 0;
v10 = (_DWORD *)v8;
v11 = v9;
if ( v9 )
{
CRYPTO_free(v7, "ssl/record/rec_layer_d1.c", 156);
pitem_free(v10);
ERR_put_error(20, 247, 68, "ssl/record/rec_layer_d1.c", 158);
return -1;
}
else
{
v12 = a1[694];
*v7 = a1[693];
v7[1] = v12;
memcpy(v7 + 2, a1 + 144, 0x14u);
memcpy(v7 + 7, a1 + 309, 0x30u);
v10[2] = v7;
a1[693] = v11;
a1[694] = v11;
memset(a1 + 144, v11, 0x14u);
memset(a1 + 309, v11, 0x600u);
if ( ssl3_setup_buffers(a1) )
{
if ( pqueue_insert(*(_DWORD *)(a2 + 4), v10) )
{
return 1;
}
else
{
ERR_put_error(20, 247, 68, "ssl/record/rec_layer_d1.c", 194);
CRYPTO_free(v7[2], "ssl/record/rec_layer_d1.c", 195);
CRYPTO_free(v7, "ssl/record/rec_layer_d1.c", 196);
pitem_free(v10);
return -1;
}
}
else
{
ERR_put_error(20, 247, 68, "ssl/record/rec_layer_d1.c", 185);
CRYPTO_free(v7[2], "ssl/record/rec_layer_d1.c", 186);
CRYPTO_free(v7, "ssl/record/rec_layer_d1.c", 187);
pitem_free(v10);
return -1;
}
}
}