//
// ssl_parse_serverhello_use_srtp_ext from 0xd5e614 to 0xd5e7b4 (416 bytes)
//
// 2 xrefs:
// > ssl_parse_serverhello_tlsext @ 0xd57524
// > ??> @ 0x96a98
//
// 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_parse_serverhello_use_srtp_ext(__int64 a1, unsigned __int8 **a2, _DWORD *a3)
{
unsigned __int64 v3; // x3
unsigned __int8 *v6; // x4
int v7; // w5
int v8; // w6
__int64 result; // x0
int v10; // w23
int v11; // w24
int v12; // w2
int v13; // w19
__int64 srtp_profiles; // x22
__int64 v15; // x23
__int64 v16; // x0
bool v17; // cc
__int64 v18; // x1
v3 = (unsigned __int64)a2[1];
if ( v3 <= 1 )
goto LABEL_3;
v6 = *a2;
v7 = **a2;
v8 = (*a2)[1];
*a2 += 2;
a2[1] = (unsigned __int8 *)(v3 - 2);
if ( (v8 | (v7 << 8)) != 2 )
goto LABEL_3;
if ( v3 - 2 <= 1 )
goto LABEL_3;
v10 = v6[2];
v11 = v6[3];
*a2 = v6 + 4;
a2[1] = (unsigned __int8 *)(v3 - 4);
if ( v3 == 4 )
goto LABEL_3;
v12 = v6[4];
v13 = v3 - 5;
a2[1] = (unsigned __int8 *)(v3 - 5);
*a2 = v6 + 5;
if ( v3 == 5 )
{
if ( v12 )
{
ERR_put_error(20, 311, 352, "ssl/d1_srtp.c", 294);
*a3 = 47;
return 1;
}
else
{
srtp_profiles = SSL_get_srtp_profiles(a1);
if ( srtp_profiles )
{
v15 = v11 | (unsigned int)(v10 << 8);
do
{
v17 = v13 < (int)OPENSSL_sk_num(srtp_profiles);
v18 = (unsigned int)v13++;
if ( !v17 )
{
ERR_put_error(20, 311, 353, "ssl/d1_srtp.c", 324);
*a3 = 50;
return 1;
}
v16 = OPENSSL_sk_value(srtp_profiles, v18);
}
while ( *(_QWORD *)(v16 + 8) != v15 );
*(_QWORD *)(a1 + 752) = v16;
*a3 = 0;
return 0;
}
else
{
ERR_put_error(20, 311, 359, "ssl/d1_srtp.c", 304);
*a3 = 50;
return 1;
}
}
}
else
{
LABEL_3:
ERR_put_error(20, 311, 353, "ssl/d1_srtp.c", 286);
result = 1;
*a3 = 50;
}
return result;
}