//
// sub_100A660 from 0x100a660 to 0x100a87c (540 bytes)
//
// 1 xrefs:
// > ??> @ 0x1400410
//
// 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:15:59 +0000
//
__int64 __fastcall sub_100A660(__int64 a1, __int64 a2)
{
__int64 v3; // x19
__int64 v4; // x20
__int64 curve_name; // x0
_DWORD *v6; // x20
int v7; // w0
int v8; // w0
__int64 v9; // x22
__int64 v10; // x0
unsigned int v11; // w19
int v12; // w0
__int64 v13; // x5
__int64 v14; // x0
int v15; // w0
unsigned int v16; // w1
int v18; // w0
__int64 v19; // x0
int v20; // w0
__int64 v21; // [xsp+48h] [xbp+48h]
__int64 v22; // [xsp+58h] [xbp+58h] BYREF
v3 = *(_QWORD *)(a2 + 32);
if ( !v3 || (v4 = EC_KEY_get0_group(*(_QWORD *)(a2 + 32))) == 0 )
{
ERR_put_error(16, 223, 124, "crypto/ec/ec_ameth.c", 31);
goto LABEL_14;
}
if ( (unsigned int)EC_GROUP_get_asn1_flag() )
{
curve_name = EC_GROUP_get_curve_name(v4);
if ( (_DWORD)curve_name )
{
v6 = (_DWORD *)OBJ_nid2obj(curve_name);
v18 = i2o_ECPublicKey(v3, 0);
if ( v18 <= 0 )
{
v9 = 0;
goto LABEL_12;
}
v9 = CRYPTO_malloc(v18, "crypto/ec/ec_ameth.c", 73);
if ( !v9 )
goto LABEL_12;
v19 = v3;
v11 = 6;
v22 = v9;
v20 = i2o_ECPublicKey(v19, &v22);
v13 = (unsigned int)v20;
if ( v20 <= 0 )
goto LABEL_12;
goto LABEL_10;
}
}
v6 = (_DWORD *)ASN1_STRING_new();
if ( !v6 )
{
LABEL_14:
ERR_put_error(16, 216, 16, "crypto/ec/ec_ameth.c", 67);
return 0;
}
v7 = i2d_ECParameters(v3);
*v6 = v7;
if ( v7 <= 0 )
{
ASN1_STRING_free((__int64)v6);
ERR_put_error(16, 223, 16, "crypto/ec/ec_ameth.c", 49);
goto LABEL_14;
}
v8 = i2o_ECPublicKey(v3, 0);
if ( v8 <= 0 )
{
v9 = 0;
goto LABEL_17;
}
v9 = CRYPTO_malloc(v8, "crypto/ec/ec_ameth.c", 73);
if ( !v9 )
goto LABEL_17;
v10 = v3;
v11 = 16;
v22 = v9;
v12 = i2o_ECPublicKey(v10, &v22);
v13 = (unsigned int)v12;
if ( v12 <= 0 )
goto LABEL_17;
LABEL_10:
v21 = v13;
v14 = OBJ_nid2obj(408);
v15 = X509_PUBKEY_set0_param(a1, v14, v11, v6, v9, v21);
v16 = 1;
if ( v15 )
return v16;
if ( v11 != 6 )
{
LABEL_17:
ASN1_STRING_free((__int64)v6);
goto LABEL_18;
}
LABEL_12:
ASN1_OBJECT_free((__int64)v6);
LABEL_18:
CRYPTO_free(v9, "crypto/ec/ec_ameth.c", 88);
return 0;
}