//
// OPENSSL_DIR_read from 0xa2f608 to 0xa2f714 (268 bytes)
//
// 2 xrefs:
// > SSL_add_dir_cert_subjects_to_stack @ 0x9a6c68
// > ??> @ 0x74efc
//
// 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:03 +0000
//
int __fastcall OPENSSL_DIR_read(void **a1, const char *a2)
{
bool v2; // zf
int v3; // r4
int *v6; // r0
DIR **v7; // r6
DIR *v8; // r4
struct dirent *v9; // r0
DIR **v11; // r0
DIR **v12; // r4
DIR *v13; // r0
DIR **v14; // r3
int v15; // r6
v2 = a2 == nullptr;
if ( a2 )
v2 = a1 == nullptr;
v3 = v2;
if ( v2 )
{
*(_DWORD *)_errno() = 22;
return 0;
}
v6 = (int *)_errno();
v7 = (DIR **)*a1;
v2 = *a1 == nullptr;
*v6 = v3;
if ( !v2 )
{
v8 = *v7;
goto LABEL_10;
}
v11 = (DIR **)malloc(0x1008u);
v12 = v11;
*a1 = v11;
if ( v11 )
{
memset(v11, (int)v7, 0x1008u);
v13 = opendir(a2);
v14 = (DIR **)*a1;
*v12 = v13;
v8 = *v14;
if ( *v14 )
{
LABEL_10:
v9 = readdir(v8);
if ( v9 )
{
strncpy((char *)*a1 + 4, &v9->d_name[8], 0x1000u);
*((_BYTE *)*a1 + 4100) = 0;
return (int)*a1 + 4;
}
return 0;
}
v15 = *(_DWORD *)_errno();
free(*a1);
*a1 = nullptr;
*(_DWORD *)_errno() = v15;
return 0;
}
else
{
*(_DWORD *)_errno() = 12;
return 0;
}
}