//
// sub_7FCF44 from 0x7fcf44 to 0x7fd044 (256 bytes)
//
// 3 xrefs:
// > ??> @ 0xa31464
// > ??> @ 0xa31498
// > ??> @ 0xa314cc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall sub_7FCF44(int a1, int a2, const void *a3)
{
_BOOL4 v3; // r5
_BOOL4 v4; // r8
const void *v5; // r7
int cipher_data; // r0
_DWORD *v9; // r4
int v10; // r0
v3 = a3 == nullptr;
if ( a2 )
v4 = 0;
else
v4 = a3 == nullptr;
v5 = a3;
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a1);
if ( v4 )
return 1;
v9 = (_DWORD *)cipher_data;
if ( a2 )
{
v10 = EVP_CIPHER_CTX_key_length(a1);
AES_set_encrypt_key(a2, 8 * v10, v9);
CRYPTO_gcm128_init(v9 + 64, v9, AES_encrypt);
v9[163] = 0;
if ( !v3 || v9[63] && (v5 = (const void *)v9[158]) != nullptr )
{
CRYPTO_gcm128_setiv(v9 + 64, v5, v9[159]);
v9[63] = 1;
}
v9[62] = 1;
return 1;
}
if ( *(_DWORD *)(cipher_data + 248) )
CRYPTO_gcm128_setiv(cipher_data + 256, v5, *(_DWORD *)(cipher_data + 636));
else
memcpy(*(void **)(cipher_data + 632), v5, *(_DWORD *)(cipher_data + 636));
v9[63] = 1;
v9[161] = 0;
return 1;
}