//
// sub_9F2850 from 0x9f2850 to 0x9f2b6c (796 bytes)
//
// 2 xrefs:
// > ??> @ 0xc77ba8
// > ??> @ 0xc77c18
//
// 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_9F2850(int a1, int a2, int a3)
{
_DWORD *v3; // r4
int v4; // r9
int v5; // r10
bool v6; // zf
int v7; // r8
int v10; // r0
int v11; // r7
int v12; // r2
int v14; // r2
int v15; // r2
int v16; // r6
int v17; // r2
const char *v18; // r3
int v19; // r1
int v20; // r2
int v21; // [sp+Ch] [bp-8h]
v3 = *(_DWORD **)(a2 + 20);
v4 = v3[6];
v5 = v3[5];
v6 = v4 == 0;
if ( v4 )
v6 = v3[2] == 0;
v7 = v6;
if ( !v5 )
v7 |= 1u;
if ( v7 )
{
v12 = 67;
goto LABEL_13;
}
BIO_indent(a1, a3, 128);
v10 = BN_num_bits((_DWORD *)v3[2]);
if ( BIO_printf(a1, "%s: (%d bit)\n", "DH Private-Key", v10) <= 0
|| (v11 = a3 + 4, !ASN1_bn_print(a1, "private-key:", v4, 0, a3 + 4))
|| !ASN1_bn_print(a1, "public-key:", v5, 0, a3 + 4)
|| !ASN1_bn_print(a1, "prime:", v3[2], 0, a3 + 4)
|| !ASN1_bn_print(a1, "generator:", v3[3], 0, a3 + 4)
|| (v14 = v3[9]) != 0 && !ASN1_bn_print(a1, "subgroup order:", v14, 0, a3 + 4)
|| (v15 = v3[10]) != 0 && !ASN1_bn_print(a1, "subgroup factor:", v15, 0, a3 + 4) )
{
LABEL_11:
v12 = 7;
LABEL_13:
ERR_put_error(5, 100, v12, "crypto/dh/dh_ameth.c", 343);
return 0;
}
if ( !v3[11] )
goto LABEL_32;
BIO_indent(a1, a3 + 4, 128);
v21 = a3 + 8;
BIO_puts(a1, (int)"seed:");
v16 = 0;
while ( 1 )
{
v19 = v3[12];
if ( v16 >= v19 )
break;
if ( v16 == 15 * (v16 / 15) )
{
if ( BIO_puts(a1, (int)"\n") <= 0 || !BIO_indent(a1, v21, 128) )
goto LABEL_11;
v19 = v3[12];
}
v17 = *(unsigned __int8 *)(v3[11] + v16++);
if ( v16 == v19 )
v18 = &byte_BF4ECA;
else
v18 = (const char *)&unk_BF54E8;
if ( BIO_printf(a1, "%02x%s", v17, v18) <= 0 )
goto LABEL_11;
}
if ( BIO_write(a1, (int)"\n", 1) > 0 )
{
LABEL_32:
v20 = v3[13];
if ( !v20 || ASN1_bn_print(a1, "counter:", v20, 0, v11) )
{
if ( !v3[4] )
return 1;
BIO_indent(a1, v11, 128);
if ( BIO_printf(a1, "recommended-private-length: %d bits\n", v3[4]) > 0 )
return 1;
}
goto LABEL_11;
}
return 0;
}