//
// sub_8661C0 from 0x8661c0 to 0x8663b8 (504 bytes)
//
// 3 xrefs:
// > ASN1_add_oid_module @ 0x8663cc
// > ASN1_add_oid_module @ 0x8663d8
// > ??> @ 0x8663e8
//
// 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 sub_8661C0(int a1, int a2)
{
int value; // r0
signed int v4; // r5
int section; // r0
_DWORD *v6; // r6
int v7; // r0
char *v8; // r10
int v9; // r7
char *v10; // r0
char *v11; // r4
int v12; // r3
char *v13; // r0
int v14; // t1
char *v15; // r7
int v16; // t1
int v17; // r3
char *v18; // r4
int v19; // t1
size_t v21; // r4
char *v22; // r0
char *v23; // r11
value = CONF_imodule_get_value(a1);
v4 = 0;
section = NCONF_get_section(a2, value);
v6 = (_DWORD *)section;
if ( !section )
{
ERR_put_error(13, 174, 172, (int)"crypto/asn1/asn_moid.c", 32);
return 0;
}
if ( OPENSSL_sk_num(section) <= 0 )
return 1;
while ( 1 )
{
v7 = OPENSSL_sk_value(v6, v4);
v8 = *(char **)(v7 + 8);
v9 = *(_DWORD *)(v7 + 4);
v10 = strrchr(v8, 44);
v11 = v10;
if ( !v10 )
{
if ( !OBJ_create(v8, v9, v9) )
goto LABEL_14;
++v4;
goto LABEL_17;
}
v12 = (unsigned __int8)v10[1];
if ( !v10[1] )
goto LABEL_14;
v13 = v10 + 1;
if ( (*(_BYTE *)(ctype_ + v12 + 1) & 8) != 0 )
{
do
v14 = (unsigned __int8)*++v13;
while ( (*(_BYTE *)(ctype_ + v14 + 1) & 8) != 0 );
}
v15 = OBJ_create(v13, v9, 0);
if ( !v15 )
goto LABEL_14;
if ( (*(_BYTE *)(ctype_ + (unsigned __int8)*v8 + 1) & 8) != 0 )
{
do
v16 = (unsigned __int8)*++v8;
while ( (*(_BYTE *)(ctype_ + v16 + 1) & 8) != 0 );
}
v17 = (unsigned __int8)*(v11 - 1);
v18 = v11 - 1;
if ( (*(_BYTE *)(ctype_ + v17 + 1) & 8) != 0 )
break;
LABEL_20:
v21 = v18 + 1 - v8;
v22 = (char *)CRYPTO_malloc((void *)(v21 + 1), (int)"crypto/asn1/asn_moid.c", 95);
v23 = v22;
if ( !v22 )
goto LABEL_14;
memcpy(v22, v8, v21);
v23[v21] = 0;
++v4;
OBJ_nid2obj((unsigned int)v15)[1] = v23;
LABEL_17:
if ( v4 >= OPENSSL_sk_num((int)v6) )
return 1;
}
while ( v8 != v18 )
{
v19 = (unsigned __int8)*--v18;
if ( (*(_BYTE *)(ctype_ + v19 + 1) & 8) == 0 )
goto LABEL_20;
}
LABEL_14:
ERR_put_error(13, 174, 171, (int)"crypto/asn1/asn_moid.c", 38);
return 0;
}