//
// CMS_get1_certs from 0x109e748 to 0x109e87c (308 bytes)
//
// 1 xrefs:
// > ??> @ 0x554f8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:17:30 +0000
//
int *__fastcall CMS_get1_certs(__int64 *a1)
{
int v2; // w0
unsigned int **v3; // x21
int v4; // w19
int *v5; // x22
bool v6; // cc
int v7; // w1
__int64 v8; // x0
__int64 v9; // x20
int *v11; // x0
v2 = OBJ_obj2nid(*a1);
if ( v2 != 22 )
{
if ( v2 == 23 )
{
v3 = *(unsigned int ***)(a1[1] + 8);
if ( v3 )
goto LABEL_4;
}
else
{
ERR_put_error(46, 128, 152, (__int64)"crypto/cms/cms_lib.c", 354);
}
return nullptr;
}
v3 = (unsigned int **)(a1[1] + 24);
if ( a1[1] == -24 )
return nullptr;
LABEL_4:
v4 = 0;
v5 = nullptr;
while ( 1 )
{
v6 = v4 < (int)OPENSSL_sk_num(*v3);
v7 = v4++;
if ( !v6 )
return v5;
while ( 1 )
{
v8 = OPENSSL_sk_value((__int64)*v3, v7);
v9 = v8;
if ( *(_DWORD *)v8 )
break;
if ( v5 )
{
if ( !(unsigned int)OPENSSL_sk_push(v5, *(_QWORD *)(v8 + 8)) )
goto LABEL_16;
}
else
{
v11 = (int *)OPENSSL_sk_new_null();
v5 = v11;
if ( !v11 )
return nullptr;
if ( !(unsigned int)OPENSSL_sk_push(v11, *(_QWORD *)(v9 + 8)) )
{
LABEL_16:
OPENSSL_sk_pop_free(v5, (void (__fastcall *)(__int64))X509_free);
return nullptr;
}
}
X509_up_ref(*(_QWORD *)(v9 + 8));
v6 = v4 < (int)OPENSSL_sk_num(*v3);
v7 = v4++;
if ( !v6 )
return v5;
}
}
}