//
// cms_DigestAlgorithm_find_ctx from 0x109e2e4 to 0x109e3c8 (228 bytes)
//
// 4 xrefs:
// > cms_SignedData_final @ 0x109fd68
// > CMS_SignerInfo_verify_content @ 0x10a05a4
// > cms_DigestedData_do_final @ 0x10f8fb0
// > ??> @ 0xa1530
//
// 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:17:30 +0000
//
__int64 __fastcall cms_DigestAlgorithm_find_ctx(__int64 *a1, _QWORD *a2, _QWORD *a3)
{
int v5; // w20
unsigned int *v6; // x0
__int64 v7; // x0
_QWORD *type; // x0
__int64 v9; // x19
__int64 v11; // [xsp+30h] [xbp+30h] BYREF
__int64 *v12; // [xsp+38h] [xbp+38h] BYREF
X509_ALGOR_get0((__int64)&v11, nullptr, nullptr, a3);
v5 = OBJ_obj2nid(v11);
while ( 1 )
{
type = BIO_find_type(a2, 520);
v9 = (__int64)type;
if ( !type )
{
ERR_put_error(46, 115, 131, (__int64)"crypto/cms/cms_lib.c", 324);
return 0;
}
BIO_ctrl((__int64)type, 0x78u, 0, (__int64)&v12);
v6 = (unsigned int *)EVP_MD_CTX_md((__int64)v12);
if ( (unsigned int)EVP_MD_type(v6) == v5 )
break;
v7 = EVP_MD_CTX_md((__int64)v12);
if ( (unsigned int)EVP_MD_pkey_type(v7) == v5 )
break;
a2 = (_QWORD *)BIO_next(v9);
}
return EVP_MD_CTX_copy_ex(a1, v12);
}