//
// EVP_PKEY2PKCS8 from 0xdaacb0 to 0xdaada4 (244 bytes)
//
// 5 xrefs:
// > i2d_PKCS8PrivateKeyInfo_fp @ 0xdf04a0
// > i2d_PKCS8PrivateKeyInfo_bio @ 0xdf0584
// > i2d_PrivateKey @ 0xe0f5ec
// > sub_E64EF8 @ 0xe64f34
// > ??> @ 0xb04c0
//
// 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_PKEY2PKCS8(__int64 a1)
{
__int64 v2; // x19
__int64 v3; // x2
unsigned int (*v4)(void); // x2
v2 = PKCS8_PRIV_KEY_INFO_new();
if ( !v2 )
{
ERR_put_error(6, 113, 65, (__int64)"crypto/evp/evp_pkey.c", 65);
return 0;
}
v3 = *(_QWORD *)(a1 + 16);
if ( !v3 )
{
ERR_put_error(6, 113, 118, (__int64)"crypto/evp/evp_pkey.c", 80);
goto LABEL_8;
}
v4 = *(unsigned int (**)(void))(v3 + 72);
if ( !v4 )
{
ERR_put_error(6, 113, 144, (__int64)"crypto/evp/evp_pkey.c", 76);
goto LABEL_8;
}
if ( !v4() )
{
ERR_put_error(6, 113, 146, (__int64)"crypto/evp/evp_pkey.c", 72);
LABEL_8:
PKCS8_PRIV_KEY_INFO_free(v2);
return 0;
}
RAND_add(*(_QWORD *)(*(_QWORD *)(v2 + 16) + 8LL), **(unsigned int **)(v2 + 16), 0.0);
return v2;
}