//
// ECPKParameters_print from 0xa03f58 to 0xa045a8 (1616 bytes)
//
// 7 xrefs:
// > sub_9F9C6C @ 0x9f9d44
// > sub_9F9DA0 @ 0x9f9f00
// > sub_9F9F64 @ 0x9fa0f8
// > EC_KEY_print @ 0x9fa3a0
// > ECParameters_print @ 0x9fa500
// > ECPKParameters_print_fp @ 0xa04648
// > ??> @ 0x7ac6c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:07:39 +0000
//
int __fastcall ECPKParameters_print(int a1, _DWORD *a2, int a3)
{
int v6; // r5
int v7; // r0
int v8; // r4
int v9; // r8
int v10; // r7
int v11; // r11
int v12; // r2
int v13; // r6
int v15; // r0
int field_type; // r4
int curve_GF2m; // r0
int curve_name; // r0
const char *v19; // r0
char *v20; // r1
int v21; // r0
void *v22; // r0
unsigned int v23; // r6
int v24; // r2
bool v25; // zf
const char *v26; // r0
char *v27; // r6
int basis_type; // r6
const char *v29; // r0
int v30; // [sp+Ch] [bp-A0h]
int v31; // [sp+Ch] [bp-A0h]
_BOOL4 v32; // [sp+10h] [bp-9Ch]
void *v33; // [sp+14h] [bp-98h]
int v34; // [sp+18h] [bp-94h]
int point_conversion_form; // [sp+1Ch] [bp-90h]
int v36; // [sp+20h] [bp-8Ch]
int seed_len; // [sp+24h] [bp-88h]
_BYTE v38[132]; // [sp+28h] [bp-84h] BYREF
if ( !a2 )
{
v8 = 0;
v9 = 0;
v10 = 0;
v11 = 0;
v6 = 0;
v12 = 67;
goto LABEL_7;
}
v6 = BN_CTX_new();
if ( !v6 )
{
v8 = 0;
v9 = 0;
v10 = 0;
v11 = 0;
v12 = 65;
goto LABEL_7;
}
if ( !EC_GROUP_get_asn1_flag((int)a2) )
{
v15 = EC_GROUP_method_of((int)a2);
field_type = EC_METHOD_get_field_type(v15);
v30 = field_type;
v11 = BN_new();
if ( !v11 )
{
v8 = 0;
v9 = 0;
v10 = 0;
v12 = 65;
goto LABEL_7;
}
v10 = BN_new();
if ( !v10 )
{
v8 = 0;
v9 = 0;
v12 = 65;
goto LABEL_7;
}
v9 = BN_new();
if ( !v9 )
{
v8 = 0;
v12 = 65;
goto LABEL_7;
}
v32 = field_type == 407;
if ( field_type == 407 )
{
curve_GF2m = EC_GROUP_get_curve_GF2m((int)a2);
if ( !curve_GF2m )
{
LABEL_15:
v8 = curve_GF2m;
v12 = 16;
goto LABEL_7;
}
}
else
{
curve_GF2m = EC_GROUP_get_curve_GFp((int)a2);
if ( !curve_GF2m )
goto LABEL_15;
}
v8 = EC_GROUP_get0_generator((int)a2);
if ( !v8 )
goto LABEL_56;
v33 = (void *)EC_GROUP_get0_order((int)a2);
v34 = EC_GROUP_get0_cofactor((int)a2);
if ( !v33 )
{
v8 = 0;
v12 = 16;
goto LABEL_7;
}
point_conversion_form = EC_GROUP_get_point_conversion_form((int)a2);
v8 = EC_POINT_point2bn(a2, v8, point_conversion_form, 0, v6);
if ( !v8 )
{
LABEL_56:
v12 = 16;
goto LABEL_7;
}
v36 = EC_GROUP_get0_seed((int)a2);
if ( v36 )
seed_len = EC_GROUP_get_seed_len((int)a2);
else
seed_len = 0;
if ( !BIO_indent(a1, a3, 128) )
goto LABEL_19;
v19 = (const char *)OBJ_nid2sn(v30);
if ( BIO_printf(a1, "Field Type: %s\n", v19) <= 0 )
goto LABEL_19;
if ( v32 )
{
basis_type = EC_GROUP_get_basis_type(a2);
if ( !basis_type )
goto LABEL_19;
if ( !BIO_indent(a1, a3, 128) )
goto LABEL_19;
v29 = (const char *)OBJ_nid2sn(basis_type);
if ( BIO_printf(a1, "Basis Type: %s\n", v29) <= 0 || !ASN1_bn_print(a1, "Polynomial:", v11, 0, a3) )
goto LABEL_19;
}
else if ( !ASN1_bn_print(a1, "Prime:", v11, 0, a3) )
{
goto LABEL_19;
}
if ( !ASN1_bn_print(a1, "A: ", v10, 0, a3) || !ASN1_bn_print(a1, "B: ", v9, 0, a3) )
goto LABEL_19;
if ( point_conversion_form == 2 )
{
v21 = ASN1_bn_print(a1, "Generator (compressed):", v8, 0, a3);
}
else
{
v20 = point_conversion_form == 4 ? "Generator (uncompressed):" : "Generator (hybrid):";
v21 = ASN1_bn_print(a1, v20, v8, 0, a3);
}
if ( !v21 || !ASN1_bn_print(a1, "Order: ", v33, 0, a3) || v34 && !ASN1_bn_print(a1, "Cofactor: ", v34, 0, a3) )
goto LABEL_19;
if ( !v36 )
goto LABEL_75;
if ( a3 <= 0 )
{
a3 = 0;
}
else
{
if ( a3 >= 128 )
a3 = 128;
v22 = memset(v38, 32, a3);
if ( BIO_write(a1, (int)v22, a3) <= 0 )
goto LABEL_19;
}
if ( BIO_printf(a1, "%s", "Seed:") > 0 )
{
if ( seed_len )
{
v31 = v36 - 1;
v23 = 0;
while ( 1 )
{
v25 = v23 == 15 * (v23 / 0xF);
++v23;
if ( v25 )
{
v38[0] = 10;
memset(&v38[1], 32, a3 + 4);
if ( BIO_write(a1, (int)v38, a3 + 5) <= 0 )
goto LABEL_19;
}
v24 = *(unsigned __int8 *)++v31;
if ( v23 == seed_len )
{
if ( BIO_printf(a1, "%02x%s", v24, &byte_BF4ECA) <= 0 )
goto LABEL_19;
break;
}
if ( BIO_printf(a1, "%02x%s", v24, &unk_BF54E8) <= 0 )
goto LABEL_19;
}
}
if ( BIO_write(a1, (int)"\n", 1) > 0 )
{
LABEL_75:
v13 = 1;
goto LABEL_8;
}
}
LABEL_19:
v12 = 32;
goto LABEL_7;
}
v7 = BIO_indent(a1, a3, 128);
if ( v7 )
{
curve_name = EC_GROUP_get_curve_name((int)a2);
v8 = curve_name;
if ( curve_name )
{
v26 = (const char *)OBJ_nid2sn(curve_name);
if ( BIO_printf(a1, "ASN1 OID: %s", v26) > 0 && BIO_printf(a1, "\n") > 0 )
{
v27 = EC_curve_nid2nist(v8);
if ( !v27 )
goto LABEL_62;
v7 = BIO_indent(a1, a3, 128);
if ( !v7 )
goto LABEL_5;
if ( BIO_printf(a1, "NIST CURVE: %s\n", v27) > 0 )
{
LABEL_62:
v8 = 0;
v9 = 0;
v10 = 0;
v11 = 0;
v13 = 1;
goto LABEL_8;
}
}
v8 = 0;
}
v9 = 0;
v10 = 0;
v11 = 0;
goto LABEL_19;
}
LABEL_5:
v8 = v7;
v9 = v7;
v10 = v7;
v11 = v7;
v12 = 32;
LABEL_7:
ERR_put_error(16, 149, v12, "crypto/ec/eck_prn.c", 228);
v13 = 0;
LABEL_8:
BN_free(v11);
BN_free(v10);
BN_free(v9);
BN_free(v8);
BN_CTX_free(v6);
return v13;
}