//
// cms_DigestAlgorithm_init_bio from 0x8755f8 to 0x8756bc (196 bytes)
//
// 3 xrefs:
// > cms_SignedData_init_bio @ 0x877700
// > cms_DigestedData_init_bio @ 0x8cf2dc
// > ??> @ 0x6a48c
//
// 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
//
_DWORD *__fastcall cms_DigestAlgorithm_init_bio(_DWORD *a1)
{
char *v1; // r0
char *v2; // r0
int digestbyname; // r5
int v4; // r0
_DWORD *v5; // r0
_DWORD *v6; // r4
int v8; // [sp+Ch] [bp-8h] BYREF
X509_ALGOR_get0(&v8, nullptr, nullptr, a1);
v1 = OBJ_obj2nid(v8);
v2 = OBJ_nid2sn((unsigned int)v1);
digestbyname = EVP_get_digestbyname((int)v2);
if ( digestbyname )
{
v4 = BIO_f_md();
v5 = BIO_new(v4);
v6 = v5;
if ( v5 && BIO_ctrl(v5, 111, 0, digestbyname) )
return v6;
ERR_put_error(46, 116, 119, (int)"crypto/cms/cms_lib.c", 300);
}
else
{
v6 = nullptr;
ERR_put_error(46, 116, 149, (int)"crypto/cms/cms_lib.c", 295);
}
BIO_free(v6);
return nullptr;
}