// // sub_D2F9E8 from 0xd2f9e8 to 0xd2fed0 (1256 bytes) // // 1 xrefs: // > @ 0x111ff88 // // 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 sub_D2F9E8(_QWORD *a1, __int64 a2, __int64 a3, _QWORD *a4) { _QWORD *v7; // x21 __int64 v8; // x0 __int64 v9; // x25 __int64 v10; // x1 _QWORD *v11; // x22 __int64 v12; // x2 __int64 v14; // x0 __int64 v15; // x1 __int64 v16; // x0 unsigned int v17; // w0 __int64 v18; // x19 int v19; // w0 _QWORD *v20; // x22 __int64 v21; // x19 __int64 rbio; // x19 __int64 v23; // x0 __int64 v24; // x19 __int64 data; // x19 __int64 v26; // x0 int v27; // w6 __int64 v28; // x5 __int64 v29; // x3 __int64 v30; // x4 __int64 v31; // x19 int v32; // w0 unsigned int retry_reason; // w0 v7 = (_QWORD *)((__int64 (*)(void))BIO_get_data)(); v8 = BIO_next(a1); v9 = v8; v10 = a2; v11 = (_QWORD *)*v7; if ( (_DWORD)a2 == 109 || v11 ) { switch ( (int)a2 ) { case 1: SSL_shutdown(*v7); v15 = v11[1]; v16 = v11[6]; if ( v16 == *(_QWORD *)(v15 + 48) ) { SSL_set_connect_state(v11); } else if ( v16 == *(_QWORD *)(v15 + 40) ) { SSL_set_accept_state(v11); } if ( !(unsigned int)SSL_clear(v11) ) return 0; if ( v9 ) { v14 = v9; v10 = 1; } else { v14 = v11[2]; v10 = 1; if ( !v14 ) return 1; } return BIO_ctrl(v14, v10, a3, a4); case 3: case 14: return 0; case 6: if ( !v8 || v11[2] == v8 ) return 1; BIO_up_ref(v8); SSL_set_bio(v11, v9, v9); return 1; case 7: if ( a1 != a4 ) return 1; SSL_set_bio(*v7, 0, 0); return 1; case 8: return (int)BIO_get_shutdown(a1); case 9: BIO_set_shutdown(a1, (unsigned int)a3); return 1; case 10: v32 = SSL_pending(*v7, a2); v12 = v32; if ( !v32 ) return (int)BIO_ctrl(v11[2], 10, 0, 0); return v12; case 11: BIO_clear_flags(a1, 15); v24 = BIO_ctrl(v11[3], 11, a3, a4); BIO_copy_next_retry(a1); return v24; case 12: data = BIO_get_data(a4); SSL_free(*(_QWORD *)data); v26 = SSL_dup(v11); v27 = *((_DWORD *)v7 + 2); v12 = v26 != 0; v28 = v7[2]; v29 = v7[3]; v30 = v7[4]; *(_QWORD *)(data + 40) = v7[5]; *(_QWORD *)data = v26; *(_DWORD *)(data + 8) = v27; *(_QWORD *)(data + 16) = v28; *(_QWORD *)(data + 24) = v29; *(_QWORD *)(data + 32) = v30; return v12; case 13: v14 = v11[3]; v10 = 13; return BIO_ctrl(v14, v10, a3, a4); case 15: *a4 = SSL_get_info_callback(*v7); return 1; case 101: BIO_clear_flags(a1, 15); BIO_set_retry_reason(a1, 0); v17 = SSL_do_handshake(v11); v18 = (int)v17; v19 = SSL_get_error(v11, v17) - 2; switch ( v19 ) { case 0: BIO_set_flags(a1, 9); v12 = v18; break; case 1: BIO_set_flags(a1, 10); v12 = v18; break; case 2: BIO_set_flags(a1, 12); BIO_set_retry_reason(a1, 1); v12 = v18; break; case 5: BIO_set_flags(a1, 12); retry_reason = BIO_get_retry_reason(v9); BIO_set_retry_reason(a1, retry_reason); v12 = v18; break; default: v12 = v18; break; } return v12; case 105: v14 = v11[2]; v10 = 105; return BIO_ctrl(v14, v10, a3, a4); case 109: if ( !v11 ) goto LABEL_32; if ( a1 ) { v20 = (_QWORD *)BIO_get_data(a1); if ( *v20 ) SSL_shutdown(*v20); if ( (unsigned int)BIO_get_shutdown(a1) ) { if ( (unsigned int)BIO_get_init(a1) ) SSL_free(*v20); BIO_clear_flags(a1, 0xFFFFFFFFLL); BIO_set_init(a1, 0); } CRYPTO_free(v20, "ssl/bio_ssl.c", 85); } v21 = CRYPTO_zalloc(48, "ssl/bio_ssl.c", 55); if ( v21 ) { BIO_set_init(a1, 0); BIO_set_data(a1, v21); BIO_clear_flags(a1, 0xFFFFFFFFLL); LABEL_32: BIO_set_shutdown(a1, (unsigned int)a3); *v7 = a4; rbio = SSL_get_rbio(a4); if ( rbio ) { if ( v9 ) BIO_push(); BIO_set_next(a1, rbio); BIO_up_ref(rbio); } BIO_set_init(a1, 1); return 1; } else { ERR_put_error(32, 118, 65, "ssl/bio_ssl.c", 58); return 0; } case 110: if ( !a4 ) return 0; *a4 = v11; return 1; case 119: v23 = *v7; if ( a3 ) SSL_set_connect_state(v23); else SSL_set_accept_state(v23); return 1; case 125: v12 = v7[2]; if ( a3 > 511 ) v7[2] = a3; return v12; case 126: return *((int *)v7 + 2); case 127: v31 = v7[4]; if ( a3 < 60 ) a3 = 5; v7[4] = a3; v7[5] = time(nullptr); return v31; default: v14 = v11[2]; return BIO_ctrl(v14, v10, a3, a4); } } return 0; }
GD Web Decomp Icon

GD Web Decomp

Raw Source