//
// cms_DigestedData_do_final from 0x10f8f7c to 0x10f90c0 (324 bytes)
//
// 2 xrefs:
// > CMS_dataFinal @ 0x109de1c
// > ??> @ 0x8c668
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:18:13 +0000
//
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;
}
}