//
// EC_KEY_free from 0x9fd55c to 0x9fd62c (208 bytes)
//
// 20 xrefs:
// > sub_9D0340 @ 0x9d0398
// > sub_9F885C @ 0x9f8860
// > sub_9F8864 @ 0x9f88fc
// > sub_9F8980 @ 0x9f8f20
// > sub_9F8980 @ 0x9f9154
// > sub_9F9454 @ 0x9f951c
// > sub_9F95DC @ 0x9f96d0
// > d2i_ECPrivateKey @ 0x9fc19c
// > d2i_ECParameters @ 0x9fc6d4
// > EC_KEY_new_by_curve_name @ 0x9fd694
// > EC_KEY_new_by_curve_name @ 0x9fd6a8
// > EC_KEY_dup @ 0x9fd91c
// > EC_KEY_new_method @ 0x9fe888
// > PEM_read_bio_ECPrivateKey @ 0xa35a7c
// > PEM_read_ECPrivateKey @ 0xa35db0
// > d2i_EC_PUBKEY @ 0xa5f6f4
// > sub_A9F64C @ 0xa9f670
// > sub_A9F69C @ 0xa9f9dc
// > sub_A9FBA8 @ 0xa9fc04
// > ??> @ 0x77b2c
//
// 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:36 +0000
//
int __fastcall EC_KEY_free(int result)
{
int v1; // r4
void (__fastcall *v2)(int); // r3
int v3; // r3
void (__fastcall *v4)(int); // r3
int v5; // [sp+4h] [bp-Ch] BYREF
if ( result )
{
v1 = result;
result = CRYPTO_atomic_add(result + 32, -1, &v5, *(_DWORD *)(result + 44));
if ( v5 <= 0 )
{
v2 = *(void (__fastcall **)(int))(*(_DWORD *)v1 + 12);
if ( v2 )
v2(v1);
ENGINE_finish(*(_DWORD *)(v1 + 4));
v3 = *(_DWORD *)(v1 + 12);
if ( v3 )
{
v4 = *(void (__fastcall **)(int))(*(_DWORD *)v3 + 188);
if ( v4 )
v4(v1);
}
CRYPTO_free_ex_data(8, v1, v1 + 40);
CRYPTO_THREAD_lock_free(*(_DWORD *)(v1 + 44));
EC_GROUP_free(*(_DWORD *)(v1 + 12));
EC_POINT_free(*(_DWORD *)(v1 + 16));
BN_clear_free(*(_BYTE **)(v1 + 20));
return CRYPTO_clear_free(v1, 48, "crypto/ec/ec_key.c", 74);
}
}
return result;
}