//
// sub_1006EFE14 from 0x1006efe14 to 0x1006f01ac (920 bytes)
//
// 1 xrefs:
// > sub_1006F22A4 @ 0x1006f23dc
//
// 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:12:40 +0000
//
__int64 __fastcall sub_1006EFE14(__int64 a1, _BYTE *a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 v11; // x24
__int64 v12; // x0
int v13; // w23
__int64 v14; // x22
__int64 v15; // x19
__int64 v16; // x2
__int64 v17; // x4
int v18; // w28
int v19; // w0
int v20; // w21
int8x16_t *v21; // x0
int8x16_t *v22; // x20
int v23; // w27
__int64 v24; // x8
__int64 v25; // x11
__int64 v26; // x12
_BYTE *v27; // x8
__int64 v28; // x9
__int64 v29; // x10
int v30; // w13
int8x16_t *v31; // x12
int8x16_t *v32; // x13
unsigned __int64 v33; // x11
int8x16_t v34; // q0
int8x16_t v35; // t1
int8x16_t v36; // q1
int v37; // w9
char *v38; // x10
char v39; // t1
_BYTE v41[48]; // [xsp+0h] [xbp-80h] BYREF
if ( a5 )
v11 = a5;
else
v11 = a4;
v12 = sub_100711410(a4);
v13 = v12;
if ( (v12 & 0x80000000) != 0 )
return 0;
v14 = v12;
if ( (_DWORD)a6 != -1 )
{
if ( (_DWORD)a6 == -2 )
{
v14 = 4294967294LL;
}
else
{
v14 = a6;
if ( (int)a6 <= -3 )
{
v16 = 136;
v17 = 215;
goto LABEL_31;
}
}
}
v18 = ((unsigned __int8)sub_1006D0D88(*(_QWORD *)(a1 + 32)) + 7) & 7;
v19 = sub_1006F3234(a1);
v20 = v19;
if ( !v18 )
{
*a2++ = 0;
v20 = v19 - 1;
}
if ( (_DWORD)v14 == -2 )
{
v14 = (unsigned int)(-2 - v13 + v20);
}
else if ( v20 < v13 + (int)v14 + 2 )
{
v16 = 110;
v17 = 229;
goto LABEL_31;
}
if ( (int)v14 >= 1 )
{
v21 = (int8x16_t *)sub_1006AE878(v14, (__int64)"rsa_pss.c", 233);
v22 = v21;
if ( v21 )
{
if ( (int)sub_100706330(v21, v14) < 1 )
{
v15 = 0;
LABEL_52:
sub_1006AEDAC(v22);
return v15;
}
goto LABEL_22;
}
v16 = 65;
v17 = 236;
LABEL_31:
sub_100706FB0(4, 148, v16, "rsa_pss.c", v17);
return 0;
}
v22 = nullptr;
LABEL_22:
v23 = v20 + ~v13;
sub_100708F5C(v41);
if ( (unsigned int)sub_100708FB4(v41, a4, 0) )
{
if ( (unsigned int)sub_1007091A4(v41, &unk_1007A8E90, 8) )
{
if ( (unsigned int)sub_1007091A4(v41, a3, v13) )
{
if ( (_DWORD)v14 && !(unsigned int)sub_1007091A4(v41, v22, (int)v14) )
{
v15 = 0;
}
else if ( (unsigned int)sub_100709260(v41, &a2[v23], 0) )
{
sub_10070930C(v41);
if ( (unsigned int)sub_1006EF340((__int64)a2, v23, (__int64)&a2[v23], v13, v11) )
{
v15 = 0;
}
else
{
v24 = -2 - v13 + v20 - (int)v14;
a2[v24] ^= 1u;
v25 = (unsigned int)(v14 - 1);
if ( (int)v14 >= 1 )
{
v26 = v24 + 1;
v27 = &a2[v24 + 1];
v28 = v25 + 1;
v29 = (v25 + 1) & 0x1FFFFFFE0LL;
v30 = v20 - 2 - v13 - v14;
if ( v29 )
{
if ( &a2[v30 + 1] > &v22->i8[v25] || v22 > (int8x16_t *)&a2[v30 + 1 + v25] )
{
v27 = &a2[v26 + v29];
v31 = v22 + 1;
v32 = (int8x16_t *)&a2[v30 + 17];
v33 = (v25 + 1) & 0xFFFFFFFFFFFFFFE0LL;
do
{
v34 = v31[-1];
v35 = *v31;
v31 += 2;
v36 = veorq_s8(*v32, v35);
v32[-1] = veorq_s8(v32[-1], v34);
*v32 = v36;
v32 += 2;
v33 -= 32LL;
}
while ( v33 );
}
else
{
v29 = 0;
}
}
else
{
v29 = 0;
}
if ( v28 != v29 )
{
v37 = v14 - v29;
v38 = &v22->i8[v29];
do
{
v39 = *v38++;
*v27++ ^= v39;
--v37;
}
while ( v37 );
}
}
if ( v18 )
*a2 &= 0xFFu >> (8 - v18);
a2[v20 - 1] = -68;
v15 = 1;
}
}
else
{
v15 = 0;
}
}
else
{
v15 = 0;
}
}
else
{
v15 = 0;
}
}
else
{
v15 = 0;
}
if ( v22 )
goto LABEL_52;
return v15;
}