//
// CMS_dataFinal from 0x8751bc to 0x875334 (376 bytes)
//
// 2 xrefs:
// > sub_872AE8 @ 0x872b54
// > ??> @ 0x69e9c
//
// 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_dataFinal(int *a1, _DWORD *a2)
{
int v4; // r0
_DWORD **v5; // r4
char *v6; // r0
_DWORD *type; // r0
_DWORD *v9; // r7
int v10; // r8
int v11; // [sp+Ch] [bp-4h] BYREF
v4 = CMS_get0_content(a1);
v5 = (_DWORD **)v4;
if ( !v4 )
return 0;
if ( *(_DWORD *)v4 && (*(_DWORD *)(*(_DWORD *)v4 + 12) & 0x20) != 0 )
{
type = BIO_find_type(a2, 1025);
v9 = type;
if ( !type )
{
ERR_put_error(46, 110, 105, (int)"crypto/cms/cms_lib.c", 119);
return 0;
}
v10 = BIO_ctrl(type, 3, 0, (int)&v11);
BIO_set_flags((int)v9, 512);
BIO_ctrl(v9, 130, 0, 0);
ASN1_STRING_set0(*v5, v11, v10);
(*v5)[3] &= ~0x20u;
}
v6 = OBJ_obj2nid(*a1);
if ( v6 == (_BYTE *)&dword_14 + 3 )
return 1;
if ( (int)v6 > 23 )
{
if ( v6 != (_BYTE *)&dword_18 + 2 && v6 != (_BYTE *)&stru_30C.st_value + 2 )
{
if ( v6 == (_BYTE *)&dword_18 + 1 )
return cms_DigestedData_do_final(a1, a2, 0);
goto LABEL_14;
}
return 1;
}
if ( v6 == (_BYTE *)&dword_14 + 1 )
return 1;
if ( v6 != (_BYTE *)&dword_14 + 2 )
{
LABEL_14:
ERR_put_error(46, 110, 156, (int)"crypto/cms/cms_lib.c", 146);
return 0;
}
return cms_SignedData_final(a1, a2);
}