//
// s2i_ASN1_INTEGER from 0x85d018 to 0x85d1c8 (432 bytes)
//
// 9 xrefs:
// > sub_852A80 @ 0x852b5c
// > sub_852A80 @ 0x852b70
// > sub_854B10 @ 0x854f50
// > SXNET_add_id_asc @ 0x85bad0
// > SXNET_get_id_asc @ 0x85bc24
// > X509V3_get_value_int @ 0x85d454
// > sub_864F7C @ 0x86557c
// > sub_8C477C @ 0x8c4780
// > ??> @ 0x68b0c
//
// 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 s2i_ASN1_INTEGER(int a1, unsigned __int8 *a2)
{
int v2; // r5
unsigned __int8 *v3; // r4
int v4; // r3
int v5; // r0
int v6; // r4
int v8; // r4
int **v9; // [sp+Ch] [bp-4h] BYREF
v2 = 0;
v3 = a2;
v9 = nullptr;
if ( a2 )
{
v9 = (int **)BN_new();
if ( v9 )
{
v4 = *v3;
if ( v4 == 45 )
{
v4 = v3[1];
v2 = 1;
++v3;
}
if ( v4 == 48 && (v3[1] & 0xDF) == 0x58 )
{
v3 += 2;
v5 = BN_hex2bn(&v9, v3);
}
else
{
v5 = BN_dec2bn(&v9, v3);
}
if ( !v5 || v3[v5] )
{
BN_free((int)v9);
ERR_put_error(34, 108, 100, (int)"crypto/x509v3/v3_utl.c", 159);
return 0;
}
else
{
if ( !v2 || BN_is_zero((int)v9) )
{
v6 = BN_to_ASN1_INTEGER(v9, 0);
BN_free((int)v9);
if ( v6 )
return v6;
}
else
{
v8 = BN_to_ASN1_INTEGER(v9, 0);
BN_free((int)v9);
if ( v8 )
{
*(_DWORD *)(v8 + 4) |= 0x100u;
return v8;
}
}
ERR_put_error(34, 108, 101, (int)"crypto/x509v3/v3_utl.c", 170);
return 0;
}
}
else
{
ERR_put_error(34, 108, 65, (int)"crypto/x509v3/v3_utl.c", 137);
return 0;
}
}
else
{
ERR_put_error(34, 108, 109, (int)"crypto/x509v3/v3_utl.c", 132);
return 0;
}
}