//
// OPENSSL_DIR_read from 0xdc012c to 0xdc0240 (276 bytes)
//
// 2 xrefs:
// > SSL_add_dir_cert_subjects_to_stack @ 0xd3b210
// > ??> @ 0x6c660
//
// 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
//
char *__fastcall OPENSSL_DIR_read(void **a1, const char *a2)
{
int *v4; // x0
DIR **v5; // x21
int *v6; // x23
DIR *v7; // x21
char *result; // x0
_QWORD *v9; // x19
int v10; // w19
if ( !a1 || !a2 )
{
*(_DWORD *)__errno() = 22;
return nullptr;
}
v4 = (int *)__errno();
v5 = (DIR **)*a1;
*v4 = 0;
v6 = v4;
if ( v5 )
{
v7 = *v5;
}
else
{
result = (char *)malloc(0x1010u);
*a1 = result;
v9 = result;
if ( !result )
{
*v6 = 12;
return result;
}
memset(result, 0, 0x1010u);
*v9 = opendir(a2);
v7 = *(DIR **)*a1;
if ( !v7 )
{
v10 = *v6;
free(*a1);
*a1 = nullptr;
*v6 = v10;
return nullptr;
}
}
result = (char *)readdir(v7);
if ( result )
{
strncpy((char *)*a1 + 8, result + 19, 0x1000u);
*((_BYTE *)*a1 + 4104) = 0;
return (char *)*a1 + 8;
}
return result;
}