//
// ssl_add_clienthello_use_srtp_ext from 0xd5e20c to 0xd5e368 (348 bytes)
//
// 3 xrefs:
// > ssl_add_clienthello_tlsext @ 0xd58dcc
// > ssl_add_clienthello_tlsext @ 0xd58e40
// > ??> @ 0xbb0b0
//
// 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 ssl_add_clienthello_use_srtp_ext(__int64 a1, _BYTE *a2, _DWORD *a3, int a4)
{
__int64 srtp_profiles; // x22
int v6; // w0
int v7; // w21
int v8; // w23
_BYTE *v9; // x24
_BYTE *v10; // x20
unsigned int v11; // w19
__int64 v12; // x1
__int64 v13; // x0
srtp_profiles = SSL_get_srtp_profiles(a1);
v6 = OPENSSL_sk_num(srtp_profiles);
v7 = v6;
if ( !a2 )
{
v8 = 2 * (v6 + 1);
LABEL_9:
*a3 = v8 + 1;
return 0;
}
if ( v6 )
{
v8 = 2 * (v6 + 1);
if ( v8 < a4 )
{
a2[1] = 2 * v6;
*a2 = (unsigned __int16)(v8 - 2) >> 8;
v9 = a2 + 2;
if ( v6 > 0 )
{
v10 = a2 + 2;
v11 = 0;
do
{
v12 = v11;
v10 += 2;
++v11;
v13 = OPENSSL_sk_value(srtp_profiles, v12);
*(v10 - 2) = BYTE1(*(_QWORD *)(v13 + 8));
*(v10 - 1) = *(_QWORD *)(v13 + 8);
}
while ( v11 != v7 );
v9 += 2 * v11;
}
*v9 = 0;
goto LABEL_9;
}
ERR_put_error(20, 307, 363, "ssl/d1_srtp.c", 162);
return 1;
}
else
{
ERR_put_error(20, 307, 354, "ssl/d1_srtp.c", 156);
return 1;
}
}