//
// sub_7FBE5C from 0x7fbe5c to 0x7fbef0 (148 bytes)
//
// 2 xrefs:
// > ??> @ 0xa31518
// > ??> @ 0xa3154c
//
// 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_7FBE5C(int a1, int a2, int a3, int a4)
{
int v6; // r0
int v7; // r5
int cipher_data; // r0
int v10; // r3
int v11; // r3
v6 = ((int (*)(void))EVP_CIPHER_CTX_get_cipher_data)();
v7 = v6;
if ( a2 == 8 )
{
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a4);
v10 = *(_DWORD *)(v7 + 496);
if ( v10 )
{
if ( v10 != v7 )
return 0;
*(_DWORD *)(cipher_data + 496) = cipher_data;
}
v11 = *(_DWORD *)(v7 + 500);
if ( !v11 )
return 1;
if ( v11 == v7 + 248 )
{
*(_DWORD *)(cipher_data + 500) = cipher_data + 248;
return 1;
}
return 0;
}
if ( a2 )
return -1;
*(_DWORD *)(v6 + 496) = 0;
*(_DWORD *)(v6 + 500) = 0;
return 1;
}