//
// EVP_PKEY_sign from 0xdace38 to 0xdacf48 (272 bytes)
//
// 5 xrefs:
// > EVP_DigestSignFinal @ 0xdab848
// > EVP_DigestSignFinal @ 0xdab914
// > EVP_SignFinal @ 0xdacbb8
// > cms_SignedData_final @ 0xe21b90
// > ??> @ 0x31dd0
//
// 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 EVP_PKEY_sign(__int64 *a1, __int64 a2, _QWORD *a3)
{
__int64 v4; // x5
__int64 (__fastcall *v5)(__int64 *); // x0
int v6; // w0
if ( a1 && (v4 = *a1) != 0 && (v5 = *(__int64 (__fastcall **)(__int64 *))(v4 + 72)) != nullptr )
{
if ( *((_DWORD *)a1 + 8) == 8 )
{
if ( (*(_DWORD *)(v4 + 4) & 2) != 0 )
{
v6 = EVP_PKEY_size(a1[2]);
if ( a2 )
{
if ( (unsigned __int64)v6 > *a3 )
{
ERR_put_error(6, 140, 155, (__int64)"crypto/evp/pmeth_fn.c", 63);
return 0;
}
else
{
return (*(__int64 (__fastcall **)(__int64 *))(*a1 + 72))(a1);
}
}
else
{
*a3 = v6;
return 1;
}
}
else
{
return v5(a1);
}
}
else
{
ERR_put_error(6, 140, 151, (__int64)"crypto/evp/pmeth_fn.c", 60);
return 0xFFFFFFFFLL;
}
}
else
{
ERR_put_error(6, 140, 150, (__int64)"crypto/evp/pmeth_fn.c", 56);
return 4294967294LL;
}
}