//
// sub_DA297C from 0xda297c to 0xda2a6c (240 bytes)
//
// 6 xrefs:
// > ??> @ 0x1123e08
// > ??> @ 0x1123e60
// > ??> @ 0x1123eb8
// > ??> @ 0x1123f10
// > ??> @ 0x1123f68
// > ??> @ 0x1123fc0
//
// 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
//
__int64 __fastcall sub_DA297C(__int64 a1, __int64 a2, const void *a3)
{
__int64 cipher_data; // x23
int v8; // w0
void *v9; // x20
int v10; // w0
int v11; // w0
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a1);
if ( !a3 && !a2 )
return 1;
if ( a2 )
{
if ( (unsigned int)EVP_CIPHER_CTX_encrypting(a1) )
{
v8 = EVP_CIPHER_CTX_key_length(a1);
AES_set_encrypt_key(a2, (unsigned int)(8 * v8), cipher_data);
}
else
{
v11 = EVP_CIPHER_CTX_key_length(a1);
AES_set_decrypt_key(a2, (unsigned int)(8 * v11), cipher_data);
}
if ( a3 )
goto LABEL_8;
*(_QWORD *)(cipher_data + 248) = 0;
return 1;
}
if ( !a3 )
return 1;
LABEL_8:
v9 = (void *)EVP_CIPHER_CTX_iv_noconst(a1);
v10 = EVP_CIPHER_CTX_iv_length(a1);
memcpy(v9, a3, v10);
*(_QWORD *)(cipher_data + 248) = EVP_CIPHER_CTX_iv_noconst(a1);
return 1;
}