//
// sub_853810 from 0x853810 to 0x8539b0 (416 bytes)
//
// 2 xrefs:
// > X509V3_EXT_nconf @ 0x853e94
// > X509V3_EXT_nconf_nid @ 0x854078
//
// 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
//
const char ***__fastcall sub_853810(char *a1, const char *a2, int a3, int a4, int a5)
{
char **v9; // r7
const char ***v10; // r5
int v11; // r4
void *v12; // r6
int *v14; // r0
int v15; // r3
size_t *v16; // r0
size_t *v17; // r4
int v18; // [sp+8h] [bp-Ch] BYREF
void *v19; // [sp+Ch] [bp-8h] BYREF
v18 = 0;
v9 = OBJ_txt2obj(a1, 0);
if ( !v9 )
{
ERR_put_error(34, 116, 115, (int)"crypto/x509v3/v3_conf.c", 234);
ERR_add_error_data(2, "name=", a1);
v10 = nullptr;
v11 = 0;
v12 = nullptr;
goto LABEL_5;
}
if ( a4 == 1 )
{
v12 = (void *)OPENSSL_hexstr2buf(a2, &v18);
}
else
{
if ( a4 != 2 )
goto LABEL_4;
v19 = nullptr;
v16 = (size_t *)ASN1_generate_v3(a2, a5);
v17 = v16;
if ( !v16 )
goto LABEL_4;
v18 = i2d_ASN1_TYPE(v16, (int *)&v19);
ASN1_TYPE_free(v17);
v12 = v19;
}
if ( !v12 )
{
LABEL_4:
ERR_put_error(34, 116, 116, (int)"crypto/x509v3/v3_conf.c", 246);
ERR_add_error_data(2, "value=", a2);
v10 = nullptr;
v11 = 0;
v12 = nullptr;
goto LABEL_5;
}
v14 = (int *)ASN1_OCTET_STRING_new();
v11 = (int)v14;
if ( v14 )
{
v15 = v18;
v14[2] = (int)v12;
*v14 = v15;
v12 = nullptr;
v10 = X509_EXTENSION_create_by_OBJ(nullptr, (const char **)v9, a3, v14);
}
else
{
ERR_put_error(34, 116, 65, (int)"crypto/x509v3/v3_conf.c", 252);
v10 = nullptr;
}
LABEL_5:
ASN1_OBJECT_free(v9);
ASN1_OCTET_STRING_free(v11);
CRYPTO_free(v12, (int)"crypto/x509v3/v3_conf.c", 265);
return v10;
}