//
// X509V3_get_d2i from 0xa6c2fc to 0xa6c420 (292 bytes)
//
// 9 xrefs:
// > OCSP_REQUEST_get1_ext_d2i @ 0xa32d40
// > OCSP_ONEREQ_get1_ext_d2i @ 0xa32d98
// > OCSP_BASICRESP_get1_ext_d2i @ 0xa32df0
// > OCSP_SINGLERESP_get1_ext_d2i @ 0xa32e48
// > X509_CRL_get_ext_d2i @ 0xa53e78
// > X509_get_ext_d2i @ 0xa53ee8
// > X509_REVOKED_get_ext_d2i @ 0xa53f40
// > X509_REQ_get1_email @ 0xa72af0
// > ??> @ 0x7e42c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:08:39 +0000
//
int __fastcall X509V3_get_d2i(_DWORD *a1, char *a2, _DWORD *a3, signed int *a4)
{
signed int *v6; // r4
signed int i; // r6
int v9; // r8
int object; // r0
int v11; // r0
unsigned int v12; // r1
int v13; // r6
int v14; // r0
bool v15; // zf
v6 = a4;
if ( !a1 )
{
if ( !a4 )
{
LABEL_19:
if ( a3 )
*a3 = -1;
return 0;
}
LABEL_18:
*v6 = -1;
goto LABEL_19;
}
if ( a4 )
{
for ( i = (*a4 + 1) & ~((*a4 + 1) >> 31); i < OPENSSL_sk_num((int)a1); ++i )
{
v9 = OPENSSL_sk_value(a1, i);
object = X509_EXTENSION_get_object(v9);
if ( OBJ_obj2nid(object) == a2 )
{
*v6 = i;
if ( !v9 )
goto LABEL_18;
if ( a3 )
goto LABEL_15;
return X509V3_EXT_d2i(v9);
}
}
goto LABEL_18;
}
v9 = 0;
while ( 1 )
{
v11 = OPENSSL_sk_num((int)a1);
v12 = (unsigned int)v6;
if ( (int)v6 >= v11 )
break;
v6 = (signed int *)((char *)v6 + 1);
v13 = OPENSSL_sk_value(a1, v12);
v14 = X509_EXTENSION_get_object(v13);
if ( OBJ_obj2nid(v14) == a2 )
{
v15 = v9 == 0;
v9 = v13;
if ( !v15 )
{
if ( !a3 )
return 0;
*a3 = -2;
return 0;
}
}
}
if ( !v9 )
goto LABEL_19;
if ( a3 )
LABEL_15:
*a3 = X509_EXTENSION_get_critical(v9);
return X509V3_EXT_d2i(v9);
}