//
// sub_D5E008 from 0xd5e008 to 0xd5e1b4 (428 bytes)
//
// 2 xrefs:
// > SSL_CTX_set_tlsext_use_srtp @ 0xd5e1c0
// > SSL_set_tlsext_use_srtp @ 0xd5e1d0
//
// 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 sub_D5E008(const char *a1, __int64 *a2)
{
const char *v2; // x22
__int64 v4; // x24
char *v5; // x0
char *v6; // x23
const char *v7; // x19
unsigned int v8; // w0
size_t v9; // x21
char **v10; // x20
const char *v11; // t1
v2 = a1;
v4 = OPENSSL_sk_new_null(a1);
if ( v4 )
{
v5 = strchr(v2, 58);
v6 = v5;
if ( !v5 )
goto LABEL_12;
LABEL_3:
v7 = off_1236AF0;
v8 = (_DWORD)v5 - (_DWORD)v2;
if ( off_1236AF0 )
{
while ( 1 )
{
v9 = v8;
v10 = &off_1236AF0;
while ( v9 != strlen(v7) || strncmp(v7, v2, v9) )
{
v11 = v10[2];
v10 += 2;
v7 = v11;
if ( !v11 )
goto LABEL_13;
}
if ( (OPENSSL_sk_find(v4, v10) & 0x80000000) == 0 )
{
ERR_put_error(20, 309, 353, "ssl/d1_srtp.c", 82);
goto LABEL_14;
}
if ( !(unsigned int)OPENSSL_sk_push(v4, v10) )
break;
if ( !v6 )
{
OPENSSL_sk_free(*a2);
*a2 = v4;
return 0;
}
v2 = v6 + 1;
v5 = strchr(v6 + 1, 58);
v6 = v5;
if ( v5 )
goto LABEL_3;
LABEL_12:
v8 = strlen(v2);
v7 = off_1236AF0;
if ( !off_1236AF0 )
goto LABEL_13;
}
ERR_put_error(20, 309, 362, "ssl/d1_srtp.c", 88);
}
else
{
LABEL_13:
ERR_put_error(20, 309, 364, "ssl/d1_srtp.c", 93);
}
LABEL_14:
OPENSSL_sk_free(v4);
}
else
{
ERR_put_error(20, 309, 362, "ssl/d1_srtp.c", 72);
}
return 1;
}