//
// PKCS12_pack_p7encdata from 0x10e37dc to 0x10e3984 (424 bytes)
//
// 1 xrefs:
// > ??> @ 0x58d50
//
// 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:50 +0000
//
__int64 __fastcall PKCS12_pack_p7encdata(
unsigned int a1,
__int64 a2,
unsigned int a3,
const void *a4,
unsigned int a5,
unsigned int a6,
__int64 a7)
{
__int64 v14; // x0
__int64 v15; // x19
char *v16; // x0
__int64 cipherbyname; // x0
__int64 *v18; // x20
__int64 v19; // x5
__int64 v20; // x0
__int64 *v21; // x0
__int64 v22; // x20
__int64 v23; // x1
__int64 result; // x0
v14 = PKCS7_new();
v15 = v14;
if ( !v14 )
{
ERR_put_error(35, 115, 65, (__int64)"crypto/pkcs12/p12_add.c", 93);
return 0;
}
if ( !(unsigned int)PKCS7_set_type(v14, 0x1Au) )
{
ERR_put_error(35, 115, 120, (__int64)"crypto/pkcs12/p12_add.c", 98);
LABEL_10:
PKCS7_free(v15);
return 0;
}
v16 = OBJ_nid2sn(a1);
cipherbyname = EVP_get_cipherbyname((__int64)v16);
if ( cipherbyname )
v18 = (__int64 *)PKCS5_pbe2_set(cipherbyname, a6, a4, a5);
else
v18 = PKCS5_pbe_set(a1, a6, a4, a5);
if ( !v18 )
{
ERR_put_error(35, 115, 65, (__int64)"crypto/pkcs12/p12_add.c", 110);
goto LABEL_10;
}
X509_ALGOR_free(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v15 + 32) + 8LL) + 8LL));
v19 = *(_QWORD *)(*(_QWORD *)(v15 + 32) + 8LL);
v20 = *(_QWORD *)(v19 + 16);
*(_QWORD *)(v19 + 8) = v18;
ASN1_OCTET_STRING_free(v20);
v21 = v18;
v22 = *(_QWORD *)(*(_QWORD *)(v15 + 32) + 8LL);
v23 = PKCS12_item_i2d_encrypt(v21, &PKCS12_SAFEBAGS_it, a2, a3, a7, 1);
*(_QWORD *)(v22 + 16) = v23;
result = v15;
if ( !v23 )
{
ERR_put_error(35, 115, 103, (__int64)"crypto/pkcs12/p12_add.c", 119);
goto LABEL_10;
}
return result;
}