//
// CMS_SignerInfo_verify_content from 0xe22240 to 0xe22518 (728 bytes)
//
// 1 xrefs:
// > ??> @ 0xc74a0
//
// 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_SignerInfo_verify_content(__int64 a1, _QWORD *a2)
{
__int64 *v4; // x19
char **v5; // x0
const void **v6; // x20
int v7; // w21
__int64 *v8; // x23
__int64 *v10; // x0
__int64 v11; // x0
__int64 v12; // x1
__int64 (*v13)(void); // x4
int v14; // w0
int v15; // [xsp+4Ch] [xbp+4Ch] BYREF
_BYTE v16[64]; // [xsp+50h] [xbp+50h] BYREF
v4 = (__int64 *)EVP_MD_CTX_new();
if ( !v4 )
{
v7 = -1;
v8 = nullptr;
ERR_put_error(46, 154, 65, (__int64)"crypto/cms/cms_sd.c", 784);
goto LABEL_10;
}
if ( (CMS_signed_get_attr_count(a1) & 0x80000000) != 0 )
{
v6 = nullptr;
}
else
{
v5 = OBJ_nid2obj(0x33u);
v6 = (const void **)CMS_signed_get0_data_by_OBJ(a1, v5, 4294967293LL, 4);
if ( !v6 )
{
v7 = -1;
v8 = nullptr;
ERR_put_error(46, 154, 114, (__int64)"crypto/cms/cms_sd.c", 794);
goto LABEL_10;
}
}
if ( !(unsigned int)cms_DigestAlgorithm_find_ctx(v4, a2, *(_QWORD **)(a1 + 16)) )
goto LABEL_13;
if ( (int)EVP_DigestFinal_ex((int **)v4, (__int64)v16, &v15) <= 0 )
{
v7 = -1;
v8 = nullptr;
ERR_put_error(46, 154, 147, (__int64)"crypto/cms/cms_sd.c", 804);
goto LABEL_10;
}
if ( v6 )
{
if ( *(_DWORD *)v6 == v15 )
{
if ( !memcmp(v16, v6[1], *(unsigned int *)v6) )
{
v7 = 1;
v8 = nullptr;
}
else
{
v7 = 0;
v8 = nullptr;
ERR_put_error(46, 154, 158, (__int64)"crypto/cms/cms_sd.c", 819);
}
}
else
{
v7 = -1;
v8 = nullptr;
ERR_put_error(46, 154, 120, (__int64)"crypto/cms/cms_sd.c", 813);
}
goto LABEL_10;
}
EVP_MD_CTX_md((__int64)v4);
v10 = (__int64 *)EVP_PKEY_CTX_new(*(_QWORD *)(a1 + 64), 0);
v8 = v10;
if ( !v10 )
{
LABEL_13:
v7 = -1;
v8 = nullptr;
goto LABEL_10;
}
if ( (int)EVP_PKEY_verify_init(v10) <= 0 || (int)EVP_PKEY_CTX_ctrl(v8, -1, 248) <= 0 )
goto LABEL_25;
v11 = *(_QWORD *)(a1 + 64);
*(_QWORD *)(a1 + 80) = v8;
v12 = *(_QWORD *)(v11 + 16);
if ( v12 )
{
v13 = *(__int64 (**)(void))(v12 + 176);
if ( v13 )
{
v14 = v13();
if ( v14 != -2 )
{
if ( v14 <= 0 )
{
v7 = -1;
ERR_put_error(46, 170, 111, (__int64)"crypto/cms/cms_sd.c", 214);
goto LABEL_10;
}
goto LABEL_21;
}
ERR_put_error(46, 170, 125, (__int64)"crypto/cms/cms_sd.c", 210);
LABEL_25:
v7 = -1;
goto LABEL_10;
}
}
LABEL_21:
v7 = EVP_PKEY_verify(v8);
if ( v7 <= 0 )
{
v7 = 0;
ERR_put_error(46, 154, 158, (__int64)"crypto/cms/cms_sd.c", 839);
}
LABEL_10:
EVP_PKEY_CTX_free((__int64)v8);
EVP_MD_CTX_free(v4);
return (unsigned int)v7;
}