//
// PKCS7_ctrl from 0xdce400 to 0xdce55c (348 bytes)
//
// 5 xrefs:
// > PKCS7_dataInit @ 0xdccb78
// > PKCS7_dataDecode @ 0xdcd1fc
// > PKCS7_dataDecode @ 0xdcd278
// > PKCS7_dataFinal @ 0xdcdc0c
// > ??> @ 0xb4a80
//
// 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
//
__int64 __fastcall PKCS7_ctrl(__int64 a1, int a2, int a3)
{
__int64 v4; // x19
int v5; // w0
__int64 v7; // x0
__int64 v8; // x19
LODWORD(v4) = a3;
v5 = OBJ_obj2nid(*(_QWORD *)(a1 + 24));
if ( a2 == 1 )
{
if ( v5 == 22 )
{
*(_DWORD *)(a1 + 20) = v4;
v4 = (int)v4;
if ( (_DWORD)v4 && (unsigned int)OBJ_obj2nid(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL) + 24LL)) == 21 )
{
ASN1_OCTET_STRING_free(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL) + 32LL));
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL) + 32LL) = 0;
}
return v4;
}
ERR_put_error(33, 104, 104, (__int64)"crypto/pkcs7/pk7_lib.c", 37);
return 0;
}
else
{
if ( a2 != 2 )
{
v4 = 0;
ERR_put_error(33, 104, 110, (__int64)"crypto/pkcs7/pk7_lib.c", 57);
return v4;
}
if ( v5 == 22 )
{
v7 = *(_QWORD *)(a1 + 32);
if ( v7 )
{
LODWORD(v8) = *(_QWORD *)(*(_QWORD *)(v7 + 40) + 32LL) == 0;
*(_DWORD *)(a1 + 20) = v8;
return (unsigned __int8)v8;
}
else
{
v8 = 1;
*(_DWORD *)(a1 + 20) = 1;
}
return v8;
}
else
{
ERR_put_error(33, 104, 104, (__int64)"crypto/pkcs7/pk7_lib.c", 51);
return 0;
}
}
}