//
// X509_STORE_CTX_get1_crls from 0x83fd84 to 0x83fee0 (348 bytes)
//
// 3 xrefs:
// > ??> @ 0x6709c
// > X509_STORE_CTX_init @ 0x845f98
// > ??> @ 0xab8788
//
// 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
//
void **__fastcall X509_STORE_CTX_get1_crls(int *a1, int a2)
{
void **v4; // r6
int *v5; // r0
bool v6; // zf
int *v7; // r5
int v8; // r4
int v9; // r8
int v10; // r0
int v11; // r5
int v12; // r0
int v13; // r6
int v15; // [sp+4h] [bp-8h] BYREF
v4 = (void **)OPENSSL_sk_new_null();
v5 = X509_OBJECT_new();
v6 = v4 == nullptr;
if ( v4 )
v6 = v5 == nullptr;
v7 = v5;
v8 = v6;
if ( !v6 && X509_STORE_CTX_get_by_subject(a1, 2, a2, v5) )
{
X509_OBJECT_free(v7);
CRYPTO_THREAD_write_lock(*(pthread_rwlock_t **)(*a1 + 72));
v9 = sub_83F3E8(*(_DWORD **)(*a1 + 4), 2, a2, &v15);
if ( v9 < 0 )
{
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(*a1 + 72));
OPENSSL_sk_free(v4);
return (void **)v8;
}
else
{
if ( v15 <= 0 )
{
LABEL_15:
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(*a1 + 72));
return v4;
}
while ( 1 )
{
v10 = OPENSSL_sk_value(*(_DWORD **)(*a1 + 4), v8 + v9);
++v8;
v11 = *(_DWORD *)(v10 + 4);
X509_CRL_up_ref(v11);
if ( !OPENSSL_sk_push((int *)v4, v11) )
break;
if ( v15 <= v8 )
goto LABEL_15;
}
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(*a1 + 72));
X509_CRL_free(v11);
v12 = (int)v4;
v13 = 0;
OPENSSL_sk_pop_free(v12, (void (__fastcall *)(int))X509_CRL_free);
}
return (void **)v13;
}
X509_OBJECT_free(v7);
OPENSSL_sk_free(v4);
return nullptr;
}