//
// sub_7DE054 from 0x7de054 to 0x7de1b8 (356 bytes)
//
// 2 xrefs:
// > ??> @ 0xa30924
// > ??> @ 0xa30994
//
// 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
//
int __fastcall sub_7DE054(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;
}