//
// i2v_GENERAL_NAME from 0x8507fc to 0x850aa0 (676 bytes)
//
// 3 xrefs:
// > i2v_GENERAL_NAMES @ 0x850b0c
// > sub_856F68 @ 0x856fb0
// > ??> @ 0x6885c
//
// 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 i2v_GENERAL_NAME(int a1, int *a2, int a3)
{
int v3; // r3
_DWORD *v5; // r3
unsigned __int8 *v6; // r7
unsigned __int8 *v7; // r4
unsigned __int8 *v8; // r7
int v9; // [sp+14h] [bp-110h] BYREF
char v10[8]; // [sp+18h] [bp-10Ch] BYREF
char v11[260]; // [sp+20h] [bp-104h] BYREF
v3 = *a2;
v9 = a3;
switch ( v3 )
{
case 0:
X509V3_add_value("othername", "", &v9);
return v9;
case 1:
X509V3_add_value_uchar("email", *(_DWORD *)(a2[1] + 8), &v9);
return v9;
case 2:
X509V3_add_value_uchar("DNS", *(_DWORD *)(a2[1] + 8), &v9);
return v9;
case 3:
X509V3_add_value("X400Name", "", &v9);
return v9;
case 4:
X509_NAME_oneline((int *)a2[1], v11, 0x100u);
X509V3_add_value("DirName", v11, &v9);
return v9;
case 5:
X509V3_add_value("EdiPartyName", "", &v9);
return v9;
case 6:
X509V3_add_value_uchar("URI", *(_DWORD *)(a2[1] + 8), &v9);
return v9;
case 7:
v5 = (_DWORD *)a2[1];
v6 = (unsigned __int8 *)v5[2];
if ( *v5 == 4 )
{
BIO_snprintf(v11, 0x100u, "%d.%d.%d.%d", *v6, v6[1], v6[2], v6[3]);
LABEL_15:
X509V3_add_value("IP Address", v11, &v9);
return v9;
}
if ( *v5 == 16 )
{
v11[0] = 0;
BIO_snprintf(v10, 5u, "%X", v6[1] | (*v6 << 8));
strcat(v11, v10);
v7 = v6 + 4;
v8 = v6 + 18;
do
{
v7 += 2;
strcat(v11, ":");
BIO_snprintf(v10, 5u, "%X", *(v7 - 3) | (*(v7 - 4) << 8));
strcat(v11, v10);
}
while ( v7 != v8 );
goto LABEL_15;
}
X509V3_add_value("IP Address", "", &v9);
return v9;
case 8:
i2t_ASN1_OBJECT((int)v11, 256, a2[1]);
X509V3_add_value("Registered ID", v11, &v9);
return v9;
default:
return v9;
}
}