//
// sub_7FD7F4 from 0x7fd7f4 to 0x7fd8a4 (176 bytes)
//
// 3 xrefs:
// > ??> @ 0xa31568
// > ??> @ 0xa3159c
// > ??> @ 0xa315d0
//
// 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_7FD7F4(int a1, int a2, const void *a3)
{
int cipher_data; // r0
bool v7; // zf
int v8; // r8
_DWORD *v9; // r4
int v10; // r0
void *v11; // r0
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a1);
v7 = a3 == nullptr;
if ( !a3 )
v7 = a2 == 0;
v8 = v7;
if ( !v7 )
{
v9 = (_DWORD *)cipher_data;
if ( a2 )
{
v10 = EVP_CIPHER_CTX_key_length(a1);
AES_set_encrypt_key(a2, 8 * v10, v9);
CRYPTO_ccm128_init(v9 + 70, v9[67], v9[66], v9, AES_encrypt);
v9[82] = v8;
v9[62] = 1;
}
if ( a3 )
{
v11 = (void *)EVP_CIPHER_CTX_iv_noconst(a1);
memcpy(v11, a3, 15 - v9[66]);
v9[63] = 1;
}
}
return 1;
}