//
// ssl_parse_serverhello_use_srtp_ext from 0x7b7894 to 0x7b7a34 (416 bytes)
//
// 2 xrefs:
// > ssl_parse_serverhello_tlsext @ 0x7affd0
// > ??> @ 0x5d87c
//
// 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_parse_serverhello_use_srtp_ext(int a1, unsigned __int8 **a2, _DWORD *a3)
{
unsigned int v3; // lr
unsigned __int8 *v5; // r3
int v6; // r12
int v8; // r8
int v9; // r6
unsigned __int8 *v10; // lr
int v11; // r5
int srtp_profiles; // r9
int v14; // r6
int v15; // r0
int v16; // r0
int v17; // r1
v3 = (unsigned int)a2[1];
if ( v3 <= 1 )
goto LABEL_3;
v5 = *a2;
v6 = (*a2)[1] | (**a2 << 8);
*a2 += 2;
a2[1] = (unsigned __int8 *)(v3 - 2);
if ( v6 != 2 )
goto LABEL_3;
if ( v3 - 2 <= 1 )
goto LABEL_3;
v8 = v5[2];
v9 = v5[3];
*a2 = v5 + 4;
a2[1] = (unsigned __int8 *)(v3 - 4);
if ( v3 == 4 || (v10 = (unsigned __int8 *)(v3 - 5), v11 = v5[4], *a2 = v5 + 5, (a2[1] = v10) != nullptr) )
{
LABEL_3:
ERR_put_error(20, 311, 353, "ssl/d1_srtp.c", 286);
*a3 = 50;
return 1;
}
else if ( v11 )
{
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 )
{
v14 = v9 | (v8 << 8);
do
{
v16 = OPENSSL_sk_num(srtp_profiles);
v17 = v11;
if ( v11++ >= v16 )
{
ERR_put_error(20, 311, 353, "ssl/d1_srtp.c", 324);
*a3 = 50;
return 1;
}
v15 = OPENSSL_sk_value(srtp_profiles, v17);
}
while ( *(_DWORD *)(v15 + 4) != v14 );
*(_DWORD *)(a1 + 460) = v15;
*a3 = 0;
return 0;
}
else
{
ERR_put_error(20, 311, 359, "ssl/d1_srtp.c", 304);
*a3 = 50;
return 1;
}
}
}