//
// ASN1_item_pack from 0x8667c4 to 0x8668f0 (300 bytes)
//
// 10 xrefs:
// > sub_82C0A8 @ 0x82c10c
// > sub_82C184 @ 0x82c2b4
// > sub_82C9FC @ 0x82d1cc
// > ASN1_TYPE_pack_sequence @ 0x8647e4
// > PKCS5_pbe_set0_algor @ 0x867668
// > CMS_add0_recipient_password @ 0x8760e8
// > PKCS12_item_pack_safebag @ 0x8bb0dc
// > PKCS12_pack_p7data @ 0x8bb1dc
// > PKCS12_pack_authsafes @ 0x8bb504
// > ??> @ 0x6612c
//
// 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
//
int __fastcall ASN1_item_pack(size_t *a1, unsigned __int8 *a2, int *a3)
{
int v6; // r4
int v7; // r0
if ( !a3 || (v6 = *a3) == 0 )
{
v6 = ASN1_STRING_new();
if ( !v6 )
{
ERR_put_error(13, 198, 65, (int)"crypto/asn1/asn_pack.c", 22);
return 0;
}
}
CRYPTO_free(*(void **)(v6 + 8), (int)"crypto/asn1/asn_pack.c", 29);
*(_DWORD *)(v6 + 8) = 0;
v7 = ASN1_item_i2d(a1, (int *)(v6 + 8), a2);
*(_DWORD *)v6 = v7;
if ( v7 )
{
if ( *(_DWORD *)(v6 + 8) )
{
if ( !a3 || *a3 )
return v6;
*a3 = v6;
return v6;
}
ERR_put_error(13, 198, 65, (int)"crypto/asn1/asn_pack.c", 37);
}
else
{
ERR_put_error(13, 198, 112, (int)"crypto/asn1/asn_pack.c", 33);
}
if ( a3 && *a3 )
return 0;
ASN1_STRING_free(v6);
return 0;
}