//
// sub_1003A20 from 0x1003a20 to 0x1003d08 (744 bytes)
//
// 2 xrefs:
// > ??> @ 0x13ffc28
// > ??> @ 0x13ffd00
//
// 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:55 +0000
//
__int64 __fastcall sub_1003A20(__int64 a1, __int64 a2, int a3)
{
__int64 v5; // x19
__int64 v6; // x20
__int64 v7; // x21
int v8; // w0
unsigned int v9; // w24
__int64 v10; // x2
__int64 v12; // x2
__int64 v13; // x2
__int64 v14; // x20
const char *v15; // x3
int v16; // w2
int v17; // w0
__int64 v18; // x2
v5 = *(_QWORD *)(a2 + 32);
v6 = *(_QWORD *)(v5 + 40);
v7 = *(_QWORD *)(v5 + 32);
if ( *(_QWORD *)(v5 + 8) == 0 || v6 == 0 || !v7 )
{
v10 = 67;
}
else
{
BIO_indent(a1, a3, 128);
v8 = BN_num_bits(*(_QWORD *)(v5 + 8));
if ( (int)BIO_printf(a1, "%s: (%d bit)\n", "DH Private-Key", v8) > 0 )
{
v9 = a3 + 4;
if ( (unsigned int)ASN1_bn_print(a1, "private-key:", v6, 0, (unsigned int)(a3 + 4)) )
{
if ( (unsigned int)ASN1_bn_print(a1, "public-key:", v7, 0, v9) )
{
if ( (unsigned int)ASN1_bn_print(a1, "prime:", *(_QWORD *)(v5 + 8), 0, v9) )
{
if ( (unsigned int)ASN1_bn_print(a1, "generator:", *(_QWORD *)(v5 + 16), 0, v9) )
{
v12 = *(_QWORD *)(v5 + 64);
if ( !v12 || (unsigned int)ASN1_bn_print(a1, "subgroup order:", v12, 0, v9) )
{
v13 = *(_QWORD *)(v5 + 72);
if ( !v13 || (unsigned int)ASN1_bn_print(a1, "subgroup factor:", v13, 0, v9) )
{
if ( *(_QWORD *)(v5 + 80) )
{
BIO_indent(a1, v9, 128);
v14 = 0;
BIO_puts(a1, (__int64)"seed:");
while ( 1 )
{
v17 = *(_DWORD *)(v5 + 88);
if ( (int)v14 >= v17 )
break;
if ( 15 * ((int)v14 / 15) == (_DWORD)v14 )
{
if ( (int)BIO_puts(a1, (__int64)&byte_11AAA48) <= 0
|| !(unsigned int)BIO_indent(a1, a3 + 8, 128) )
{
goto LABEL_5;
}
v17 = *(_DWORD *)(v5 + 88);
}
if ( (_DWORD)v14 + 1 == v17 )
v15 = &byte_11B8890;
else
v15 = ":";
v16 = *(unsigned __int8 *)(*(_QWORD *)(v5 + 80) + v14++);
if ( (int)BIO_printf(a1, "%02x%s", v16, v15) <= 0 )
goto LABEL_5;
}
if ( (int)BIO_write(a1, (__int64)&byte_11AAA48, 1u) <= 0 )
return 0;
}
v18 = *(_QWORD *)(v5 + 96);
if ( !v18 || (unsigned int)ASN1_bn_print(a1, "counter:", v18, 0, v9) )
{
if ( !*(_QWORD *)(v5 + 24) )
return 1;
BIO_indent(a1, v9, 128);
if ( (int)BIO_printf(a1, "recommended-private-length: %d bits\n", *(_DWORD *)(v5 + 24)) > 0 )
return 1;
}
}
}
}
}
}
}
}
LABEL_5:
v10 = 7;
}
ERR_put_error(5, 100, v10, "crypto/dh/dh_ameth.c", 343);
return 0;
}