//
// sub_9F2C54 from 0x9f2c54 to 0x9f2db8 (356 bytes)
//
// 2 xrefs:
// > ??> @ 0xc77ba4
// > ??> @ 0xc77c14
//
// 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:30 +0000
//
int __fastcall sub_9F2C54(int a1, int a2)
{
int *v4; // r4
int v5; // r0
_DWORD *v6; // r1
int v7; // r0
size_t *v8; // r0
int v9; // r8
int v10; // r9
int v11; // r0
int v13; // [sp+14h] [bp-8h] BYREF
v13 = 0;
v4 = (int *)ASN1_STRING_new();
if ( v4 )
{
v5 = *(_DWORD *)(a2 + 20);
v6 = v4 + 2;
if ( *(_UNKNOWN **)(a2 + 12) == &dhx_asn1_meth )
v7 = i2d_DHxparams(v5, v6);
else
v7 = i2d_DHparams(v5, v6);
*v4 = v7;
if ( v7 <= 0 )
{
ERR_put_error(5, 111, 65, "crypto/dh/dh_ameth.c", 218);
}
else
{
v4[1] = 16;
v8 = (size_t *)BN_to_ASN1_INTEGER(*(_DWORD *)(*(_DWORD *)(a2 + 20) + 24), 0);
v9 = (int)v8;
if ( v8 )
{
v10 = i2d_ASN1_INTEGER(v8, &v13);
ASN1_STRING_clear_free(v9);
v11 = OBJ_nid2obj(**(_DWORD **)(a2 + 12));
if ( PKCS8_pkey_set0(a1, v11, 0, 16, (int)v4, v13, v10) )
return 1;
}
else
{
ERR_put_error(5, 111, 106, "crypto/dh/dh_ameth.c", 227);
}
}
}
else
{
ERR_put_error(5, 111, 65, "crypto/dh/dh_ameth.c", 212);
}
CRYPTO_free(v13, "crypto/dh/dh_ameth.c", 243);
ASN1_STRING_free((int)v4);
ASN1_STRING_clear_free(0);
return 0;
}