//
// a2i_GENERAL_NAME from 0x850d6c to 0x8510f8 (908 bytes)
//
// 2 xrefs:
// > v2i_GENERAL_NAME_ex @ 0x8511c8
// > ??> @ 0x6889c
//
// 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 a2i_GENERAL_NAME(_DWORD *a1, int a2, int a3, int a4, char *a5, int a6)
{
_DWORD *v9; // r4
signed int *v10; // r8
size_t v11; // r0
_DWORD *result; // r0
_DWORD *v13; // r9
int section; // r10
char *v15; // r9
int v16; // r0
int v17; // r1
int v18; // r8
int v19; // r0
unsigned __int8 *v20; // r0
unsigned __int8 *v21; // r7
char ***v22; // r9
int v23; // r0
char **v24; // r0
int v25; // r0
if ( a5 )
{
if ( a1 )
{
v9 = a1;
}
else
{
v25 = GENERAL_NAME_new();
v9 = (_DWORD *)v25;
if ( !v25 )
{
ERR_put_error(34, 164, 65, (int)"crypto/x509v3/v3_alt.c", 401);
return nullptr;
}
}
switch ( a4 )
{
case 0:
v15 = strchr(a5, 59);
if ( v15 )
{
v16 = OTHERNAME_new();
v9[1] = v16;
if ( v16 )
{
ASN1_TYPE_free(*(_DWORD **)(v16 + 4));
v17 = a3;
v18 = v9[1];
v19 = ASN1_generate_v3(v15 + 1, v17);
*(_DWORD *)(v18 + 4) = v19;
if ( v19 )
{
v20 = CRYPTO_strndup((unsigned __int8 *)a5, v15 - a5, (int)"crypto/x509v3/v3_alt.c", 531);
v21 = v20;
if ( v20 )
{
v22 = (char ***)v9[1];
*v22 = OBJ_txt2obj((char *)v20, 0);
CRYPTO_free(v21, (int)"crypto/x509v3/v3_alt.c", 535);
if ( *(_DWORD *)v9[1] )
goto LABEL_16;
}
}
}
}
ERR_put_error(34, 164, 147, (int)"crypto/x509v3/v3_alt.c", 446);
goto LABEL_9;
case 1:
case 2:
case 6:
v10 = (signed int *)ASN1_IA5STRING_new();
v9[1] = v10;
if ( v10 )
{
v11 = strlen(a5);
if ( ASN1_STRING_set(v10, a5, v11) )
goto LABEL_16;
}
ERR_put_error(34, 164, 65, (int)"crypto/x509v3/v3_alt.c", 459);
goto LABEL_9;
case 4:
v13 = X509_NAME_new();
if ( v13 )
{
section = X509V3_get_section(a3, a5);
if ( section )
{
if ( X509V3_NAME_from_section(v13, section, 4097) )
{
v9[1] = v13;
X509V3_section_free(a3, section);
goto LABEL_16;
}
}
else
{
ERR_put_error(34, 144, 150, (int)"crypto/x509v3/v3_alt.c", 551);
ERR_add_error_data(2, "section=", a5);
}
}
else
{
section = 0;
}
X509_NAME_free(v13);
X509V3_section_free(a3, section);
ERR_put_error(34, 164, 149, (int)"crypto/x509v3/v3_alt.c", 439);
goto LABEL_9;
case 7:
if ( a6 )
v23 = a2i_IPADDRESS_NC(a5, a2);
else
v23 = a2i_IPADDRESS(a5);
v9[1] = v23;
if ( v23 )
goto LABEL_16;
ERR_put_error(34, 164, 118, (int)"crypto/x509v3/v3_alt.c", 431);
ERR_add_error_data(2, "value=", a5);
goto LABEL_9;
case 8:
v24 = OBJ_txt2obj(a5, 0);
if ( v24 )
{
v9[1] = v24;
LABEL_16:
*v9 = a4;
result = v9;
}
else
{
ERR_put_error(34, 164, 119, (int)"crypto/x509v3/v3_alt.c", 417);
ERR_add_error_data(2, "value=", a5);
LABEL_9:
if ( !a1 )
GENERAL_NAME_free(v9);
result = nullptr;
}
break;
default:
ERR_put_error(34, 164, 167, (int)"crypto/x509v3/v3_alt.c", 451);
goto LABEL_9;
}
}
else
{
ERR_put_error(34, 164, 124, (int)"crypto/x509v3/v3_alt.c", 392);
return nullptr;
}
return result;
}