//
// PKCS12_pack_p7encdata from 0x8bb2e8 to 0x8bb474 (396 bytes)
//
// 1 xrefs:
// > ??> @ 0x6b39c
//
// 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
//
_DWORD *__fastcall PKCS12_pack_p7encdata(unsigned int a1, int a2, int a3, const void *a4, int a5, int a6, int a7)
{
_DWORD *v11; // r0
_DWORD *v12; // r4
char *v13; // r0
int cipherbyname; // r0
_DWORD *v15; // r5
int v16; // r0
_DWORD *v17; // r0
int v18; // r5
int v19; // r0
v11 = PKCS7_new();
v12 = v11;
if ( v11 )
{
if ( PKCS7_set_type((int)v11, 0x1Au) )
{
v13 = OBJ_nid2sn(a1);
cipherbyname = EVP_get_cipherbyname((int)v13);
if ( cipherbyname )
v15 = (_DWORD *)PKCS5_pbe2_set(cipherbyname, a6, a4, a5);
else
v15 = PKCS5_pbe_set(a1, a6, a4, a5);
if ( v15 )
{
X509_ALGOR_free(*(_DWORD **)(*(_DWORD *)(v12[5] + 4) + 4));
v16 = *(_DWORD *)(v12[5] + 4);
*(_DWORD *)(v16 + 4) = v15;
ASN1_OCTET_STRING_free(*(_DWORD *)(v16 + 8));
v17 = v15;
v18 = *(_DWORD *)(v12[5] + 4);
v19 = PKCS12_item_i2d_encrypt(v17, PKCS12_SAFEBAGS_it, a2, a3, a7, 1);
*(_DWORD *)(v18 + 8) = v19;
if ( v19 )
return v12;
ERR_put_error(35, 115, 103, (int)"crypto/pkcs12/p12_add.c", 119);
}
else
{
ERR_put_error(35, 115, 65, (int)"crypto/pkcs12/p12_add.c", 110);
}
}
else
{
ERR_put_error(35, 115, 120, (int)"crypto/pkcs12/p12_add.c", 98);
}
PKCS7_free(v12);
return nullptr;
}
else
{
ERR_put_error(35, 115, 65, (int)"crypto/pkcs12/p12_add.c", 93);
return nullptr;
}
}