//
// PKCS12_pbe_crypt from 0xad0720 to 0xad08d8 (440 bytes)
//
// 3 xrefs:
// > PKCS12_item_decrypt_d2i @ 0xad0924
// > PKCS12_item_i2d_encrypt @ 0xad0a5c
// > ??> @ 0x84edc
//
// 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:09:23 +0000
//
void *__fastcall PKCS12_pbe_crypt(int *a1, const char *a2, size_t a3, char *a4, size_t a5, _DWORD *a6, int *a7, int a8)
{
int *v12; // r5
void *v13; // r4
int v14; // r0
int v15; // r6
int v16; // r6
int v18[2]; // [sp+Ch] [bp-8h] BYREF
v12 = (int *)EVP_CIPHER_CTX_new();
if ( v12 )
{
v13 = (void *)EVP_PBE_CipherInit(*a1, a2, a3, a1[1], (int)v12, a8);
if ( v13 )
{
v14 = EVP_CIPHER_CTX_block_size((int)v12);
v13 = CRYPTO_malloc((void *)(v14 + a5), (int)"crypto/pkcs12/p12_decr.c", 45);
if ( v13 )
{
if ( EVP_CipherUpdate(v12, (char *)v13, v18, a4, a5) )
{
v15 = v18[0];
if ( EVP_CipherFinal_ex(v12, (unsigned int)v13 + v18[0], v18) )
{
v16 = v15 + v18[0];
if ( a7 )
*a7 = v16;
if ( a6 )
*a6 = v13;
}
else
{
CRYPTO_free(v13, (int)"crypto/pkcs12/p12_decr.c", 60);
v13 = nullptr;
ERR_put_error(35, 119, 116, (int)"crypto/pkcs12/p12_decr.c", 63);
}
}
else
{
CRYPTO_free(v13, (int)"crypto/pkcs12/p12_decr.c", 52);
v13 = nullptr;
ERR_put_error(35, 119, 6, (int)"crypto/pkcs12/p12_decr.c", 54);
}
}
else
{
ERR_put_error(35, 119, 65, (int)"crypto/pkcs12/p12_decr.c", 47);
}
}
else
{
ERR_put_error(35, 119, 115, (int)"crypto/pkcs12/p12_decr.c", 41);
}
}
else
{
ERR_put_error(35, 119, 65, (int)"crypto/pkcs12/p12_decr.c", 33);
v13 = nullptr;
}
EVP_CIPHER_CTX_free(v12);
return v13;
}