//
// PKCS7_add_signature from 0x82967c to 0x82973c (192 bytes)
//
// 1 xrefs:
// > ??> @ 0x65fac
//
// 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 PKCS7_add_signature(int a1, int a2, int a3, int a4)
{
int digestbyname; // r6
_DWORD *v8; // r0
_DWORD *v9; // r4
char *v11; // r0
unsigned int v12; // [sp+Ch] [bp-4h] BYREF
digestbyname = a4;
if ( !a4 )
{
if ( EVP_PKEY_get_default_digest_nid(a3, (int)&v12) > 0 )
{
v11 = OBJ_nid2sn(v12);
digestbyname = EVP_get_digestbyname((int)v11);
if ( digestbyname )
goto LABEL_2;
ERR_put_error(33, 131, 151, (int)"crypto/pkcs7/pk7_lib.c", 361);
}
v9 = nullptr;
goto LABEL_11;
}
LABEL_2:
v8 = PKCS7_SIGNER_INFO_new();
v9 = v8;
if ( v8 && PKCS7_SIGNER_INFO_set(v8, a2, a3, digestbyname) && PKCS7_add_signer(a1, (int)v9) )
return v9;
LABEL_11:
PKCS7_SIGNER_INFO_free(v9);
return nullptr;
}