//
// sub_1030794 from 0x1030794 to 0x1030988 (500 bytes)
//
// 1 xrefs:
// > ??> @ 0x1402af8
//
// 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:16:20 +0000
//
void *__fastcall sub_1030794(__int64 a1, __int64 a2, size_t *a3)
{
__int64 v3; // x21
__int64 v4; // x20
__int64 v5; // x3
size_t v7; // x26
void *result; // x0
unsigned int v9; // w25
size_t v10; // x24
unsigned __int64 v11; // x27
__int64 v12; // x0
_QWORD *v13; // x19
unsigned int v14; // w20
__int64 v15; // x22
size_t v16; // x2
__int64 v17; // x21
_BYTE v18[64]; // [xsp+80h] [xbp+80h] BYREF
_DWORD v19[16]; // [xsp+C0h] [xbp+C0h] BYREF
v3 = *(_QWORD *)(a1 + 40);
v4 = *(_QWORD *)v3;
if ( !*(_QWORD *)v3 )
return nullptr;
v5 = *(_QWORD *)(v3 + 24);
if ( !v5 )
return nullptr;
v7 = *a3;
result = HMAC(*(_QWORD *)v3, *(const void **)(v3 + 8), *(_DWORD *)(v3 + 16), v5, *(_QWORD *)(v3 + 32), v18, v19);
if ( result )
{
v9 = v19[0];
v10 = (int)EVP_MD_size(v4);
v11 = v7 / v10;
if ( v7 % v10 )
++v11;
if ( v11 > 0xFF )
return nullptr;
v12 = HMAC_CTX_new();
v13 = (_QWORD *)v12;
if ( !v12 )
return nullptr;
if ( !HMAC_Init_ex(v12, v18, v9, v4, 0) )
goto LABEL_23;
if ( v11 )
{
v14 = 1;
v15 = 0;
while ( (unsigned int)HMAC_Update(v13)
&& (unsigned int)HMAC_Update(v13)
&& HMAC_Final((__int64)v13, (__int64)v19, nullptr) )
{
if ( v7 >= v15 + v10 )
{
v17 = v15 + v10;
v16 = v10;
}
else
{
v16 = v7 - v15;
v17 = v7;
}
++v14;
memcpy((void *)(a2 + v15), v19, v16);
if ( v11 < v14 )
goto LABEL_21;
if ( v14 > 1 && (!HMAC_Init_ex((__int64)v13, nullptr, 0, 0, 0) || !(unsigned int)HMAC_Update(v13)) )
break;
v15 = v17;
}
LABEL_23:
HMAC_CTX_free((__int64)v13);
return nullptr;
}
LABEL_21:
HMAC_CTX_free((__int64)v13);
return (void *)(a2 != 0);
}
return result;
}