//
// ASN1_item_free from 0xd6efd0 to 0xd6f2ec (796 bytes)
//
// 123 xrefs:
// > d2i_SSL_SESSION @ 0xd5fcb8
// > d2i_SSL_SESSION @ 0xd5ff88
// > d2i_SSL_SESSION @ 0xd5ffac
// > d2i_SSL_SESSION @ 0xd60024
// > ASN1_TIME_free @ 0xd677e4
// > PKCS8_PRIV_KEY_INFO_free @ 0xd6a638
// > sub_D6B828 @ 0xd6bab8
// > sub_D6B828 @ 0xd6c1a0
// > ASN1_NULL_free @ 0xd701ec
// > ASN1_TYPE_free @ 0xd7021c
// > ASN1_PRINTABLE_free @ 0xd7024c
// > DISPLAYTEXT_free @ 0xd7027c
// > DIRECTORYSTRING_free @ 0xd702ac
// > X509_ALGOR_free @ 0xd707b4
// > X9_62_PENTANOMIAL_free @ 0xd8d198
// > X9_62_CHARACTERISTIC_TWO_free @ 0xd8d1b8
// > ECPARAMETERS_free @ 0xd8d1d0
// > ECPKPARAMETERS_free @ 0xd8d200
// > EC_PRIVATEKEY_free @ 0xd8d240
// > OCSP_SIGNATURE_free @ 0xdc3264
// > OCSP_CERTID_free @ 0xdc3294
// > OCSP_ONEREQ_free @ 0xdc32c4
// > OCSP_REQINFO_free @ 0xdc32f4
// > OCSP_REQUEST_free @ 0xdc3324
// > OCSP_RESPBYTES_free @ 0xdc3354
// > OCSP_RESPONSE_free @ 0xdc3384
// > OCSP_RESPID_free @ 0xdc33b4
// > OCSP_REVOKEDINFO_free @ 0xdc33e4
// > OCSP_CERTSTATUS_free @ 0xdc3414
// > OCSP_SINGLERESP_free @ 0xdc3444
// > OCSP_RESPDATA_free @ 0xdc3474
// > OCSP_BASICRESP_free @ 0xdc34a4
// > OCSP_CRLID_free @ 0xdc34d4
// > OCSP_SERVICELOC_free @ 0xdc3504
// > PKCS12_free @ 0xdc9700
// > PKCS12_MAC_DATA_free @ 0xdc9730
// > PKCS12_BAGS_free @ 0xdc9760
// > PKCS12_SAFEBAG_free @ 0xdc9790
// > PKCS7_free @ 0xdcbf68
// > PKCS7_SIGNED_free @ 0xdcbfb4
// > PKCS7_SIGNER_INFO_free @ 0xdcbfe4
// > PKCS7_ISSUER_AND_SERIAL_free @ 0xdcc014
// > PKCS7_ENVELOPE_free @ 0xdcc044
// > PKCS7_RECIP_INFO_free @ 0xdcc074
// > PKCS7_ENC_CONTENT_free @ 0xdcc0a4
// > PKCS7_SIGN_ENVELOPE_free @ 0xdcc0d4
// > PKCS7_ENCRYPT_free @ 0xdcc104
// > PKCS7_DIGEST_free @ 0xdcc134
// > RSA_PSS_PARAMS_free @ 0xdd3840
// > RSA_OAEP_PARAMS_free @ 0xdd3870
// > X509_ATTRIBUTE_free @ 0xdf0650
// > X509_REVOKED_free @ 0xdf0e34
// > X509_CRL_INFO_free @ 0xdf0e74
// > X509_CRL_free @ 0xdf0ea4
// > X509_EXTENSION_free @ 0xdf1108
// > X509_NAME_ENTRY_free @ 0xdf113c
// > X509_NAME_free @ 0xdf18b8
// > X509_PUBKEY_free @ 0xdf1fa0
// > X509_REQ_INFO_free @ 0xdf26a8
// > X509_REQ_free @ 0xdf26d8
// > X509_CINF_free @ 0xdf2800
// > X509_free @ 0xdf2830
// > X509_CERT_AUX_free @ 0xdf2ad4
// > IPAddressFamily_free @ 0xdf4034
// > IPAddressRange_free @ 0xdf5464
// > IPAddressOrRange_free @ 0xdf5494
// > IPAddressChoice_free @ 0xdf588c
// > AUTHORITY_KEYID_free @ 0xdf7d94
// > ASRange_free @ 0xdf9640
// > ASIdOrRange_free @ 0xdf9670
// > ASIdentifierChoice_free @ 0xdf9a24
// > ASIdentifiers_free @ 0xdf9a54
// > sub_DFAB3C @ 0xdfac54
// > POLICYINFO_free @ 0xdfbb10
// > CERTIFICATEPOLICIES_free @ 0xdfbb40
// > POLICYQUALINFO_free @ 0xdfbb94
// > USERNOTICE_free @ 0xdfbbc4
// > NOTICEREF_free @ 0xdfc4b4
// > DIST_POINT_free @ 0xdfc6d4
// > DIST_POINT_NAME_free @ 0xdfcca0
// > CRL_DIST_POINTS_free @ 0xdfd25c
// > ISSUING_DIST_POINT_free @ 0xdfd28c
// > OTHERNAME_free @ 0xdfd7d8
// > EDIPARTYNAME_free @ 0xdfd808
// > GENERAL_NAME_free @ 0xdfd820
// > GENERAL_NAMES_free @ 0xdfd850
// > ACCESS_DESCRIPTION_free @ 0xdfdbec
// > AUTHORITY_INFO_ACCESS_free @ 0xdfde98
// > GENERAL_SUBTREE_free @ 0xdfec8c
// > NAME_CONSTRAINTS_free @ 0xdfeca4
// > PROXY_POLICY_free @ 0xdffa50
// > PROXY_CERT_INFO_EXTENSION_free @ 0xdffa80
// > POLICY_CONSTRAINTS_free @ 0xdffae8
// > PKEY_USAGE_PERIOD_free @ 0xdffd4c
// > POLICY_MAPPING_free @ 0xdffdf4
// > X509V3_EXT_print @ 0xe002bc
// > SXNETID_free @ 0xe02088
// > SXNET_free @ 0xe020b8
// > TLS_FEATURE_free @ 0xe028ac
// > ASN1_TYPE_get_int_octetstring @ 0xe0eb38
// > ASN1_TYPE_get_int_octetstring @ 0xe0ebe0
// > NETSCAPE_CERT_SEQUENCE_free @ 0xe0f6bc
// > PBEPARAM_free @ 0xe0f6ec
// > X509_SIG_free @ 0xe119d0
// > NETSCAPE_SPKAC_free @ 0xe11a38
// > NETSCAPE_SPKI_free @ 0xe11a68
// > X509_VAL_free @ 0xe11a98
// > CMS_add0_recipient_key @ 0xe1dc1c
// > CMS_add1_recipient_cert @ 0xe1ea38
// > cms_RecipientInfo_kari_init @ 0xe1f4a8
// > CMS_ContentInfo_free @ 0xe1f804
// > CMS_add0_CertificateChoices @ 0xe2013c
// > CMS_add0_RevocationInfoChoice @ 0xe20374
// > cms_set1_ias @ 0xe207b0
// > cms_set1_ias @ 0xe2080c
// > CMS_add0_recipient_password @ 0xe20c24
// > CMS_add1_signer @ 0xe22ad8
// > BASIC_CONSTRAINTS_free @ 0xe6fdac
// > EXTENDED_KEY_USAGE_free @ 0xe70394
// > PBE2PARAM_free @ 0xe72964
// > PBKDF2PARAM_free @ 0xe72994
// > SCRYPT_PARAMS_free @ 0xe72e08
// > ??> @ 0x6db90
//
// 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_free(__int64 result, unsigned __int8 *a2)
{
int v3; // w1
__int64 v4; // x2
void (__fastcall *v5)(__int64, __int64 *, unsigned __int8 *, _QWORD); // x24
__int64 (__fastcall *v6)(__int64 *, unsigned __int8 *); // x2
int v7; // w0
__int64 v8; // x2
__int64 v9; // x20
__int64 v10; // x22
__int64 v11; // x0
__int64 *v12; // x21
_QWORD *field_ptr; // x0
int choice_selector; // w0
__int64 *v16; // x19
_QWORD *v17; // x0
__int64 v18; // x2
__int64 *v19; // x20
_QWORD *v20; // x0
__int64 v21; // [xsp+48h] [xbp+48h] BYREF
v21 = result;
v3 = *a2;
v4 = *((_QWORD *)a2 + 4);
if ( v3 )
{
if ( !result )
return result;
if ( v4 )
goto LABEL_4;
switch ( v3 )
{
case 1:
case 6:
v5 = nullptr;
LABEL_35:
result = asn1_do_lock(&v21, 0xFFFFFFFFLL, a2);
if ( !(_DWORD)result )
{
asn1_enc_free(&v21, a2);
v18 = *((_QWORD *)a2 + 3);
v9 = *((_QWORD *)a2 + 2) + 40 * v18;
if ( v18 > 0 )
{
LABEL_22:
v10 = 1;
do
{
v9 -= 40;
v11 = asn1_do_adb(&v21, v9, 0);
v12 = (__int64 *)v11;
if ( v11 )
{
field_ptr = (_QWORD *)asn1_get_field_ptr(&v21, v11);
asn1_template_free(field_ptr, v12);
}
}
while ( v10++ < *((_QWORD *)a2 + 3) );
if ( v5 )
LABEL_27:
v5(3, &v21, a2, 0);
}
result = CRYPTO_free(v21, "crypto/asn1/tasn_fre.c", 119);
}
break;
case 2:
LABEL_30:
choice_selector = asn1_get_choice_selector(&v21, a2);
if ( (choice_selector & 0x80000000) == 0 && choice_selector < *((_QWORD *)a2 + 3) )
{
v16 = (__int64 *)(*((_QWORD *)a2 + 2) + 40LL * choice_selector);
v17 = (_QWORD *)asn1_get_field_ptr(&v21, v16);
asn1_template_free(v17, v16);
}
LABEL_18:
result = CRYPTO_free(v21, "crypto/asn1/tasn_fre.c", 79);
break;
case 5:
return asn1_primitive_free(&v21, (__int64)a2, 0);
default:
return result;
}
}
else
{
if ( v4 )
{
LABEL_4:
v5 = *(void (__fastcall **)(__int64, __int64 *, unsigned __int8 *, _QWORD))(v4 + 24);
if ( v5 )
{
switch ( v3 )
{
case 0:
goto LABEL_8;
case 1:
case 6:
result = asn1_do_lock(&v21, 0xFFFFFFFFLL, a2);
if ( (_DWORD)result )
return result;
result = ((__int64 (__fastcall *)(__int64, __int64 *, unsigned __int8 *, _QWORD))v5)(2, &v21, a2, 0);
if ( (_DWORD)result == 2 )
return result;
asn1_enc_free(&v21, a2);
v8 = *((_QWORD *)a2 + 3);
v9 = *((_QWORD *)a2 + 2) + 40 * v8;
if ( v8 > 0 )
goto LABEL_22;
goto LABEL_27;
case 2:
result = ((__int64 (__fastcall *)(__int64, __int64 *, unsigned __int8 *, _QWORD))v5)(2, &v21, a2, 0);
if ( (_DWORD)result == 2 )
return result;
v7 = asn1_get_choice_selector(&v21, a2);
if ( (v7 & 0x80000000) == 0 && v7 < *((_QWORD *)a2 + 3) )
{
v19 = (__int64 *)(*((_QWORD *)a2 + 2) + 40LL * v7);
v20 = (_QWORD *)asn1_get_field_ptr(&v21, v19);
asn1_template_free(v20, v19);
}
v5(3, &v21, a2, 0);
goto LABEL_18;
case 4:
goto LABEL_11;
case 5:
return asn1_primitive_free(&v21, (__int64)a2, 0);
default:
return result;
}
}
switch ( v3 )
{
case 0:
goto LABEL_8;
case 1:
case 6:
goto LABEL_35;
case 2:
goto LABEL_30;
case 4:
LABEL_11:
v6 = *(__int64 (__fastcall **)(__int64 *, unsigned __int8 *))(v4 + 16);
if ( v6 )
result = v6(&v21, a2);
break;
case 5:
return asn1_primitive_free(&v21, (__int64)a2, 0);
default:
return result;
}
return result;
}
LABEL_8:
if ( *((_QWORD *)a2 + 2) )
return asn1_template_free(&v21, *((__int64 **)a2 + 2));
else
return asn1_primitive_free(&v21, (__int64)a2, 0);
}
return result;
}