//
// s2i_ASN1_INTEGER from 0x1081c54 to 0x1081dfc (424 bytes)
//
// 9 xrefs:
// > sub_1078130 @ 0x1078280
// > sub_1078130 @ 0x1078290
// > sub_1079F2C @ 0x107a42c
// > SXNET_add_id_asc @ 0x108069c
// > SXNET_get_id_asc @ 0x108081c
// > X509V3_get_value_int @ 0x1082030
// > sub_108B494 @ 0x108b8cc
// > sub_10EE4E0 @ 0x10ee4e4
// > ??> @ 0x8e840
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:17:10 +0000
//
__int64 __fastcall s2i_ASN1_INTEGER(__int64 a1, unsigned __int8 *a2)
{
unsigned __int8 *v2; // x19
int v3; // w0
int v4; // w20
int v5; // w0
__int64 v6; // x19
int v8; // w0
__int64 v9; // x19
__int64 v10; // [xsp+28h] [xbp+28h] BYREF
v2 = a2;
v10 = 0;
if ( !a2 )
{
ERR_put_error(34, 108, 109, (__int64)"crypto/x509v3/v3_utl.c", 132);
return 0;
}
v10 = BN_new();
if ( !v10 )
{
ERR_put_error(34, 108, 65, (__int64)"crypto/x509v3/v3_utl.c", 137);
return 0;
}
v3 = *v2;
v4 = 0;
if ( v3 == 45 )
{
v8 = v2[1];
v4 = 1;
++v2;
if ( v8 != 48 )
goto LABEL_5;
}
else if ( v3 != 48 )
{
goto LABEL_5;
}
if ( (v2[1] & 0xDF) == 0x58 )
{
v2 += 2;
v5 = BN_hex2bn(&v10, v2);
goto LABEL_6;
}
LABEL_5:
v5 = BN_dec2bn(&v10, v2);
LABEL_6:
if ( !v5 || v2[v5] )
{
BN_free(v10);
ERR_put_error(34, 108, 100, (__int64)"crypto/x509v3/v3_utl.c", 159);
return 0;
}
else
{
if ( !v4 || BN_is_zero(v10) )
{
v6 = BN_to_ASN1_INTEGER(v10, 0);
BN_free(v10);
if ( v6 )
return v6;
}
else
{
v9 = BN_to_ASN1_INTEGER(v10, 0);
BN_free(v10);
if ( v9 )
{
*(_DWORD *)(v9 + 4) |= 0x100u;
return v9;
}
}
ERR_put_error(34, 108, 101, (__int64)"crypto/x509v3/v3_utl.c", 170);
return 0;
}
}