//
// ossl_statem_server_post_work from 0xd50298 to 0xd503ac (276 bytes)
//
// 5 xrefs:
// > sub_D47644 @ 0xd477b4
// > sub_D47644 @ 0xd4785c
// > ??> @ 0x3b838
// > sub_D47644 @ 0xd47cac
// > ??> @ 0x1229e00
//
// 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 ossl_statem_server_post_work(__int64 a1)
{
int v1; // w1
v1 = *(_DWORD *)(a1 + 92) - 19;
*(_DWORD *)(a1 + 136) = 0;
switch ( v1 )
{
case 0:
if ( (unsigned int)statem_flush(a1) != 1 )
return 3;
if ( (unsigned int)ssl3_init_finished_mac(a1) )
return 2;
goto LABEL_8;
case 2:
if ( (unsigned int)statem_flush(a1) != 1 )
return 3;
if ( *(_DWORD *)a1 != 256 && !(unsigned int)ssl3_init_finished_mac(a1) )
goto LABEL_8;
*(_DWORD *)(a1 + 512) = 1;
return 2;
case 7:
case 17:
if ( (unsigned int)statem_flush(a1) == 1 )
return 2;
return 3;
case 16:
if ( (*(unsigned int (__fastcall **)(__int64, __int64))(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 32LL))(a1, 34) )
{
if ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 192LL) + 104LL) & 8) != 0 )
{
dtls1_reset_seq_numbers((_QWORD *)a1, 2);
return 2;
}
else
{
return 2;
}
}
else
{
LABEL_8:
ossl_statem_set_error(a1);
return 0;
}
default:
return 2;
}
}