//
// sub_10066B654 from 0x10066b654 to 0x10066b7fc (424 bytes)
//
// 3 xrefs:
// > sub_10066B7FC @ 0x10066b830
// > sub_10066BA6C @ 0x10066baa0
// > sub_10066BAEC @ 0x10066bbd0
//
// 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 11:11:04 +0000
//
__int64 __fastcall sub_10066B654(__int64 a1, __int64 a2)
{
__int64 v4; // x0
int v5; // w21
__int64 v6; // x23
__int64 v7; // x22
__int64 v8; // x0
_QWORD *v9; // x22
__int64 v10; // t1
__int64 v11; // x0
__int64 v12; // x21
__int64 v13; // x0
__int64 v14; // x23
__int64 v15; // x0
_QWORD *v16; // x23
__int64 v17; // t1
__int64 v18; // x21
if ( *(_DWORD *)a2 == 28 )
{
v4 = *(_QWORD *)(a1 + 280);
v5 = -1;
if ( v4 )
{
v4 = sub_100725290(v4, a2);
if ( (_DWORD)v4 )
v5 = 3;
else
v5 = -1;
}
if ( v5 == -1 )
{
v4 = *(_QWORD *)(a1 + 336);
if ( v4 )
{
v4 = sub_100725290(v4, a2);
if ( (_DWORD)v4 )
v5 = 4;
else
v5 = -1;
}
}
sub_1007072C0(v4);
}
else
{
v5 = sub_100652D7C(0, (int *)a2);
}
if ( v5 < 0 )
{
sub_100706FB0(20, 193, 247, "ssl_rsa.c", 194);
return 0;
}
else
{
v6 = v5;
v7 = a1 + 56LL * v5;
v10 = *(_QWORD *)(v7 + 112);
v9 = (_QWORD *)(v7 + 112);
v8 = v10;
if ( v10 )
{
v11 = sub_100725258(v8);
v12 = v11;
if ( !v11 )
{
sub_100706FB0(20, 193, 65, "ssl_rsa.c", 202);
sub_10070FBF4(0);
return 0;
}
sub_10070F650(v11);
v13 = sub_10070FBF4(v12);
sub_1007072C0(v13);
if ( (*(_DWORD *)a2 != 6 || (sub_1006F3290(*(_QWORD *)(a2 + 32)) & 1) == 0)
&& !(unsigned int)sub_100725290(*v9, a2) )
{
sub_100719E08(*v9);
v18 = 0;
*v9 = 0;
return v18;
}
}
v14 = a1 + 56 * v6;
v17 = *(_QWORD *)(v14 + 120);
v16 = (_QWORD *)(v14 + 120);
v15 = v17;
if ( v17 )
sub_10070FBF4(v15);
v18 = 1;
sub_1006AE670(a2 + 8, 1, 10, "ssl_rsa.c", 232);
*v16 = a2;
*(_QWORD *)a1 = v9;
*(_DWORD *)(a1 + 8) = 0;
}
return v18;
}