//
// tls1_check_ec_tmp_key from 0xd55ecc to 0xd56044 (376 bytes)
//
// 2 xrefs:
// > ssl3_choose_cipher @ 0xd37de0
// > ??> @ 0x9bd60
//
// 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 tls1_check_ec_tmp_key(__int64 a1, __int64 a2)
{
int v3; // w2
__int64 result; // x0
int v5; // w6
int v6; // w8
_BYTE *v7; // x1
unsigned __int64 v8; // x5
__int64 v9; // x5
_BYTE *v10; // x4
__int64 v11; // x2
__int64 v12; // x0
unsigned __int64 v13; // x5
v3 = *(_DWORD *)(*(_QWORD *)(a1 + 328) + 28LL) & 0x30000;
if ( !v3 )
return (unsigned int)tls1_shared_curve(a1, 0) != 0;
if ( a2 == 50380843 )
{
v5 = 23;
}
else
{
result = 0;
v5 = 24;
if ( a2 != 50380844 )
return result;
}
v6 = 0;
switch ( v3 )
{
case 131072:
v7 = &unk_F62ED2;
v8 = 2;
LABEL_25:
if ( (v8 & 1) != 0 )
{
LABEL_28:
ERR_put_error(20, 338, 68, "ssl/t1_lib.c", 291);
return 0;
}
else
{
v9 = v8 >> 1;
result = (unsigned int)v9;
if ( v9 )
goto LABEL_11;
}
return result;
case 196608:
v7 = &unk_F62ED0;
v8 = 4;
goto LABEL_25;
case 65536:
v7 = &unk_F62ED0;
v8 = 2;
goto LABEL_25;
}
v7 = *(_BYTE **)(a1 + 672);
v8 = *(_QWORD *)(a1 + 664);
if ( v7 )
goto LABEL_25;
v7 = &unk_F62EC0;
v9 = 4;
LABEL_11:
while ( 1 )
{
v10 = &v7[2 * v9];
v11 = 0;
do
{
if ( !*v7 && (unsigned __int8)v7[1] == v5 )
break;
v7 += 2;
++v11;
}
while ( v7 != v10 );
if ( v11 == v9 )
return 0;
if ( !*(_DWORD *)(a1 + 56) || v6 )
return 1;
v12 = *(_QWORD *)(a1 + 376);
v6 = 1;
v13 = *(_QWORD *)(v12 + 288);
v7 = *(_BYTE **)(v12 + 296);
if ( (v13 & 1) != 0 )
goto LABEL_28;
v9 = v13 >> 1;
if ( !v9 )
return 1;
}
}