//
// X509_STORE_CTX_purpose_inherit from 0x106b9b0 to 0x106bb30 (384 bytes)
//
// 3 xrefs:
// > X509_STORE_CTX_set_purpose @ 0x106bb3c
// > X509_STORE_CTX_set_trust @ 0x106bb4c
// > ??> @ 0x78a60
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:16:57 +0000
//
__int64 __fastcall X509_STORE_CTX_purpose_inherit(__int64 a1, unsigned int a2, unsigned int a3, int a4)
{
int v4; // w19
int v6; // w0
unsigned int v7; // w1
__int64 v8; // x0
unsigned int v9; // w20
unsigned int v10; // w2
__int64 v11; // x1
int v13; // w0
unsigned int v15; // [xsp+30h] [xbp+30h]
unsigned int v16; // [xsp+38h] [xbp+38h]
unsigned int v17; // [xsp+38h] [xbp+38h]
unsigned int v18; // [xsp+38h] [xbp+38h]
v4 = a4;
if ( !a3 )
{
if ( !a2 )
{
if ( !a4 )
return 1;
if ( (unsigned int)X509_TRUST_get_by_id(a4) != -1 )
{
v11 = *(_QWORD *)(a1 + 32);
goto LABEL_8;
}
LABEL_23:
v9 = 0;
ERR_put_error(11, 134, 120, (__int64)"crypto/x509/x509_vfy.c", 2188);
return v9;
}
a3 = a2;
}
v16 = a3;
v6 = X509_PURPOSE_get_by_id(a3);
v7 = a2;
if ( v6 == -1 )
{
v9 = 0;
ERR_put_error(11, 134, 121, (__int64)"crypto/x509/x509_vfy.c", 2162);
return v9;
}
v15 = v16;
v17 = v7;
v8 = X509_PURPOSE_get0();
v9 = *(_DWORD *)(v8 + 4);
v10 = v15;
if ( v9 )
{
if ( v4 )
goto LABEL_16;
}
else
{
if ( (unsigned int)X509_PURPOSE_get_by_id(v17) == -1 )
{
ERR_put_error(11, 134, 121, (__int64)"crypto/x509/x509_vfy.c", 2175);
return v9;
}
v8 = X509_PURPOSE_get0();
v10 = v15;
if ( v4 )
goto LABEL_16;
}
v4 = *(_DWORD *)(v8 + 4);
if ( !v4 )
{
v11 = *(_QWORD *)(a1 + 32);
if ( *(_DWORD *)(v11 + 32) )
return 1;
goto LABEL_7;
}
LABEL_16:
v18 = v10;
v13 = X509_TRUST_get_by_id(v4);
v10 = v18;
if ( v13 == -1 )
goto LABEL_23;
v11 = *(_QWORD *)(a1 + 32);
if ( *(_DWORD *)(v11 + 32) )
{
LABEL_8:
if ( !*(_DWORD *)(v11 + 36) )
*(_DWORD *)(v11 + 36) = v4;
return 1;
}
LABEL_7:
*(_DWORD *)(v11 + 32) = v10;
if ( v4 )
goto LABEL_8;
return 1;
}