//
// cms_DigestedData_do_final from 0x8cf2e0 to 0x8cf410 (304 bytes)
//
// 2 xrefs:
// > CMS_dataFinal @ 0x87522c
// > ??> @ 0x6a42c
//
// 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
//
bool __fastcall cms_DigestedData_do_final(int a1, _DWORD *a2, int a3)
{
int *v6; // r0
int **v7; // r4
int v8; // r5
_BOOL4 v9; // r5
int v11; // r3
int v12; // [sp+Ch] [bp-48h] BYREF
char v13[68]; // [sp+10h] [bp-44h] BYREF
v6 = (int *)EVP_MD_CTX_new();
v7 = (int **)v6;
if ( !v6 )
{
ERR_put_error(46, 117, 65, (int)"crypto/cms/cms_dd.c", 64);
v9 = 0;
goto LABEL_4;
}
v8 = *(_DWORD *)(a1 + 4);
if ( cms_DigestAlgorithm_find_ctx(v6, a2, *(_DWORD **)(v8 + 4)) && EVP_DigestFinal_ex(v7, (int)v13, &v12) > 0 )
{
if ( !a3 )
{
v9 = ASN1_STRING_set(*(signed int **)(v8 + 12), v13, v12) != nullptr;
goto LABEL_4;
}
v11 = *(_DWORD *)(v8 + 12);
if ( *(_DWORD *)v11 != v12 )
{
ERR_put_error(46, 117, 121, (int)"crypto/cms/cms_dd.c", 79);
v9 = 0;
goto LABEL_4;
}
if ( !memcmp(v13, *(const void **)(v11 + 8), *(_DWORD *)v11) )
{
v9 = 1;
goto LABEL_4;
}
ERR_put_error(46, 117, 158, (int)"crypto/cms/cms_dd.c", 85);
}
v9 = 0;
LABEL_4:
EVP_MD_CTX_free((int *)v7);
return v9;
}