//
// sub_DA3B2C from 0xda3b2c to 0xda3c94 (360 bytes)
//
// 3 xrefs:
// > ??> @ 0x1123d00
// > ??> @ 0x1123d58
// > ??> @ 0x1123db0
//
// 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_DA3B2C(__int64 a1, __int64 a2, const void *a3)
{
__int64 cipher_data; // x19
int v8; // w0
void *v9; // x0
int v10; // w0
int v11; // w0
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a1);
if ( !a3 && !a2 )
return 1;
if ( a2 )
{
if ( (OPENSSL_armcap_P & 4) != 0 )
{
v11 = EVP_CIPHER_CTX_key_length(a1);
aes_v8_set_encrypt_key(a2, (unsigned int)(8 * v11), cipher_data);
CRYPTO_ccm128_init(
cipher_data + 280,
*(unsigned int *)(cipher_data + 268),
*(unsigned int *)(cipher_data + 264),
cipher_data,
aes_v8_encrypt);
*(_QWORD *)(cipher_data + 336) = 0;
*(_DWORD *)(cipher_data + 248) = 1;
if ( a3 )
goto LABEL_9;
}
else
{
if ( (OPENSSL_armcap_P & 1) != 0 )
{
v8 = EVP_CIPHER_CTX_key_length(a1);
vpaes_set_encrypt_key(a2, (unsigned int)(8 * v8), cipher_data);
CRYPTO_ccm128_init(
cipher_data + 280,
*(unsigned int *)(cipher_data + 268),
*(unsigned int *)(cipher_data + 264),
cipher_data,
vpaes_encrypt);
*(_QWORD *)(cipher_data + 336) = 0;
*(_DWORD *)(cipher_data + 248) = 1;
goto LABEL_8;
}
v10 = EVP_CIPHER_CTX_key_length(a1);
AES_set_encrypt_key(a2, (unsigned int)(8 * v10), cipher_data);
CRYPTO_ccm128_init(
cipher_data + 280,
*(unsigned int *)(cipher_data + 268),
*(unsigned int *)(cipher_data + 264),
cipher_data,
AES_encrypt);
*(_QWORD *)(cipher_data + 336) = 0;
*(_DWORD *)(cipher_data + 248) = 1;
if ( a3 )
goto LABEL_9;
}
return 1;
}
LABEL_8:
if ( !a3 )
return 1;
LABEL_9:
v9 = (void *)EVP_CIPHER_CTX_iv_noconst(a1);
memcpy(v9, a3, 15 - *(_DWORD *)(cipher_data + 264));
*(_DWORD *)(cipher_data + 252) = 1;
return 1;
}