//
// CMS_add0_cert from 0xa8a478 to 0xa8a588 (272 bytes)
//
// 2 xrefs:
// > CMS_add1_cert @ 0xa8a5a0
// > ??> @ 0x83f3c
//
// 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:54 +0000
//
int __fastcall CMS_add0_cert(int *a1, int a2)
{
char *v4; // r0
int *v5; // r5
signed int v6; // r4
int v7; // r0
unsigned int v8; // r1
_DWORD *v10; // r0
_DWORD *v12; // r0
v4 = OBJ_obj2nid(*a1);
if ( v4 == (_BYTE *)&dword_14 + 2 )
{
v5 = (int *)(a1[1] + 12);
if ( a1[1] != -12 )
goto LABEL_4;
return 0;
}
if ( v4 != (_BYTE *)&dword_14 + 3 )
{
ERR_put_error(46, 128, 152, (int)"crypto/cms/cms_lib.c", 354);
return 0;
}
v5 = *(int **)(a1[1] + 4);
if ( !v5 )
return 0;
LABEL_4:
v6 = 0;
while ( 1 )
{
v7 = OPENSSL_sk_num(*v5);
v8 = v6;
if ( v6++ >= v7 )
break;
v10 = (_DWORD *)OPENSSL_sk_value((_DWORD *)*v5, v8);
if ( !*v10 && !X509_cmp(v10[1], a2) )
{
ERR_put_error(46, 164, 175, (int)"crypto/cms/cms_lib.c", 394);
return 0;
}
}
v12 = CMS_add0_CertificateChoices(a1);
if ( !v12 )
return 0;
*v12 = 0;
v12[1] = a2;
return 1;
}