//
// X509V3_get_d2i from 0xdfe238 to 0xdfe378 (320 bytes)
//
// 9 xrefs:
// > OCSP_REQUEST_get1_ext_d2i @ 0xdc3cd8
// > OCSP_ONEREQ_get1_ext_d2i @ 0xdc3d38
// > OCSP_BASICRESP_get1_ext_d2i @ 0xdc3d98
// > OCSP_SINGLERESP_get1_ext_d2i @ 0xdc3df8
// > X509_CRL_get_ext_d2i @ 0xde715c
// > X509_get_ext_d2i @ 0xde71dc
// > X509_REVOKED_get_ext_d2i @ 0xde723c
// > X509_REQ_get1_email @ 0xe0456c
// > ??> @ 0x91260
//
// 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
//
__int64 __fastcall X509V3_get_d2i(unsigned int *a1, int a2, _DWORD *a3, _DWORD *a4)
{
_DWORD *v7; // x21
int v8; // w19
__int64 v9; // x23
__int64 object; // x0
int v11; // w19
__int64 v12; // x0
v7 = a4;
if ( !a1 )
{
if ( !a4 )
{
LABEL_21:
if ( a3 )
*a3 = -1;
return 0;
}
LABEL_20:
*v7 = -1;
goto LABEL_21;
}
if ( a4 )
{
v8 = *a4 + 1;
if ( v8 < 0 )
v8 = 0;
while ( v8 < (int)OPENSSL_sk_num(a1) )
{
v9 = OPENSSL_sk_value((__int64)a1, v8);
object = X509_EXTENSION_get_object(v9);
if ( (unsigned int)OBJ_obj2nid(object) == a2 )
{
*v7 = v8;
if ( !v9 )
goto LABEL_20;
if ( a3 )
goto LABEL_17;
return X509V3_EXT_d2i(v9);
}
++v8;
}
goto LABEL_20;
}
v11 = 0;
LABEL_9:
v9 = (__int64)v7;
while ( v11 < (int)OPENSSL_sk_num(a1) )
{
v7 = (_DWORD *)OPENSSL_sk_value((__int64)a1, v11);
v12 = X509_EXTENSION_get_object((__int64)v7);
++v11;
if ( (unsigned int)OBJ_obj2nid(v12) == a2 )
{
if ( !v9 )
goto LABEL_9;
if ( a3 )
{
*a3 = -2;
return 0;
}
return 0;
}
}
if ( !v9 )
goto LABEL_21;
if ( a3 )
LABEL_17:
*a3 = X509_EXTENSION_get_critical(v9);
return X509V3_EXT_d2i(v9);
}