//
// ssl_update_cache from 0xd41c5c to 0xd41d44 (232 bytes)
//
// 3 xrefs:
// > tls_finish_handshake @ 0xd4e81c
// > tls_finish_handshake @ 0xd4e8a0
// > ??> @ 0x70e90
//
// 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
//
__int64 __fastcall ssl_update_cache(__int64 a1, int a2)
{
__int64 result; // x0
int v5; // w21
__int64 v6; // x19
time_t v7; // x0
result = *(unsigned int *)(*(_QWORD *)(a1 + 376) + 56LL);
if ( !(_DWORD)result )
return result;
result = *(_QWORD *)(a1 + 720);
v5 = *(_DWORD *)(result + 64);
if ( (a2 & v5) != 0 && !*(_DWORD *)(a1 + 176) )
{
if ( (v5 & 0x200) != 0 )
{
LABEL_5:
result = *(_QWORD *)(result + 80);
if ( result )
{
SSL_SESSION_up_ref(*(_QWORD *)(a1 + 376));
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)(a1 + 720) + 80LL))(a1, *(_QWORD *)(a1 + 376));
if ( !(_DWORD)result )
result = SSL_SESSION_free(*(_QWORD *)(a1 + 376));
}
goto LABEL_8;
}
result = SSL_CTX_add_session();
if ( (_DWORD)result )
{
result = *(_QWORD *)(a1 + 720);
goto LABEL_5;
}
}
LABEL_8:
if ( a2 == (a2 & v5) && (v5 & 0x80) == 0 )
{
v6 = *(_QWORD *)(a1 + 720);
if ( (a2 & 1) != 0 )
result = *(unsigned __int8 *)(v6 + 112) == 255;
else
result = *(unsigned __int8 *)(v6 + 124) == 255;
if ( (_DWORD)result )
{
v7 = time(nullptr);
return SSL_CTX_flush_sessions(v6, v7);
}
}
return result;
}