//
// sub_7B9D64 from 0x7b9d64 to 0x7b9f94 (560 bytes)
//
// 2 xrefs:
// > SSL_config @ 0x7b9ff0
// > SSL_CTX_config @ 0x7ba000
//
// 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 sub_7B9D64(int a1, int *a2, char *a3)
{
bool v3; // zf
int v4; // r5
int v7; // r4
int v8; // r9
int v10; // r5
int v11; // r1
int v12; // r2
int v13; // r10
int v14; // r6
unsigned int v15; // r5
int v16; // r0
int v18; // r7
int v19; // r9
v3 = a1 == 0;
if ( !a1 )
v3 = a2 == nullptr;
if ( v3 )
{
v18 = 0;
ERR_put_error(20, 391, 67, "ssl/ssl_mcnf.c", 147);
v19 = 0;
}
else
{
v4 = 0;
if ( a3 && (v7 = dword_AD2DD4, (v8 = dword_AD2DD8) != 0) )
{
while ( 1 )
{
++v4;
v18 = strcmp(*(const char **)v7, a3);
if ( !v18 )
break;
v7 += 12;
if ( v4 == v8 )
goto LABEL_27;
}
v19 = SSL_CONF_CTX_new();
if ( v19 )
{
if ( a1 )
{
v10 = *(_DWORD *)(a1 + 4);
SSL_CONF_CTX_set_ssl();
}
else
{
v10 = *a2;
SSL_CONF_CTX_set_ssl_ctx();
}
if ( *(int (**)())(v10 + 24) == ssl_undefined_function )
{
v11 = 102;
v12 = 98;
}
else
{
v11 = 110;
v12 = 106;
}
if ( *(int (**)())(v10 + 28) == ssl_undefined_function )
v11 = v12;
SSL_CONF_CTX_set_flags(v19, v11, v12);
v13 = *(_DWORD *)(v7 + 4);
if ( *(_DWORD *)(v7 + 8) )
{
v14 = *(_DWORD *)(v7 + 4);
v15 = 0;
while ( 1 )
{
v16 = SSL_CONF_cmd(v19, *(_DWORD *)(v13 + 8 * v15++), *(_DWORD *)(v14 + 4));
if ( v16 <= 0 )
break;
v14 += 8;
if ( *(_DWORD *)(v7 + 8) <= v15 )
goto LABEL_28;
}
if ( v16 == -2 )
ERR_put_error(20, 391, 139, "ssl/ssl_mcnf.c", 177);
else
ERR_put_error(20, 391, 384, "ssl/ssl_mcnf.c", 179);
ERR_add_error_data(6, "section=", a3);
}
else
{
LABEL_28:
v18 = SSL_CONF_CTX_finish(v19) > 0;
}
}
}
else
{
LABEL_27:
ERR_put_error(20, 391, 113, "ssl/ssl_mcnf.c", 152);
v18 = 0;
ERR_add_error_data(2, "name=", a3);
v19 = 0;
}
}
SSL_CONF_CTX_free(v19);
return v18;
}