//
// EC_GROUP_get_ecpkparameters from 0xd8db1c to 0xd8dc1c (256 bytes)
//
// 3 xrefs:
// > i2d_ECPKParameters @ 0xd8e5c8
// > i2d_ECPrivateKey @ 0xd8ea84
// > ??> @ 0xae978
//
// 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 EC_GROUP_get_ecpkparameters(__int64 a1, __int64 a2)
{
__int64 v2; // x19
__int64 curve_name; // x0
_QWORD *ecparameters; // x0
__int64 v7; // x0
__int64 v8; // x0
v2 = a2;
if ( !a2 )
{
v2 = ECPKPARAMETERS_new();
if ( !v2 )
{
ERR_put_error(16, 262, 65, "crypto/ec/ec_asn1.c", 559);
return 0;
}
goto LABEL_4;
}
if ( !*(_DWORD *)a2 )
{
ASN1_OBJECT_free(*(_QWORD *)(a2 + 8));
if ( !(unsigned int)EC_GROUP_get_asn1_flag(a1) )
goto LABEL_8;
LABEL_5:
curve_name = EC_GROUP_get_curve_name(a1);
if ( (_DWORD)curve_name )
{
*(_DWORD *)v2 = 0;
v8 = OBJ_nid2obj(curve_name);
*(_QWORD *)(v2 + 8) = v8;
if ( v8 )
return v2;
}
goto LABEL_6;
}
if ( *(_DWORD *)a2 != 1 || (v7 = *(_QWORD *)(a2 + 8)) == 0 )
{
LABEL_4:
if ( !(unsigned int)EC_GROUP_get_asn1_flag(a1) )
goto LABEL_8;
goto LABEL_5;
}
ECPARAMETERS_free(v7);
if ( (unsigned int)EC_GROUP_get_asn1_flag(a1) )
goto LABEL_5;
LABEL_8:
*(_DWORD *)v2 = 1;
ecparameters = EC_GROUP_get_ecparameters(a1, nullptr);
*(_QWORD *)(v2 + 8) = ecparameters;
if ( !ecparameters )
{
LABEL_6:
ECPKPARAMETERS_free(v2);
return 0;
}
return v2;
}