//
// sub_A4520C from 0xa4520c to 0xa45304 (248 bytes)
//
// 1 xrefs:
// > ??> @ 0xc80144
//
// 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:08:15 +0000
//
int __fastcall sub_A4520C(int a1, int a2, int *a3, int a4, int a5)
{
int v5; // r4
int v10; // r3
int result; // r0
int v12; // r9
void *v13; // r0
void *v14; // r0
v5 = *(_DWORD *)(a1 + 20);
v10 = *(_DWORD *)(a1 + 8);
if ( *(_DWORD *)(v5 + 16) == 4 )
{
v12 = RSA_size(*(_DWORD *)(v10 + 20));
v13 = *(void **)(v5 + 32);
if ( !v13 )
{
v14 = (void *)EVP_PKEY_size(*(_DWORD *)(a1 + 8));
v13 = CRYPTO_malloc(v14, (int)"crypto/rsa/rsa_pmeth.c", 91);
*(_DWORD *)(v5 + 32) = v13;
if ( !v13 )
return -1;
}
if ( !RSA_padding_add_PKCS1_OAEP_mgf1(v13, v12, a4, a5) )
return -1;
result = RSA_public_encrypt(v12, *(_DWORD *)(v5 + 32), a2, *(_DWORD *)(*(_DWORD *)(a1 + 8) + 20));
}
else
{
result = RSA_public_encrypt(a5, a4, a2, *(_DWORD *)(v10 + 20));
}
if ( result >= 0 )
{
*a3 = result;
return 1;
}
return result;
}