//
// ASN1_item_pack from 0xe0e7cc to 0xe0e8fc (304 bytes)
//
// 10 xrefs:
// > sub_DD272C @ 0xdd2794
// > sub_DD2808 @ 0xdd2918
// > sub_DD2FF0 @ 0xdd3760
// > ASN1_TYPE_pack_sequence @ 0xe0ca94
// > PKCS5_pbe_set0_algor @ 0xe0f7a8
// > CMS_add0_recipient_password @ 0xe20aac
// > PKCS12_item_pack_safebag @ 0xe65600
// > PKCS12_pack_p7data @ 0xe656ec
// > PKCS12_pack_authsafes @ 0xe65a14
// > ??> @ 0x2d708
//
// 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
//
__int64 __fastcall ASN1_item_pack(__int64 a1, __int64 a2, __int64 *a3)
{
__int64 v6; // x19
int v7; // w0
__int64 result; // x0
if ( !a3 || (v6 = *a3) == 0 )
{
v6 = ASN1_STRING_new();
if ( !v6 )
{
ERR_put_error(13, 198, 65, (__int64)"crypto/asn1/asn_pack.c", 22);
return 0;
}
}
CRYPTO_free(*(void **)(v6 + 8), (__int64)"crypto/asn1/asn_pack.c", 29);
*(_QWORD *)(v6 + 8) = 0;
v7 = ASN1_item_i2d(a1, (__int64 *)(v6 + 8), a2);
*(_DWORD *)v6 = v7;
if ( v7 )
{
if ( *(_QWORD *)(v6 + 8) )
{
if ( !a3 )
return v6;
result = v6;
if ( !*a3 )
*a3 = v6;
return result;
}
ERR_put_error(13, 198, 65, (__int64)"crypto/asn1/asn_pack.c", 37);
}
else
{
ERR_put_error(13, 198, 112, (__int64)"crypto/asn1/asn_pack.c", 33);
}
if ( !a3 || (result = 0, !*a3) )
{
ASN1_STRING_free(v6);
return 0;
}
return result;
}