//
// BIO_read from 0x7d0870 to 0x7d098c (284 bytes)
//
// 20 xrefs:
// > ssl3_read_n @ 0x7887ac
// > DTLSv1_listen @ 0x7b6698
// > DTLSv1_listen @ 0x7b6734
// > DTLSv1_listen @ 0x7b69dc
// > sub_7D0120 @ 0x7d0214
// > sub_7D0270 @ 0x7d0328
// > sub_7D0270 @ 0x7d036c
// > sub_858480 @ 0x8588e0
// > ASN1_d2i_bio @ 0x8600e0
// > ASN1_d2i_bio @ 0x8601ec
// > ASN1_item_d2i_bio @ 0x860584
// > ASN1_item_d2i_bio @ 0x860690
// > sub_8B4BBC @ 0x8b4de8
// > sub_8B565C @ 0x8b56a0
// > OCSP_REQ_CTX_nbio @ 0x8b9394
// > SMIME_crlf_copy @ 0x8c5f40
// > SMIME_text @ 0x8c6ad8
// > sub_8D1D58 @ 0x8d1ea0
// > sub_8D59D0 @ 0x8d59f4
// > ??> @ 0x5a8ec
//
// 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
//
int __fastcall BIO_read(int a1, int a2, int a3)
{
int (__fastcall *v4)(int, int); // r5
int result; // r0
if ( a1 && *(_DWORD *)a1 && *(_DWORD *)(*(_DWORD *)a1 + 12) )
{
v4 = *(int (__fastcall **)(int, int))(a1 + 4);
if ( !v4 || (result = v4(a1, 2), result > 0) )
{
if ( *(_DWORD *)(a1 + 12) )
{
result = (*(int (__fastcall **)(int, int, int))(*(_DWORD *)a1 + 12))(a1, a2, a3);
if ( result > 0 )
*(_QWORD *)(a1 + 48) += result;
if ( v4 )
return ((int (__fastcall *)(int, int, int, int, _DWORD, int))v4)(a1, 130, a2, a3, 0, result);
}
else
{
ERR_put_error(32, 111, 120, "crypto/bio/bio_lib.c", 193);
return -2;
}
}
}
else
{
ERR_put_error(32, 111, 121, "crypto/bio/bio_lib.c", 183);
return -2;
}
return result;
}