//
// sub_FD3848 from 0xfd3848 to 0xfd39c8 (384 bytes)
//
// 3 xrefs:
// > tls12_check_peer_sigalg @ 0xfd6468
// > tls1_check_chain @ 0xfd9660
// > tls1_check_chain @ 0xfd9850
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:15:30 +0000
//
__int64 __fastcall sub_FD3848(__int64 a1, unsigned __int8 *a2, unsigned __int8 *a3)
{
__int64 v3; // x3
unsigned __int8 *v4; // x5
__int64 v5; // x4
int v6; // w6
__int64 v7; // x2
int v9; // w8
int v10; // w2
unsigned __int8 *v11; // x2
unsigned __int64 v12; // x5
__int64 v13; // x5
__int64 v14; // x3
__int64 v15; // x2
unsigned __int64 v16; // x5
if ( a3 )
{
v3 = *(_QWORD *)(a1 + 376);
v4 = *(unsigned __int8 **)(v3 + 280);
if ( v4 )
{
v5 = *(_QWORD *)(v3 + 272);
if ( !v5 )
return (unsigned int)v5;
v6 = *a3;
if ( *v4 != v6 )
{
v7 = 0;
while ( ++v7 != v5 )
{
if ( v4[v7] == v6 )
goto LABEL_10;
}
goto LABEL_8;
}
}
}
LABEL_10:
if ( !a2 )
return 1;
v9 = 0;
v10 = *(_DWORD *)(*(_QWORD *)(a1 + 328) + 28LL) & 0x30000;
switch ( v10 )
{
case 131072:
v11 = (unsigned __int8 *)&unk_11F43D2;
v12 = 2;
goto LABEL_27;
case 196608:
v11 = (unsigned __int8 *)&unk_11F43D0;
v12 = 4;
goto LABEL_27;
case 65536:
v11 = (unsigned __int8 *)&unk_11F43D0;
v12 = 2;
goto LABEL_27;
}
v11 = *(unsigned __int8 **)(a1 + 672);
v12 = *(_QWORD *)(a1 + 664);
if ( !v11 )
{
v11 = (unsigned __int8 *)&unk_11F43C0;
v13 = 4;
LABEL_16:
while ( 1 )
{
v14 = 0;
while ( *v11 != *a2 || v11[1] != a2[1] )
{
++v14;
v11 += 2;
if ( v14 == v13 )
goto LABEL_8;
}
if ( v14 == v13 )
break;
if ( *(_DWORD *)(a1 + 56) && !v9 )
{
v15 = *(_QWORD *)(a1 + 376);
v9 = 1;
v16 = *(_QWORD *)(v15 + 288);
v11 = *(unsigned __int8 **)(v15 + 296);
if ( (v16 & 1) != 0 )
goto LABEL_30;
v13 = v16 >> 1;
if ( v13 )
continue;
}
return 1;
}
LABEL_8:
LODWORD(v5) = 0;
return (unsigned int)v5;
}
if ( (v12 & 1) == 0 )
{
LABEL_27:
v13 = v12 >> 1;
LODWORD(v5) = v13;
if ( v13 )
goto LABEL_16;
return (unsigned int)v5;
}
LABEL_30:
ERR_put_error(20, 338, 68, "ssl/t1_lib.c", 291);
return 0;
}