//
// ssl_add_clienthello_use_srtp_ext from 0x7b7494 to 0x7b75b0 (284 bytes)
//
// 3 xrefs:
// > ssl_add_clienthello_tlsext @ 0x7b1b38
// > ssl_add_clienthello_tlsext @ 0x7b1bb4
// > ??> @ 0x5d91c
//
// 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 ssl_add_clienthello_use_srtp_ext(int a1, _BYTE *a2, _DWORD *a3, int a4)
{
int srtp_profiles; // r7
int v8; // r0
int v9; // r6
int v10; // r8
_BYTE *v11; // r9
_BYTE *v12; // r4
int v13; // r5
int v14; // r0
srtp_profiles = SSL_get_srtp_profiles(a1);
v8 = OPENSSL_sk_num(srtp_profiles);
v9 = v8;
if ( !a2 )
{
v10 = 2 * (v8 + 1);
LABEL_10:
*a3 = v10 + 1;
return 0;
}
if ( v8 )
{
v10 = 2 * (v8 + 1);
if ( v10 < a4 )
{
*a2 = (unsigned __int16)(v10 - 2) >> 8;
a2[1] = 2 * v8;
v11 = a2 + 2;
if ( v8 > 0 )
{
v12 = a2 + 4;
v13 = 0;
do
{
v14 = OPENSSL_sk_value(srtp_profiles, v13++);
v12 += 2;
*(v12 - 4) = BYTE1(*(_DWORD *)(v14 + 4));
*(v12 - 3) = *(_DWORD *)(v14 + 4);
}
while ( v13 != v9 );
v11 += 2 * v13;
}
*v11 = 0;
goto LABEL_10;
}
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;
}
}