//
// CMAC_Update from 0xffebfc to 0xffed1c (288 bytes)
//
// 2 xrefs:
// > sub_109B548 @ 0x109b568
// > ??> @ 0x49000
//
// 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:52 +0000
//
__int64 __fastcall CMAC_Update(_QWORD *a1, char *a2, size_t a3)
{
size_t v5; // x19
size_t v7; // x22
int v8; // w0
size_t v9; // x24
char *v10; // x0
char *v11; // x2
v5 = a3;
if ( *((_DWORD *)a1 + 34) != -1 )
{
if ( !a3 )
return 1;
v7 = (int)EVP_CIPHER_CTX_block_size(*a1);
v8 = *((_DWORD *)a1 + 34);
if ( v8 <= 0 )
goto LABEL_9;
v9 = v7 - v8;
v10 = (char *)a1 + v8 + 104;
if ( v9 > v5 )
v9 = v5;
memcpy(v10, a2, v9);
v5 -= v9;
*((_DWORD *)a1 + 34) += v9;
if ( !v5 )
return 1;
a2 += v9;
if ( (unsigned int)EVP_Cipher(*a1, a1 + 9, a1 + 13, (unsigned int)v7) )
{
LABEL_9:
if ( v7 >= v5 )
{
LABEL_14:
memcpy(a1 + 13, a2, v5);
*((_DWORD *)a1 + 34) = v5;
return 1;
}
while ( 1 )
{
v11 = a2;
v5 -= v7;
a2 += v7;
if ( !(unsigned int)EVP_Cipher(*a1, a1 + 9, v11, (unsigned int)v7) )
break;
if ( v7 >= v5 )
goto LABEL_14;
}
}
}
return 0;
}