//
// tls1_check_curve from 0x7ae138 to 0x7ae2e8 (432 bytes)
//
// 2 xrefs:
// > tls_process_key_exchange @ 0x7a332c
// > ??> @ 0x5d1ec
//
// 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 tls1_check_curve(_DWORD *a1, _BYTE *a2, int a3)
{
int v3; // r3
int v5; // r2
int v6; // r12
unsigned int v7; // r4
char *v8; // r2
unsigned int v9; // r4
char *v10; // r2
unsigned int v11; // r12
int v12; // lr
v3 = *(_DWORD *)(a1[50] + 16);
if ( a3 != 3 || *a2 != 3 )
return 0;
v5 = v3 & 0x30000;
if ( (v3 & 0x30000) != 0 )
{
v6 = *(_DWORD *)(*(_DWORD *)(a1[26] + 528) + 8);
if ( a2[1] )
return 0;
if ( v6 == 50380843 )
{
if ( a2[2] != 23 )
return 0;
}
else if ( v6 != 50380844 || a2[2] != 24 )
{
return 0;
}
switch ( v5 )
{
case 131072:
v7 = 2;
v8 = (char *)&unk_A0CB4A;
goto LABEL_13;
case 196608:
v7 = 4;
v8 = (char *)&unk_A0CB48;
goto LABEL_13;
case 65536:
v7 = 2;
v8 = (char *)&unk_A0CB48;
goto LABEL_13;
}
}
v8 = (char *)a1[105];
v7 = a1[104];
if ( !v8 )
{
v9 = 4;
v8 = (char *)&unk_A0CB40;
goto LABEL_14;
}
if ( (v7 & 1) != 0 )
{
ERR_put_error(20, 338, 68, "ssl/t1_lib.c", 291);
return 0;
}
LABEL_13:
v9 = v7 >> 1;
if ( !v9 )
return 0;
LABEL_14:
v10 = v8 + 2;
v11 = 0;
while ( 1 )
{
++v11;
if ( *(v10 - 2) == a2[1] )
{
v12 = (unsigned __int8)a2[2];
if ( v12 == (unsigned __int8)*(v10 - 1) )
break;
}
v10 += 2;
if ( v11 >= v9 )
return 0;
}
if ( a2[1] )
return 1;
if ( (unsigned __int8)(v12 - 1) > 0x1Cu )
return 0;
return ssl_security((int)a1, 131078);
}