//
// ssl_parse_clienthello_use_srtp_ext from 0x7b75c4 to 0x7b77ac (488 bytes)
//
// 2 xrefs:
// > sub_7B2438 @ 0x7b2c14
// > ??> @ 0x5d96c
//
// 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_clienthello_use_srtp_ext(int a1, int *a2, _DWORD *a3)
{
unsigned int v3; // r3
unsigned __int8 *v6; // r3
int v7; // r2
int v8; // r8
unsigned int v9; // r7
int v10; // r4
int srtp_profiles; // r0
int v12; // r6
int v13; // r5
int v14; // r4
int v15; // r11
int v16; // r0
unsigned __int8 *v18; // r3
unsigned __int8 *v19; // r3
unsigned int v20; // r1
int v21; // r2
unsigned __int8 *v22; // r3
v3 = a2[1];
if ( v3 <= 1
|| (v6 = (unsigned __int8 *)(v3 - 2),
v7 = *(unsigned __int8 *)(*a2 + 1),
v8 = *a2 + 2,
v9 = v7 | (*(unsigned __int8 *)*a2 << 8),
v10 = v7 & 1,
*a2 = v8,
a2[1] = (int)v6,
(v7 & 1) != 0)
|| v9 > (unsigned int)v6 )
{
ERR_put_error(20, 310, 353, "ssl/d1_srtp.c", 194);
*a3 = 50;
return 1;
}
else
{
*a2 = v8 + v9;
a2[1] = (int)&v6[-v9];
srtp_profiles = SSL_get_srtp_profiles(a1);
*(_DWORD *)(a1 + 460) = v10;
v12 = srtp_profiles;
v13 = OPENSSL_sk_num(srtp_profiles);
LABEL_5:
while ( 1 )
{
v8 += 2;
if ( !v9 )
break;
if ( v9 == 1 )
{
ERR_put_error(20, 310, 353, "ssl/d1_srtp.c", 207);
*a3 = 50;
return 1;
}
v9 -= 2;
v14 = *(unsigned __int8 *)(v8 - 1) | (*(unsigned __int8 *)(v8 - 2) << 8);
if ( v13 > 0 )
{
v15 = 0;
while ( 1 )
{
v16 = OPENSSL_sk_value(v12, v15);
if ( *(_DWORD *)(v16 + 4) == v14 )
break;
if ( ++v15 == v13 )
goto LABEL_5;
}
v13 = v15;
*(_DWORD *)(a1 + 460) = v16;
}
}
v18 = (unsigned __int8 *)a2[1];
if ( v18 )
{
v19 = v18 - 1;
v21 = *a2 + 1;
v20 = *(unsigned __int8 *)*a2;
*a2 = v21;
a2[1] = (int)v19;
if ( v20 > (unsigned int)v19 || (v22 = &v19[-v20], *a2 = v21 + v20, (a2[1] = (int)v22) != 0) )
{
ERR_put_error(20, 310, 352, "ssl/d1_srtp.c", 241);
*a3 = 50;
return 1;
}
else
{
return 0;
}
}
else
{
ERR_put_error(20, 310, 353, "ssl/d1_srtp.c", 233);
*a3 = 50;
return 1;
}
}
}