//
// SSL_get_error from 0xd425d4 to 0xd42758 (388 bytes)
//
// 8 xrefs:
// > sub_BB4C40 @ 0xbb4ce8
// > sub_BB5160 @ 0xbb51cc
// > sub_BB904C @ 0xbb90e8
// > sub_BB9808 @ 0xbb98ac
// > sub_D2F62C @ 0xd2f680
// > sub_D2F7C8 @ 0xd2f81c
// > sub_D2F9E8 @ 0xd2fb64
// > ??> @ 0x3cfa8
//
// 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_get_error(__int64 a1, int a2)
{
unsigned int v2; // w2
__int64 v6; // x0
int v7; // w0
int v8; // w0
__int64 rbio; // x19
int retry_reason; // w0
v2 = 0;
if ( a2 > 0 )
return v2;
v6 = ERR_peek_error(a1);
if ( v6 )
{
if ( BYTE3(v6) == 2 )
return 5;
else
return 1;
}
if ( !a2 )
{
if ( (*(_DWORD *)(a1 + 68) & 2) != 0 )
{
v2 = 6;
if ( *(_DWORD *)(*(_QWORD *)(a1 + 144) + 236LL) )
return 5;
}
else
{
return 5;
}
return v2;
}
if ( (unsigned int)SSL_want(a1) == 3 )
{
rbio = SSL_get_rbio(a1);
if ( (unsigned int)BIO_test_flags(rbio, 1) )
return 2;
if ( (unsigned int)BIO_test_flags(rbio, 2) )
return 3;
if ( (unsigned int)BIO_test_flags(rbio, 4) )
goto LABEL_23;
}
if ( (unsigned int)SSL_want(a1) != 2 )
{
LABEL_14:
v2 = SSL_want(a1);
if ( v2 != 4 )
{
v7 = SSL_want(a1);
v2 = 9;
if ( v7 != 5 )
{
v8 = SSL_want(a1);
v2 = 10;
if ( v8 != 6 )
return 5;
}
}
return v2;
}
rbio = *(_QWORD *)(a1 + 24);
if ( (unsigned int)BIO_test_flags(rbio, 2) )
return 3;
if ( (unsigned int)BIO_test_flags(rbio, 1) )
return 2;
if ( !(unsigned int)BIO_test_flags(rbio, 4) )
goto LABEL_14;
LABEL_23:
retry_reason = BIO_get_retry_reason(rbio);
v2 = 7;
if ( retry_reason != 2 )
{
v2 = 8;
if ( retry_reason != 3 )
return 5;
}
return v2;
}