//
// CMS_set_detached from 0x87551c to 0x8755c4 (168 bytes)
//
// 2 xrefs:
// > cms_Data_create @ 0x8755ec
// > ??> @ 0x6a46c
//
// 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_set_detached(int *a1, int a2)
{
int *v3; // r0
int *v4; // r4
int v5; // r5
v3 = (int *)CMS_get0_content(a1);
v4 = v3;
if ( !v3 )
return 0;
if ( a2 )
{
ASN1_OCTET_STRING_free(*v3);
*v4 = 0;
return 1;
}
else
{
v5 = *v3;
if ( *v3 || (v5 = ASN1_OCTET_STRING_new(), (*v4 = v5) != 0) )
{
*(_DWORD *)(v5 + 12) |= 0x20u;
return 1;
}
else
{
ERR_put_error(46, 147, 65, (int)"crypto/cms/cms_lib.c", 280);
return 0;
}
}
}