//
// cms_env_asn1_ctrl from 0x872d18 to 0x872e04 (236 bytes)
//
// 6 xrefs:
// > CMS_RecipientInfo_decrypt @ 0x873590
// > CMS_RecipientInfo_encrypt @ 0x873adc
// > CMS_add1_recipient_cert @ 0x874184
// > CMS_RecipientInfo_kari_decrypt @ 0x87488c
// > cms_RecipientInfo_kari_encrypt @ 0x874cc0
// > ??> @ 0x6a02c
//
// 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_env_asn1_ctrl(_DWORD *a1, int a2)
{
int v3; // r0
int v4; // r3
int (__fastcall *v5)(int, int, int, _DWORD *); // r12
int v6; // r0
int v8; // r0
int v9; // [sp+Ch] [bp-4h]
if ( *a1 )
{
if ( *a1 != 1 )
return 0;
v9 = a2;
v8 = *(_DWORD *)(a1[1] + 20);
if ( !v8 )
return 0;
v3 = EVP_PKEY_CTX_get0_pkey(v8);
a2 = v9;
if ( !v3 )
return 0;
}
else
{
v3 = *(_DWORD *)(a1[1] + 20);
}
v4 = *(_DWORD *)(v3 + 12);
if ( !v4 )
return 1;
v5 = *(int (__fastcall **)(int, int, int, _DWORD *))(v4 + 92);
if ( !v5 )
return 1;
v6 = v5(v3, 7, a2, a1);
if ( v6 != -2 )
{
if ( v6 > 0 )
return 1;
ERR_put_error(46, 171, 111, (int)"crypto/cms/cms_env.c", 75);
return 0;
}
ERR_put_error(46, 171, 125, (int)"crypto/cms/cms_env.c", 71);
return 0;
}