//
// cms_DigestedData_do_final from 0xe7af7c to 0xe7b0c0 (324 bytes)
//
// 2 xrefs:
// > CMS_dataFinal @ 0xe1fb1c
// > ??> @ 0x677e8
//
// 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(__int64 a1, _QWORD *a2, int a3)
{
__int64 *v5; // x0
int **v6; // x19
__int64 v7; // x20
_BOOL4 v8; // w20
const void **v10; // x0
int v12; // [xsp+4Ch] [xbp+4Ch] BYREF
char v13[64]; // [xsp+50h] [xbp+50h] BYREF
v5 = (__int64 *)EVP_MD_CTX_new();
v6 = (int **)v5;
if ( v5 )
{
v7 = *(_QWORD *)(a1 + 8);
if ( (unsigned int)cms_DigestAlgorithm_find_ctx(v5, a2, *(_QWORD **)(v7 + 8))
&& (int)EVP_DigestFinal_ex(v6, (__int64)v13, &v12) > 0 )
{
v10 = *(const void ***)(v7 + 24);
if ( a3 )
{
if ( *(_DWORD *)v10 == v12 )
{
v8 = 1;
if ( memcmp(v13, v10[1], *(unsigned int *)v10) )
{
v8 = 0;
ERR_put_error(46, 117, 158, (__int64)"crypto/cms/cms_dd.c", 85);
}
}
else
{
v8 = 0;
ERR_put_error(46, 117, 121, (__int64)"crypto/cms/cms_dd.c", 79);
}
}
else
{
v8 = ASN1_STRING_set((__int64)v10, v13, v12) != 0;
}
}
else
{
v8 = 0;
}
EVP_MD_CTX_free((__int64 *)v6);
return v8;
}
else
{
ERR_put_error(46, 117, 65, (__int64)"crypto/cms/cms_dd.c", 64);
EVP_MD_CTX_free(nullptr);
return 0;
}
}