//
// asn1_do_adb from 0x7ca668 to 0x7ca7a4 (316 bytes)
//
// 19 xrefs:
// > sub_7C5148 @ 0x7c55d0
// > sub_7C5148 @ 0x7c5688
// > sub_7C5148 @ 0x7c5aa8
// > sub_7C626C @ 0x7c64cc
// > sub_7C626C @ 0x7c67d4
// > sub_7C626C @ 0x7c6978
// > ASN1_item_ex_d2i @ 0x7c6e9c
// > ASN1_item_ex_d2i @ 0x7c71e8
// > ASN1_item_ex_d2i @ 0x7c7364
// > ASN1_item_ex_i2d @ 0x7c7d9c
// > ASN1_item_ex_i2d @ 0x7c7eb0
// > asn1_template_free @ 0x7c895c
// > asn1_template_free @ 0x7c8cc0
// > ASN1_item_free @ 0x7c8fbc
// > ASN1_item_ex_free @ 0x7c9300
// > sub_867C80 @ 0x868048
// > sub_867C80 @ 0x868620
// > ASN1_item_print @ 0x8690a0
// > ??> @ 0x5ea4c
//
// 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 asn1_do_adb(_DWORD *a1, _DWORD *a2, int a3)
{
_DWORD *v3; // r6
int v5; // r0
int (__fastcall *v6)(int *); // r3
int v7; // r2
_DWORD *v8; // r1
int v9; // r3
_DWORD *result; // r0
int v11; // [sp+Ch] [bp-14h] BYREF
if ( (*a2 & 0x300) == 0 )
return a2;
v3 = (_DWORD *)a2[4];
v5 = *(_DWORD *)(*a1 + v3[1]);
if ( !v5 )
{
result = (_DWORD *)v3[6];
if ( result )
return result;
goto LABEL_19;
}
if ( (*a2 & 0x100) != 0 )
v11 = OBJ_obj2nid(v5);
else
v11 = ASN1_INTEGER_get();
v6 = (int (__fastcall *)(int *))v3[2];
if ( v6 && !v6(&v11) )
{
ERR_put_error(13, 110, 164, "crypto/asn1/tasn_utl.c", 213);
return nullptr;
}
v7 = v3[4];
v8 = (_DWORD *)v3[3];
if ( v7 > 0 )
{
if ( *v8 == v11 )
return v8 + 1;
v9 = 0;
while ( 1 )
{
++v9;
v8 += 6;
if ( v9 == v7 )
break;
if ( *v8 == v11 )
return v8 + 1;
}
}
result = (_DWORD *)v3[5];
if ( !result )
{
LABEL_19:
if ( a3 )
ERR_put_error(13, 110, 164, "crypto/asn1/tasn_utl.c", 238);
return nullptr;
}
return result;
}