//
// cms_DigestAlgorithm_find_ctx from 0x8756c8 to 0x875798 (208 bytes)
//
// 4 xrefs:
// > cms_SignedData_final @ 0x877158
// > CMS_SignerInfo_verify_content @ 0x877948
// > cms_DigestedData_do_final @ 0x8cf30c
// > ??> @ 0x6a49c
//
// 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
//
int __fastcall cms_DigestAlgorithm_find_ctx(int *a1, _DWORD *a2, _DWORD *a3)
{
char *v5; // r5
int v6; // r0
int v7; // r0
_DWORD *type; // r0
int v9; // r4
int v11; // [sp+8h] [bp-Ch] BYREF
int *v12; // [sp+Ch] [bp-8h] BYREF
X509_ALGOR_get0(&v11, nullptr, nullptr, a3);
v5 = OBJ_obj2nid(v11);
while ( 1 )
{
type = BIO_find_type(a2, 520);
v9 = (int)type;
if ( !type )
{
ERR_put_error(46, 115, 131, (int)"crypto/cms/cms_lib.c", 324);
return 0;
}
BIO_ctrl(type, 120, 0, (int)&v12);
v6 = EVP_MD_CTX_md((int)v12);
if ( (char *)EVP_MD_type(v6) == v5 )
break;
v7 = EVP_MD_CTX_md((int)v12);
if ( (char *)EVP_MD_pkey_type(v7) == v5 )
break;
a2 = (_DWORD *)BIO_next(v9);
}
return EVP_MD_CTX_copy_ex(a1, v12);
}