//
// PKCS5_v2_PBE_keyivgen from 0x10e0b3c to 0x10e0d20 (484 bytes)
//
// 2 xrefs:
// > ??> @ 0xb9f50
// > ??> @ 0x153f458
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:17:48 +0000
//
__int64 __fastcall PKCS5_v2_PBE_keyivgen(
__int64 a1,
__int64 a2,
unsigned int a3,
__int64 a4,
__int64 a5,
__int64 a6,
unsigned int a7)
{
__int64 **v11; // x0
__int64 **v12; // x20
int v13; // w0
unsigned int v14; // w0
char *v15; // x0
unsigned int *cipherbyname; // x0
unsigned int v17; // w19
unsigned int v19; // w19
__int64 (__fastcall *v20)(__int64, __int64, _QWORD, __int64, _QWORD, _QWORD, _QWORD); // [xsp+48h] [xbp+48h] BYREF
v11 = (__int64 **)ASN1_TYPE_unpack_sequence((__int64)&PBE2PARAM_it, a4);
v12 = v11;
if ( v11 )
{
v13 = OBJ_obj2nid(**v11);
if ( (unsigned int)EVP_PBE_find(2, v13, nullptr, nullptr, &v20) )
{
v14 = OBJ_obj2nid(*v12[1]);
v15 = OBJ_nid2sn(v14);
cipherbyname = (unsigned int *)EVP_get_cipherbyname((__int64)v15);
v17 = (unsigned int)cipherbyname;
if ( !cipherbyname )
{
ERR_put_error(6, 118, 107, (__int64)"crypto/evp/p5_crpt2.c", 181);
goto LABEL_5;
}
v17 = 0;
if ( !(unsigned int)EVP_CipherInit_ex(a1, cipherbyname, 0, 0, nullptr, a7) )
{
LABEL_5:
PBE2PARAM_free(v12);
return v17;
}
if ( (EVP_CIPHER_asn1_to_param(a1, v12[1][1]) & 0x80000000) != 0 )
{
ERR_put_error(6, 118, 122, (__int64)"crypto/evp/p5_crpt2.c", 189);
goto LABEL_5;
}
v19 = v20(a1, a2, a3, (*v12)[1], 0, 0, a7);
PBE2PARAM_free(v12);
return v19;
}
else
{
ERR_put_error(6, 118, 124, (__int64)"crypto/evp/p5_crpt2.c", 170);
PBE2PARAM_free(v12);
return 0;
}
}
else
{
ERR_put_error(6, 118, 114, (__int64)"crypto/evp/p5_crpt2.c", 162);
PBE2PARAM_free(0);
return 0;
}
}