//
// sub_DE4874 from 0xde4874 to 0xde496c (248 bytes)
//
// 1 xrefs:
// > ??> @ 0x1239220
//
// 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 sub_DE4874(__int64 a1, int a2, char *a3, __int64 a4)
{
__int64 v4; // x19
__int64 result; // x0
const char *default_cert_dir_env; // x0
char *default_cert_dir; // x1
v4 = *(_QWORD *)(a1 + 16);
if ( a2 != 2 )
return 0;
if ( a4 == 3 )
{
default_cert_dir_env = (const char *)X509_get_default_cert_dir_env();
default_cert_dir = getenv(default_cert_dir_env);
if ( (default_cert_dir || (default_cert_dir = (char *)X509_get_default_cert_dir()) != nullptr) && *default_cert_dir )
{
result = sub_DE4614((unsigned int **)(v4 + 8), default_cert_dir, 1);
if ( (_DWORD)result )
return result;
}
else
{
ERR_put_error(11, 100, 113, (__int64)"crypto/x509/by_dir.c", 158);
}
ERR_put_error(11, 102, 103, (__int64)"crypto/x509/by_dir.c", 90);
return 0;
}
if ( a3 && *a3 )
return sub_DE4614((unsigned int **)(v4 + 8), a3, a4);
ERR_put_error(11, 100, 113, (__int64)"crypto/x509/by_dir.c", 158);
return 0;
}