//
// ec_key_simple_priv2oct from 0x7e9854 to 0x7e98f0 (156 bytes)
//
// 5 xrefs:
// > ??> @ 0x6183c
// > ??> @ 0xab2740
// > ??> @ 0xab2804
// > ??> @ 0xab28c8
// > ??> @ 0xab500c
//
// 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
//
_DWORD *__fastcall ec_key_simple_priv2oct(int a1, _BYTE *a2, unsigned int a3)
{
int v6; // r3
_DWORD *result; // r0
int v8; // r4
unsigned int v9; // r4
v6 = EC_GROUP_order_bits(*(_DWORD *)(a1 + 12));
result = *(_DWORD **)(a1 + 20);
v8 = v6 + 7;
if ( v6 + 7 < 0 )
v8 = v6 + 14;
v9 = v8 >> 3;
if ( result )
{
if ( !a2 )
return (_DWORD *)v9;
if ( v9 > a3 )
return nullptr;
if ( BN_bn2binpad(result, a2, v9) == -1 )
{
ERR_put_error(16, 260, 100, "crypto/ec/ec_key.c", 578);
return nullptr;
}
else
{
return (_DWORD *)v9;
}
}
return result;
}