//
// CMS_dataInit from 0xe1f98c to 0xe1faac (288 bytes)
//
// 2 xrefs:
// > sub_E1D530 @ 0xe1d598
// > ??> @ 0x6f810
//
// 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_dataInit(__int64 *a1, __int64 *a2)
{
__int64 *v4; // x21
int v5; // w0
_QWORD *v6; // x20
_QWORD *inited; // x0
v4 = a2;
if ( a2 || (v4 = cms_content_bio(a1)) != nullptr )
{
v5 = OBJ_obj2nid(*a1) - 21;
switch ( v5 )
{
case 0:
return (__int64)v4;
case 1:
inited = (_QWORD *)cms_SignedData_init_bio(a1);
goto LABEL_8;
case 2:
inited = cms_EnvelopedData_init_bio((__int64)a1);
goto LABEL_8;
case 4:
inited = (_QWORD *)cms_DigestedData_init_bio(a1);
if ( !inited )
goto LABEL_11;
return BIO_push((__int64)inited, (__int64)v4);
case 5:
inited = (_QWORD *)cms_EncryptedData_init_bio(a1);
LABEL_8:
if ( inited )
return BIO_push((__int64)inited, (__int64)v4);
LABEL_11:
v6 = inited;
if ( !a2 )
BIO_free(v4);
break;
default:
v6 = nullptr;
ERR_put_error(46, 111, 156, (__int64)"crypto/cms/cms_lib.c", 94);
return (__int64)v6;
}
}
else
{
v6 = nullptr;
ERR_put_error(46, 111, 127, (__int64)"crypto/cms/cms_lib.c", 64);
}
return (__int64)v6;
}