//
// CMS_get1_certs from 0x875ae0 to 0x875be8 (264 bytes)
//
// 1 xrefs:
// > ??> @ 0x6a50c
//
// 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
//
int *__fastcall CMS_get1_certs(int *a1)
{
char *v2; // r0
int *v3; // r6
signed int v4; // r4
int *v5; // r7
int v6; // r0
unsigned int v7; // r1
_DWORD *v9; // r5
v2 = OBJ_obj2nid(*a1);
if ( v2 != (_BYTE *)&dword_14 + 2 )
{
if ( v2 == (_BYTE *)&dword_14 + 3 )
{
v3 = *(int **)(a1[1] + 4);
if ( v3 )
goto LABEL_4;
}
else
{
ERR_put_error(46, 128, 152, (int)"crypto/cms/cms_lib.c", 354);
}
return nullptr;
}
v3 = (int *)(a1[1] + 12);
if ( a1[1] == -12 )
return nullptr;
LABEL_4:
v4 = 0;
v5 = nullptr;
while ( 1 )
{
do
{
v6 = OPENSSL_sk_num(*v3);
v7 = v4;
if ( v4++ >= v6 )
return v5;
v9 = (_DWORD *)OPENSSL_sk_value((_DWORD *)*v3, v7);
}
while ( *v9 );
if ( !v5 )
{
v5 = OPENSSL_sk_new_null();
if ( !v5 )
return nullptr;
}
if ( !OPENSSL_sk_push(v5, v9[1]) )
break;
X509_up_ref(v9[1]);
}
OPENSSL_sk_pop_free((int)v5, (void (__fastcall *)(int))X509_free);
return nullptr;
}