//
// sub_100A87C from 0x100a87c to 0x100aaf4 (632 bytes)
//
// 1 xrefs:
// > ??> @ 0x1400430
//
// 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_100A87C(_QWORD *a1, __int64 a2)
{
_QWORD *v3; // x1
__int64 v4; // x3
__int64 v5; // x3
__int64 v6; // x3
__int64 v7; // x3
__int64 v8; // x3
__int64 v9; // x20
_DWORD *v10; // x20
unsigned int v11; // w25
int v12; // w0
int enc_flags; // w0
int v14; // w21
__int64 v15; // x24
__int64 v16; // x0
unsigned int v17; // w19
__int64 curve_name; // x0
_QWORD v20[10]; // [xsp+60h] [xbp+60h] BYREF
v3 = *(_QWORD **)(a2 + 32);
v4 = v3[1];
v20[0] = *v3;
v20[1] = v4;
v5 = v3[3];
v20[2] = v3[2];
v20[3] = v5;
v6 = v3[5];
v20[4] = v3[4];
v20[5] = v6;
v7 = v3[7];
v20[6] = v3[6];
v20[7] = v7;
v8 = v3[9];
v20[8] = v3[8];
v20[9] = v8;
v9 = EC_KEY_get0_group(v20);
if ( !v9 )
{
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(v9), !(_DWORD)curve_name) )
{
v10 = (_DWORD *)ASN1_STRING_new();
if ( v10 )
{
v11 = 16;
v12 = i2d_ECParameters(v20);
*v10 = v12;
if ( v12 > 0 )
goto LABEL_5;
ASN1_STRING_free((__int64)v10);
ERR_put_error(16, 223, 16, "crypto/ec/ec_ameth.c", 49);
}
LABEL_14:
ERR_put_error(16, 214, 142, "crypto/ec/ec_ameth.c", 226);
return 0;
}
v11 = 6;
v10 = (_DWORD *)OBJ_nid2obj(curve_name);
LABEL_5:
enc_flags = EC_KEY_get_enc_flags(v20);
EC_KEY_set_enc_flags(v20, enc_flags | 1u);
v14 = i2d_ECPrivateKey(v20);
if ( v14 )
{
v15 = CRYPTO_malloc(v14, "crypto/ec/ec_ameth.c", 244);
if ( !v15 )
{
v17 = 0;
ERR_put_error(16, 214, 65, "crypto/ec/ec_ameth.c", 246);
return v17;
}
if ( (unsigned int)i2d_ECPrivateKey(v20) )
{
v16 = OBJ_nid2obj(408);
return (unsigned int)PKCS8_pkey_set0(a1, v16, 0, v11, (__int64)v10, v15, v14) != 0;
}
CRYPTO_free(v15, "crypto/ec/ec_ameth.c", 251);
ERR_put_error(16, 214, 16, "crypto/ec/ec_ameth.c", 252);
return 0;
}
else
{
ERR_put_error(16, 214, 16, "crypto/ec/ec_ameth.c", 241);
return 0;
}
}