//
// ASN1_get_object from 0x7c26c4 to 0x7c28c8 (516 bytes)
//
// 23 xrefs:
// > tls_process_client_key_exchange @ 0x7ab0d4
// > d2i_ASN1_OBJECT @ 0x7bdd2c
// > sub_7C2E4C @ 0x7c2f10
// > sub_7C3F3C @ 0x7c4020
// > sub_7C3F3C @ 0x7c4168
// > sub_7C41C0 @ 0x7c42a8
// > sub_7C41C0 @ 0x7c436c
// > sub_7C43BC @ 0x7c4498
// > sub_7C46C4 @ 0x7c47fc
// > sub_7C46C4 @ 0x7c4d48
// > sub_7C46C4 @ 0x7c4e38
// > sub_7C5EB8 @ 0x7c5fd8
// > sub_7C5EB8 @ 0x7c61d8
// > ASN1_d2i_bio @ 0x860130
// > ASN1_item_d2i_bio @ 0x8605d4
// > d2i_ASN1_UINTEGER @ 0x861c94
// > d2i_ASN1_UINTEGER @ 0x861d00
// > sub_864F7C @ 0x865248
// > DH_KDF_X9_42 @ 0x8d0c04
// > DH_KDF_X9_42 @ 0x8d0c7c
// > DH_KDF_X9_42 @ 0x8d0cc8
// > DH_KDF_X9_42 @ 0x8d0d1c
// > ??> @ 0x5d63c
//
// 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_get_object(unsigned __int8 **a1, int *a2, int *a3, int *a4, int a5)
{
unsigned __int8 *v6; // r7
unsigned __int8 v7; // r0
int v8; // r12
int v9; // r4
int v11; // r4
unsigned __int8 *v12; // r8
int v13; // r9
_BOOL4 v14; // r5
int v15; // r12
int v16; // t1
int v17; // r11
unsigned __int8 *v18; // r5
int v19; // r3
int v20; // r9
bool v21; // zf
int v22; // r3
unsigned __int8 *v23; // r8
int v24; // r2
int v25; // r4
int v26; // r0
unsigned __int8 *v27; // r5
v6 = *a1;
if ( !a5 )
goto LABEL_4;
v7 = *v6;
v8 = *v6 & 0x1F;
if ( v8 == 31 )
{
v11 = a5 - 1;
if ( a5 == 1 )
goto LABEL_4;
v12 = v6 + 1;
v13 = 0;
while ( 1 )
{
v16 = *v12++;
v15 = v16;
v17 = v16 & 0x7F;
if ( (v16 & 0x80) == 0 )
break;
v14 = --v11 == 0;
v13 = v17 | (v13 << 7);
if ( v13 > 0xFFFFFF )
v14 = 1;
if ( v14 )
goto LABEL_4;
}
v9 = v11 - 1;
if ( !v9 )
goto LABEL_4;
v18 = v12;
v8 = v15 | (v13 << 7);
}
else
{
v9 = a5 - 1;
if ( a5 == 1 )
{
LABEL_4:
ERR_put_error(13, 114, 123, "crypto/asn1/asn1_lib.c", 101);
return 128;
}
v18 = v6 + 1;
}
*a3 = v8;
*a4 = v7 & 0xC0;
if ( v9 <= 0 )
goto LABEL_4;
v19 = *v18;
v20 = v7 & 0x20;
if ( v19 != 128 )
{
v21 = (v19 & 0x80) == 0;
v22 = v19 & 0x7F;
v23 = v18 + 1;
if ( v21 )
{
v24 = v22;
}
else
{
if ( v9 - 1 <= v22 )
goto LABEL_4;
if ( v22 )
{
if ( v18[1] )
{
LABEL_37:
if ( (unsigned int)v22 > 4 )
goto LABEL_4;
v24 = *v23;
if ( v22 != 1 )
{
v24 = v23[1] | (v24 << 8);
if ( v22 != 2 )
{
v24 = v23[2] | (v24 << 8);
if ( v22 != 3 )
v24 = v23[3] | (v24 << 8);
}
}
v23 += v22;
if ( v24 < 0 )
goto LABEL_4;
goto LABEL_21;
}
v27 = v18 + 2;
while ( 1 )
{
--v22;
v23 = v27;
if ( !v22 )
break;
if ( *v27++ )
goto LABEL_37;
}
}
v24 = 0;
}
LABEL_21:
v25 = 0;
*a2 = v24;
goto LABEL_22;
}
v24 = 0;
*a2 = 0;
if ( (v7 & 0x20) == 0 )
goto LABEL_4;
v23 = v18 + 1;
v25 = 1;
LABEL_22:
if ( v6 - v23 + a5 < v24 )
{
ERR_put_error(13, 114, 155, "crypto/asn1/asn1_lib.c", 91);
if ( v20 )
v26 = 160;
else
v26 = 128;
}
else
{
v26 = v7 & 0x20;
}
*a1 = v23;
return v26 | v25;
}