//
// EC_GROUP_new from 0xd90f60 to 0xd91094 (308 bytes)
//
// 7 xrefs:
// > EC_GROUP_new_by_curve_name @ 0xd8f1a4
// > EC_GROUP_new_by_curve_name @ 0xd8f208
// > EC_GROUP_new_curve_GFp @ 0xd8f8d8
// > EC_GROUP_new_curve_GF2m @ 0xd8f94c
// > EC_KEY_copy @ 0xd8fb70
// > EC_GROUP_dup @ 0xd91a30
// > ??> @ 0xc84a8
//
// 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_new(int *a1)
{
__int64 v2; // x19
int v3; // w0
unsigned int (__fastcall *v4)(__int64); // x1
__int64 v6; // x0
__int64 v7; // x0
if ( !a1 )
{
ERR_put_error(16, 108, 108, "crypto/ec/ec_lib.c", 30);
return 0;
}
if ( !*((_QWORD *)a1 + 1) )
{
ERR_put_error(16, 108, 66, "crypto/ec/ec_lib.c", 34);
return 0;
}
v2 = CRYPTO_zalloc(168, "crypto/ec/ec_lib.c", 38);
if ( !v2 )
{
ERR_put_error(16, 108, 65, "crypto/ec/ec_lib.c", 40);
return 0;
}
v3 = *a1;
*(_QWORD *)v2 = a1;
if ( (v3 & 2) == 0 )
{
v6 = BN_new();
*(_QWORD *)(v2 + 16) = v6;
if ( !v6 )
{
LABEL_11:
BN_free(v6);
BN_free(*(_QWORD *)(v2 + 24));
CRYPTO_free(v2, "crypto/ec/ec_lib.c", 62);
return 0;
}
v7 = BN_new();
*(_QWORD *)(v2 + 24) = v7;
if ( !v7 )
goto LABEL_10;
}
v4 = *((unsigned int (__fastcall **)(__int64))a1 + 1);
*(_DWORD *)(v2 + 36) = 1;
*(_DWORD *)(v2 + 40) = 4;
if ( !v4(v2) )
{
LABEL_10:
v6 = *(_QWORD *)(v2 + 16);
goto LABEL_11;
}
return v2;
}