//
// sub_A1268C from 0xa1268c to 0xa1280c (384 bytes)
//
// 3 xrefs:
// > ??> @ 0xc789d4
// > ??> @ 0xc78a08
// > ??> @ 0xc78a3c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:07:47 +0000
//
int __fastcall sub_A1268C(int a1, int a2, size_t a3, void *a4)
{
_DWORD *cipher_data; // r0
_DWORD *v9; // r5
int v12; // r0
int v13; // r0
cipher_data = (_DWORD *)EVP_CIPHER_CTX_get_cipher_data(a1);
v9 = cipher_data;
switch ( a2 )
{
case 0:
cipher_data[124] = 0;
cipher_data[125] = 0;
cipher_data[183] = EVP_CIPHER_CTX_iv_length(a1);
v12 = EVP_CIPHER_CTX_iv_noconst(a1);
v9[184] = 16;
v9[181] = 0;
v9[182] = 0;
v9[168] = v12;
return 1;
case 8:
v13 = EVP_CIPHER_CTX_get_cipher_data(a4);
return CRYPTO_ocb128_copy_ctx(v13 + 504, v9 + 126, v13, v13 + 248);
case 9:
if ( a3 - 1 > 0xE )
return 0;
cipher_data[183] = a3;
return 1;
case 16:
if ( cipher_data[184] != a3 || !EVP_CIPHER_CTX_encrypting(a1) )
return 0;
memcpy(a4, v9 + 169, a3);
return 1;
case 17:
if ( !a4 )
{
if ( a3 <= 0x10 )
{
cipher_data[184] = a3;
return 1;
}
return 0;
}
if ( cipher_data[184] != a3 || EVP_CIPHER_CTX_encrypting(a1) )
return 0;
memcpy(v9 + 169, a4, a3);
return 1;
default:
return -1;
}
}