//
// sub_D85DD8 from 0xd85dd8 to 0xd85f34 (348 bytes)
//
// 2 xrefs:
// > ??> @ 0x1122670
// > ??> @ 0x1122748
//
// 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
//
__int64 __fastcall sub_D85DD8(__int64 a1, __int64 a2)
{
__int64 v4; // x21
__int64 v5; // x0
_DWORD *v6; // x19
__int64 v7; // x1
int v8; // w0
__int64 v9; // x0
__int64 v10; // x21
int v11; // w23
__int64 v12; // x0
int v13; // w0
unsigned int v14; // w1
__int64 v16; // [xsp+48h] [xbp+48h] BYREF
v16 = 0;
v4 = *(_QWORD *)(a2 + 32);
v5 = ASN1_STRING_new();
v6 = (_DWORD *)v5;
if ( !v5 )
{
ERR_put_error(5, 109, 65, "crypto/dh/dh_ameth.c", 110);
goto LABEL_8;
}
v7 = v5 + 8;
if ( *(_UNKNOWN **)(a2 + 16) == &dhx_asn1_meth )
v8 = i2d_DHxparams(v4, v7);
else
v8 = i2d_DHparams(v4, v7);
*v6 = v8;
if ( v8 <= 0 )
{
ERR_put_error(5, 109, 65, "crypto/dh/dh_ameth.c", 115);
goto LABEL_8;
}
v9 = BN_to_ASN1_INTEGER(*(_QWORD *)(v4 + 32), 0);
v10 = v9;
if ( !v9 )
goto LABEL_8;
v11 = i2d_ASN1_INTEGER(v9, &v16);
ASN1_INTEGER_free(v10);
if ( v11 <= 0 )
{
ERR_put_error(5, 109, 65, "crypto/dh/dh_ameth.c", 129);
goto LABEL_8;
}
v12 = OBJ_nid2obj(**(unsigned int **)(a2 + 16));
v13 = X509_PUBKEY_set0_param(a1, v12, 16, v6, v16, (unsigned int)v11);
v14 = 1;
if ( !v13 )
{
LABEL_8:
CRYPTO_free(v16, "crypto/dh/dh_ameth.c", 138);
ASN1_STRING_free((__int64)v6);
return 0;
}
return v14;
}