//
// ssl_update_cache from 0x9add54 to 0x9ade40 (236 bytes)
//
// 3 xrefs:
// > tls_finish_handshake @ 0x9bb4cc
// > tls_finish_handshake @ 0x9bb560
// > ??> @ 0x75acc
//
// 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:06:55 +0000
//
_DWORD *__fastcall ssl_update_cache(_DWORD *result, int a2)
{
_DWORD *v2; // r5
unsigned int v4; // r4
int v5; // r7
int v6; // r4
int v7; // r4
int v8; // r4
int v9; // r3
time_t v10; // r1
if ( !*(_DWORD *)(result[60] + 56) )
return result;
v2 = result;
result = (_DWORD *)result[111];
v4 = result[8];
v5 = a2 & v4;
if ( (a2 & v4) != 0 && !v2[30] )
{
if ( (v4 & 0x200) != 0 )
{
LABEL_6:
if ( result[10] )
{
SSL_SESSION_up_ref(v2[60]);
result = (_DWORD *)(*(int (__fastcall **)(_DWORD *, _DWORD))(v2[111] + 40))(v2, v2[60]);
if ( !result )
result = (_DWORD *)SSL_SESSION_free(v2[60]);
}
goto LABEL_9;
}
result = (_DWORD *)SSL_CTX_add_session();
if ( result )
{
result = (_DWORD *)v2[111];
goto LABEL_6;
}
}
LABEL_9:
v6 = (v4 >> 7) ^ 1;
if ( a2 == v5 )
v7 = v6 & 1;
else
v7 = 0;
if ( v7 )
{
v8 = v2[111];
if ( (a2 & 1) != 0 )
v9 = *(unsigned __int8 *)(v8 + 60);
else
v9 = *(unsigned __int8 *)(v8 + 72);
if ( v9 == 255 )
{
v10 = time(nullptr);
return (_DWORD *)SSL_CTX_flush_sessions(v8, v10);
}
}
return result;
}