//
// EC_KEY_set_public_key_affine_coordinates from 0x7e945c to 0x7e965c (512 bytes)
//
// 1 xrefs:
// > ??> @ 0x6177c
//
// 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
//
bool __fastcall EC_KEY_set_public_key_affine_coordinates(_DWORD *a1, int *a2, int *a3)
{
bool v4; // zf
int v8; // r0
int v9; // r7
int v10; // r8
int *v11; // r9
int *v12; // r10
int v13; // r0
_BOOL4 v14; // r4
if ( !a1 || !a1[3] )
goto LABEL_7;
v4 = a3 == nullptr;
if ( a3 )
v4 = a2 == nullptr;
if ( v4 )
{
LABEL_7:
ERR_put_error(16, 229, 67, "crypto/ec/ec_key.c", 350);
return 0;
}
v8 = BN_CTX_new();
v9 = v8;
if ( !v8 )
return 0;
BN_CTX_start(v8);
v10 = EC_POINT_new(a1[3]);
if ( !v10 )
goto LABEL_14;
v11 = (int *)BN_CTX_get(v9);
v12 = (int *)BN_CTX_get(v9);
if ( !v12 )
goto LABEL_14;
v13 = EC_GROUP_method_of(a1[3]);
if ( EC_METHOD_get_field_type(v13) == 407 )
{
if ( !EC_POINT_set_affine_coordinates_GF2m(a1[3], v10, a2, a3, v9)
|| !EC_POINT_get_affine_coordinates_GF2m(a1[3], v10, v11, v12, v9) )
{
goto LABEL_14;
}
}
else if ( !EC_POINT_set_affine_coordinates_GFp(a1[3], v10, a2)
|| !EC_POINT_get_affine_coordinates_GFp(a1[3], v10, v11, v12, v9) )
{
goto LABEL_14;
}
if ( BN_cmp(a2, v11)
|| BN_cmp(a3, v12)
|| BN_cmp(a2, *(int **)(a1[3] + 36)) >= 0
|| BN_cmp(a3, *(int **)(a1[3] + 36)) >= 0 )
{
ERR_put_error(16, 229, 146, "crypto/ec/ec_key.c", 399);
}
else if ( EC_KEY_set_public_key(a1, v10) )
{
v14 = EC_KEY_check_key((int)a1) != 0;
goto LABEL_15;
}
LABEL_14:
v14 = 0;
LABEL_15:
BN_CTX_end(v9);
BN_CTX_free(v9);
EC_POINT_free(v10);
return v14;
}