//
// ec_GF2m_simple_oct2point from 0xe32c58 to 0xe32fd8 (896 bytes)
//
// 2 xrefs:
// > EC_POINT_oct2point @ 0xd94074
// > ??> @ 0x8f0e8
//
// 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
//
int32x2_t *__fastcall ec_GF2m_simple_oct2point(
__int64 **a1,
_QWORD *a2,
unsigned __int8 *a3,
__int64 a4,
int32x2_t *a5)
{
int v10; // w5
unsigned int v11; // w25
unsigned int v12; // w19
int32x2_t *result; // x0
int degree; // w0
int v15; // w2
int v16; // w0
int v17; // w20
__int64 v18; // x2
void **v19; // x28
__int64 *v20; // x21
__int64 *v21; // d8
__int64 v22; // d9
_BOOL4 v23; // w19
if ( !a4 )
{
ERR_put_error(16, 160, 100, (__int64)"crypto/ec/ec2_oct.c", 261);
return nullptr;
}
v10 = *a3;
v11 = v10 & 1;
v12 = v10 & 0xFFFFFFFE;
if ( (v10 & 0xF8) != 0 )
{
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 270);
return nullptr;
}
if ( (v10 & 0xFFFFFFFA) != 0 )
goto LABEL_5;
if ( (v10 & 1) != 0 )
{
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 274);
return nullptr;
}
if ( v12 )
{
LABEL_5:
degree = EC_GROUP_get_degree((__int64)a1);
v15 = degree + 14;
v16 = degree + 7;
if ( v16 >= 0 )
v15 = v16;
v17 = v15 >> 3;
if ( v12 == 2 )
v18 = v17 + 1LL;
else
v18 = 2LL * v17 + 1;
if ( v18 != a4 )
{
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 293);
return nullptr;
}
v19 = nullptr;
if ( !a5 )
{
result = (int32x2_t *)BN_CTX_new();
a5 = result;
if ( !result )
return result;
v19 = (void **)result;
}
BN_CTX_start((unsigned __int64)a5);
v20 = (__int64 *)BN_CTX_get(a5);
v21 = (__int64 *)BN_CTX_get(a5);
v22 = BN_CTX_get(a5);
if ( v22 && BN_bin2bn(a3 + 1, v17, (__int64)v20) )
{
if ( (BN_ucmp(v20, a1[8]) & 0x80000000) == 0 )
{
v23 = 0;
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 313);
LABEL_24:
BN_CTX_end((__int64)a5);
BN_CTX_free(v19);
return (int32x2_t *)v23;
}
if ( v12 == 2 )
{
v23 = EC_POINT_set_compressed_coordinates_GF2m((__int64)a1, a2, (__int64)v20, v11, (__int64)a5) != 0;
goto LABEL_24;
}
if ( BN_bin2bn(&a3[v17 + 1], v17, (__int64)v21) )
{
if ( (BN_ucmp(v21, a1[8]) & 0x80000000) == 0 )
{
v23 = 0;
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 325);
goto LABEL_24;
}
if ( v12 != 6 )
goto LABEL_30;
if ( ((unsigned int (__fastcall *)(__int64 **, __int64, __int64 *, __int64 *, int32x2_t *))(*a1)[35])(
a1,
v22,
v21,
v20,
a5) )
{
if ( (unsigned int)BN_is_odd(v22) != v11 )
{
v23 = 0;
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 332);
goto LABEL_24;
}
LABEL_30:
v23 = EC_POINT_set_affine_coordinates_GF2m((__int64)a1, a2) != 0;
goto LABEL_24;
}
}
}
v23 = 0;
goto LABEL_24;
}
if ( a4 == 1 )
return (int32x2_t *)EC_POINT_set_to_infinity((__int64)a1, a2);
ERR_put_error(16, 160, 102, (__int64)"crypto/ec/ec2_oct.c", 280);
return nullptr;
}