//
// tls1_set_curves from 0x9c3310 to 0x9c33fc (236 bytes)
//
// 6 xrefs:
// > ssl3_ctrl @ 0x9a4264
// > ssl3_ctrl @ 0x9a4718
// > ssl3_ctx_ctrl @ 0x9a4bcc
// > ssl3_ctx_ctrl @ 0x9a4e00
// > tls1_set_curves_list @ 0x9c346c
// > ??> @ 0x749dc
//
// 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:05 +0000
//
int __fastcall tls1_set_curves(int *a1, int *a2, int a3, int a4)
{
int v4; // r8
int v7; // r0
int v8; // r7
int v9; // r10
int v10; // r9
int v11; // r11
int v12; // r4
int v13; // t1
int v14; // r0
int v15; // r1
v4 = 2 * a4;
v7 = CRYPTO_malloc(2 * a4, "ssl/t1_lib.c", 436);
v8 = v7;
if ( !v7 )
return 0;
if ( a4 )
{
v9 = 0;
v10 = a3 - 4;
v11 = 0;
v12 = v7 + 2;
while ( 1 )
{
v13 = *(_DWORD *)(v10 + 4);
v10 += 4;
v14 = tls1_ec_nid2curve_id(v13);
++v11;
v15 = 1 << v14;
if ( !v14 || (v15 & v9) != 0 )
break;
*(_BYTE *)(v12 - 2) = BYTE1(v14);
*(_BYTE *)(v12 - 1) = v14;
v9 |= v15;
v12 += 2;
if ( v11 == a4 )
goto LABEL_8;
}
CRYPTO_free(v8, "ssl/t1_lib.c", 445);
return 0;
}
else
{
LABEL_8:
CRYPTO_free(*a1, "ssl/t1_lib.c", 451);
*a1 = v8;
*a2 = v4;
return 1;
}
}