//
// CMAC_Update from 0x9edfa8 to 0x9ee0a0 (248 bytes)
//
// 2 xrefs:
// > sub_A8747C @ 0xa87498
// > ??> @ 0x79b1c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:28 +0000
//
int __fastcall CMAC_Update(_DWORD *a1, char *a2, size_t a3)
{
size_t v4; // r4
unsigned int v7; // r5
int v8; // r0
size_t v9; // r8
int v10; // r0
if ( a1[33] == -1 )
return 0;
v4 = a3;
if ( !a3 )
return 1;
v7 = EVP_CIPHER_CTX_block_size(*a1);
v8 = a1[33];
if ( v8 > 0 )
{
v9 = v7 - v8;
if ( v7 - v8 >= v4 )
v9 = v4;
memcpy((char *)a1 + v8 + 100, a2, v9);
v4 -= v9;
a1[33] += v9;
if ( !v4 )
return 1;
if ( !EVP_Cipher(*a1, a1 + 17, a1 + 25, v7) )
return 0;
a2 += v9;
}
while ( v7 < v4 )
{
v10 = EVP_Cipher(*a1, a1 + 17, a2, v7);
v4 -= v7;
a2 += v7;
if ( !v10 )
return 0;
}
memcpy(a1 + 25, a2, v4);
a1[33] = v4;
return 1;
}