//
// ssl_check_version_downgrade from 0x7a71f8 to 0x7a73ec (500 bytes)
//
// 3 xrefs:
// > tls_process_client_hello @ 0x7a9020
// > tls_process_client_hello @ 0x7a93ac
// > ??> @ 0x5d49c
//
// 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
//
bool __fastcall ssl_check_version_downgrade(int a1)
{
int *v1; // r2
int v2; // r4
int *v5; // r0
int v6; // r4
int *v7; // r4
int v8; // t1
int (__fastcall *v9)(int *); // r3
int v10; // r2
int *v11; // r8
int v12; // r6
int v13; // r3
int v14; // r3
int v15; // r3
v1 = **(int ***)(a1 + 276);
v2 = *v1;
if ( *(_DWORD *)a1 == *v1 )
return 1;
v5 = (int *)TLS_method();
if ( v2 == *v5 )
{
v7 = &dword_AB18F8;
}
else
{
v6 = ***(_DWORD ***)(a1 + 276);
v5 = (int *)DTLS_method();
if ( v6 != *v5 )
return 0;
v7 = &dword_AB18C8;
}
if ( !*v7 )
return 0;
while ( 1 )
{
v9 = (int (__fastcall *)(int *))v7[2];
if ( !v9 )
goto LABEL_11;
v5 = (int *)v9(v5);
v10 = *(_DWORD *)(a1 + 308);
v11 = v5;
v12 = *v5;
if ( v10 && v12 != v10 )
{
if ( (*(_DWORD *)(*(_DWORD *)(*(_DWORD *)(a1 + 4) + 100) + 52) & 8) != 0 )
{
if ( v12 == 256 )
{
if ( v10 == 256 )
goto LABEL_10;
v13 = 65280;
}
else
{
v13 = *v5;
if ( v10 == 256 )
v10 = 65280;
}
if ( v10 < v13 )
goto LABEL_11;
}
else if ( v12 < v10 )
{
goto LABEL_11;
}
}
LABEL_10:
v5 = (int *)ssl_security(a1, 9);
if ( !v5 )
goto LABEL_11;
v14 = *(_DWORD *)(a1 + 312);
if ( !v14 || v12 == v14 )
break;
if ( (*(_DWORD *)(*(_DWORD *)(*(_DWORD *)(a1 + 4) + 100) + 52) & 8) != 0 )
{
if ( v12 == 256 )
{
if ( v14 == 256 )
goto LABEL_11;
v12 = 65280;
}
else if ( v14 == 256 )
{
v14 = 65280;
}
if ( v12 > v14 )
break;
}
else if ( v12 < v14 )
{
break;
}
LABEL_11:
v8 = v7[3];
v7 += 3;
if ( !v8 )
return 0;
}
if ( (v11[2] & *(_DWORD *)(a1 + 300)) != 0 )
goto LABEL_11;
v15 = v11[1];
if ( (v15 & 2) != 0 && (*(_DWORD *)(*(_DWORD *)(a1 + 200) + 16) & 0x30000) != 0 )
goto LABEL_11;
if ( (v15 & 1) != 0 )
{
v5 = (int *)FIPS_mode(v5);
if ( v5 )
goto LABEL_11;
}
return *(_DWORD *)a1 == *v7;
}