//
// ec_key_simple_check_key from 0x100e374 to 0x100e608 (660 bytes)
//
// 5 xrefs:
// > ??> @ 0x8fec0
// > ??> @ 0x1539fd8
// > ??> @ 0x153a158
// > ??> @ 0x153a2d8
// > ??> @ 0x153f018
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:16:01 +0000
//
__int64 __fastcall ec_key_simple_check_key(_QWORD *a1)
{
__int64 v2; // x0
__int64 v3; // x1
__int64 v4; // x2
unsigned int v5; // w19
__int64 v6; // x21
__int64 v7; // x22
__int64 *v9; // x23
__int64 *v10; // x0
if ( a1 && a1[3] && a1[4] )
{
v2 = ((__int64 (*)(void))EC_POINT_is_at_infinity)();
v5 = v2;
if ( (_DWORD)v2 )
{
v6 = 0;
v7 = 0;
v5 = 0;
ERR_put_error(16, 258, 106, "crypto/ec/ec_key.c", 283);
}
else
{
v7 = BN_CTX_new(v2, v3, v4);
if ( v7 )
{
v6 = EC_POINT_new(a1[3]);
if ( v6 )
{
if ( (int)EC_POINT_is_on_curve(a1[3], a1[4], v7) <= 0 )
{
ERR_put_error(16, 258, 107, "crypto/ec/ec_key.c", 294);
}
else
{
v9 = *(__int64 **)(a1[3] + 16LL);
if ( BN_is_zero((__int64)v9) )
{
ERR_put_error(16, 258, 122, "crypto/ec/ec_key.c", 300);
}
else
{
v5 = EC_POINT_mul(a1[3], v6, 0, a1[4], v9, v7);
if ( v5 )
{
if ( (unsigned int)EC_POINT_is_at_infinity(a1[3], v6) )
{
v10 = (__int64 *)a1[5];
if ( v10 )
{
if ( (BN_cmp(v10, v9) & 0x80000000) != 0 )
{
v5 = EC_POINT_mul(a1[3], v6, a1[5], 0, 0, v7);
if ( v5 )
{
v5 = 1;
if ( (unsigned int)EC_POINT_cmp(a1[3], v6, a1[4], v7) )
{
v5 = 0;
ERR_put_error(16, 258, 123, "crypto/ec/ec_key.c", 326);
}
}
else
{
ERR_put_error(16, 258, 16, "crypto/ec/ec_key.c", 322);
}
}
else
{
v5 = 0;
ERR_put_error(16, 258, 130, "crypto/ec/ec_key.c", 317);
}
}
else
{
v5 = 1;
}
}
else
{
v5 = 0;
ERR_put_error(16, 258, 130, "crypto/ec/ec_key.c", 308);
}
}
else
{
ERR_put_error(16, 258, 16, "crypto/ec/ec_key.c", 304);
}
}
}
}
else
{
v5 = 0;
}
}
else
{
v6 = 0;
v5 = 0;
}
}
BN_CTX_free(v7);
EC_POINT_free(v6);
return v5;
}
else
{
ERR_put_error(16, 258, 67, "crypto/ec/ec_key.c", 278);
return 0;
}
}