//
// cms_DigestAlgorithm_find_ctx from 0xa8a2c8 to 0xa8a398 (208 bytes)
//
// 4 xrefs:
// > cms_SignedData_final @ 0xa8bd58
// > CMS_SignerInfo_verify_content @ 0xa8c548
// > cms_DigestedData_do_final @ 0xae430c
// > ??> @ 0x83f1c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:54 +0000
//
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);
}