//
// sub_DA42CC from 0xda42cc to 0xda4524 (600 bytes)
//
// 3 xrefs:
// > ??> @ 0x1124018
// > ??> @ 0x1124070
// > ??> @ 0x11240c8
//
// 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_DA42CC(__int64 a1, __int64 a2, const void *a3)
{
__int64 cipher_data; // x19
__int64 result; // x0
__int64 v8; // x24
int v9; // w0
int v10; // w0
int v11; // w0
int v12; // w0
int v13; // w0
int v14; // w0
cipher_data = EVP_CIPHER_CTX_get_cipher_data(a1);
if ( a3 || (result = 1, a2) )
{
if ( a2 )
{
if ( (OPENSSL_armcap_P & 4) != 0 )
{
v8 = cipher_data + 504;
v13 = EVP_CIPHER_CTX_key_length(a1);
aes_v8_set_encrypt_key(a2, (unsigned int)(8 * v13), cipher_data);
v14 = EVP_CIPHER_CTX_key_length(a1);
aes_v8_set_decrypt_key(a2, (unsigned int)(8 * v14), cipher_data + 248);
if ( !(unsigned int)CRYPTO_ocb128_init(
cipher_data + 504,
cipher_data,
cipher_data + 248,
aes_v8_encrypt,
aes_v8_decrypt,
0) )
return 0;
}
else if ( (OPENSSL_armcap_P & 1) != 0 )
{
v8 = cipher_data + 504;
v9 = EVP_CIPHER_CTX_key_length(a1);
vpaes_set_encrypt_key(a2, (unsigned int)(8 * v9), cipher_data);
v10 = EVP_CIPHER_CTX_key_length(a1);
vpaes_set_decrypt_key(a2, (unsigned int)(8 * v10), cipher_data + 248);
if ( !(unsigned int)CRYPTO_ocb128_init(
cipher_data + 504,
cipher_data,
cipher_data + 248,
vpaes_encrypt,
vpaes_decrypt,
0) )
return 0;
}
else
{
v8 = cipher_data + 504;
v11 = EVP_CIPHER_CTX_key_length(a1);
AES_set_encrypt_key(a2, (unsigned int)(8 * v11), cipher_data);
v12 = EVP_CIPHER_CTX_key_length(a1);
AES_set_decrypt_key(a2, (unsigned int)(8 * v12), cipher_data + 248);
if ( !(unsigned int)CRYPTO_ocb128_init(
cipher_data + 504,
cipher_data,
cipher_data + 248,
AES_encrypt,
AES_decrypt,
0) )
return 0;
}
if ( a3 || *(_DWORD *)(cipher_data + 500) && (a3 = *(const void **)(cipher_data + 696)) != nullptr )
{
if ( (unsigned int)CRYPTO_ocb128_setiv(v8, a3, *(int *)(cipher_data + 760), *(int *)(cipher_data + 764)) != 1 )
return 0;
*(_DWORD *)(cipher_data + 500) = 1;
}
*(_DWORD *)(cipher_data + 496) = 1;
return 1;
}
else
{
if ( *(_DWORD *)(cipher_data + 496) )
CRYPTO_ocb128_setiv(cipher_data + 504, a3, *(int *)(cipher_data + 760), *(int *)(cipher_data + 764));
else
memcpy(*(void **)(cipher_data + 696), a3, *(int *)(cipher_data + 760));
*(_DWORD *)(cipher_data + 500) = 1;
return 1;
}
}
return result;
}