//
// DSA_dup_DH from 0x1007de8 to 0x1007fac (452 bytes)
//
// 2 xrefs:
// > sub_10A8244 @ 0x10a8438
// > ??> @ 0x86440
//
// 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:57 +0000
//
_QWORD *__fastcall DSA_dup_DH(__int64 *a1)
{
_QWORD *v2; // x21
unsigned __int64 *v3; // x19
unsigned __int64 *v4; // x0
unsigned __int64 *v5; // x24
unsigned __int64 *v6; // x22
unsigned __int64 *v7; // x0
__int64 v8; // x23
unsigned __int64 *v9; // x25
__int64 v10; // x0
_QWORD *result; // x0
if ( !a1 || (v2 = (_QWORD *)DH_new()) == nullptr )
{
v3 = nullptr;
v9 = nullptr;
v6 = nullptr;
v8 = 0;
v5 = nullptr;
v2 = nullptr;
goto LABEL_20;
}
v3 = (unsigned __int64 *)a1[2];
v4 = (unsigned __int64 *)a1[4];
if ( !v3 )
{
if ( v4 )
goto LABEL_18;
if ( !a1[3] )
goto LABEL_10;
LABEL_24:
v3 = v4;
goto LABEL_18;
}
if ( !v4 )
goto LABEL_24;
v4 = (unsigned __int64 *)a1[3];
if ( !v4 )
goto LABEL_24;
v5 = BN_dup(a1[2]);
v6 = BN_dup(a1[4]);
v7 = BN_dup(a1[3]);
v8 = (__int64)v7;
if ( !v6 || !v5 )
goto LABEL_21;
if ( !v7 )
{
v3 = nullptr;
v9 = nullptr;
goto LABEL_20;
}
if ( !(unsigned int)DH_set0_pqg(v2, (__int64)v5, (__int64)v7, (__int64)v6) )
{
LABEL_21:
v3 = nullptr;
v9 = nullptr;
goto LABEL_20;
}
LABEL_10:
v3 = (unsigned __int64 *)a1[5];
if ( v3 )
{
v9 = BN_dup(a1[5]);
if ( !v9 )
{
v3 = nullptr;
v6 = nullptr;
v8 = 0;
v5 = nullptr;
goto LABEL_20;
}
v10 = a1[6];
if ( !v10 )
{
v3 = nullptr;
goto LABEL_14;
}
v3 = BN_dup(v10);
if ( v3 )
{
LABEL_14:
if ( (unsigned int)DH_set0_key((__int64)v2, (__int64)v9, (__int64)v3) )
return v2;
v6 = nullptr;
v8 = 0;
v5 = nullptr;
LABEL_20:
BN_free((__int64)v5);
BN_free((__int64)v6);
BN_free(v8);
BN_free((__int64)v9);
BN_free((__int64)v3);
DH_free((__int64)v2);
return nullptr;
}
LABEL_19:
v6 = v3;
v8 = (__int64)v3;
v5 = v3;
goto LABEL_20;
}
result = v2;
if ( a1[6] )
{
LABEL_18:
v9 = v3;
goto LABEL_19;
}
return result;
}