//
// EC_GROUP_set_generator from 0x7eb95c to 0x7eba60 (260 bytes)
//
// 3 xrefs:
// > EC_GROUP_new_from_ecparameters @ 0x7e7044
// > EC_GROUP_new_by_curve_name @ 0x7e83f4
// > ??> @ 0x614dc
//
// 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
//
int __fastcall EC_GROUP_set_generator(int a1, _DWORD *a2, int a3, int a4)
{
_DWORD *v5; // r12
int **v9; // r0
int **v10; // r0
if ( !a2 )
{
ERR_put_error(16, 111, 67, "crypto/ec/ec_lib.c", 263);
return 0;
}
v5 = *(_DWORD **)(a1 + 4);
if ( !v5 )
{
v5 = EC_POINT_new((int *)a1);
*(_DWORD *)(a1 + 4) = v5;
if ( !v5 )
return 0;
}
if ( !EC_POINT_copy(v5, a2) )
return 0;
v9 = *(int ***)(a1 + 8);
if ( a3 )
{
if ( !BN_copy((int)v9, a3) )
return 0;
}
else
{
BN_set_word(v9, 0);
}
v10 = *(int ***)(a1 + 12);
if ( a4 )
{
if ( BN_copy((int)v10, a4) )
goto LABEL_8;
return 0;
}
BN_set_word(v10, 0);
LABEL_8:
if ( BN_is_odd(*(_DWORD *)(a1 + 8)) )
return ec_precompute_mont_data(a1);
BN_MONT_CTX_free(*(_BYTE **)(a1 + 88));
*(_DWORD *)(a1 + 88) = 0;
return 1;
}