//
// CMS_dataFinal from 0xe1faac to 0xe1fc54 (424 bytes)
//
// 2 xrefs:
// > sub_E1D530 @ 0xe1d5bc
// > ??> @ 0x574f8
//
// 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
//
__int64 __fastcall CMS_dataFinal(__int64 *a1, _QWORD *a2)
{
__int64 result; // x0
__int64 *v5; // x19
int v6; // w0
_QWORD *type; // x0
__int64 v8; // x22
int v9; // w23
__int64 v10; // [xsp+48h] [xbp+48h] BYREF
result = CMS_get0_content(a1);
v5 = (__int64 *)result;
if ( result )
{
if ( *(_QWORD *)result && (*(_QWORD *)(*(_QWORD *)result + 16LL) & 0x20) != 0 )
{
type = BIO_find_type(a2, 1025);
v8 = (__int64)type;
if ( !type )
{
ERR_put_error(46, 110, 105, (__int64)"crypto/cms/cms_lib.c", 119);
return 0;
}
v9 = BIO_ctrl((__int64)type, 3u, 0, (__int64)&v10);
BIO_set_flags(v8, 512);
BIO_ctrl(v8, 0x82u, 0, 0);
ASN1_STRING_set0(*v5, v10, v9);
*(_QWORD *)(*v5 + 16) &= ~0x20uLL;
}
v6 = OBJ_obj2nid(*a1);
if ( v6 != 23 )
{
if ( v6 <= 23 )
{
if ( v6 != 21 )
{
if ( v6 == 22 )
return cms_SignedData_final(a1, a2);
goto LABEL_13;
}
}
else if ( v6 != 26 && v6 != 786 )
{
if ( v6 == 25 )
return cms_DigestedData_do_final(a1, a2, 0);
LABEL_13:
ERR_put_error(46, 110, 156, (__int64)"crypto/cms/cms_lib.c", 146);
return 0;
}
}
return 1;
}
return result;
}