// // sub_BB5160 from 0xbb5160 to 0xbb54e8 (904 bytes) // // 2 xrefs: // > sub_BB92C8 @ 0xbb9334 // > sub_BB94F4 @ 0xbb9554 // // 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_BB5160(__int64 a1, int a2) { __int64 v3; // x24 __int64 *v4; // x25 __int64 v5; // x20 __int64 v6; // x21 __int64 v7; // x22 unsigned int v8; // w0 __int64 v9; // x1 int error; // w0 __int64 v11; // x21 __int64 verify_result; // x0 const char *v13; // x0 unsigned int v14; // w19 __int64 result; // x0 __int64 v16; // x0 int v17; // w0 char *v18; // x2 const char *v19; // x2 __int64 v20; // x3 __int64 current_cipher; // x0 const char *name; // x0 const char *v23; // [xsp+58h] [xbp+58h] int v24; // [xsp+6Ch] [xbp+6Ch] BYREF const char *v25; // [xsp+70h] [xbp+70h] BYREF char v26[256]; // [xsp+78h] [xbp+78h] BYREF v3 = *(_QWORD *)a1; if ( *(_DWORD *)(a1 + 384) != 2 || *(_DWORD *)(a1 + 40LL * (*(_DWORD *)(a1 + 612) != -1) + 748) == 2 ) v4 = (__int64 *)(v3 + 1160); else v4 = (__int64 *)(v3 + 1344); v5 = a2; ERR_clear_error(); v6 = a1 + 40 * v5; v7 = v6 + 672; v8 = SSL_connect(*(_QWORD *)(v6 + 688)); v9 = v8; if ( v8 == 1 ) { *(_DWORD *)(v6 + 672) = 4; v16 = *(_QWORD *)(v6 + 688); if ( !v16 ) { v18 = &byte_F288A0; goto LABEL_33; } v17 = SSL_version(v16, v9); if ( v17 == 769 ) { v16 = *(_QWORD *)(v6 + 688); v18 = "TLSv1.0"; goto LABEL_33; } if ( v17 > 769 ) { if ( v17 != 770 ) { if ( v17 == 771 ) { v16 = *(_QWORD *)(v6 + 688); v18 = "TLSv1.2"; goto LABEL_33; } goto LABEL_39; } v16 = *(_QWORD *)(v6 + 688); v18 = "TLSv1.1"; } else { if ( v17 != 2 ) { if ( v17 == 768 ) { v16 = *(_QWORD *)(v6 + 688); v18 = "SSLv3"; goto LABEL_33; } LABEL_39: v18 = "unknown"; v16 = *(_QWORD *)(a1 + 40 * v5 + 688); goto LABEL_33; } v16 = *(_QWORD *)(v6 + 688); v18 = "SSLv2"; } LABEL_33: v23 = v18; current_cipher = SSL_get_current_cipher(v16); name = (const char *)SSL_CIPHER_get_name(current_cipher); sub_B7B528(v3, "SSL connection using %s / %s\n", v23, name); result = 0; if ( *(_BYTE *)(a1 + 984) ) { SSL_get0_alpn_selected(*(_QWORD *)(a1 + 40 * v5 + 688), &v25, &v24); if ( v24 ) { sub_B7B528(v3, "ALPN, server accepted to use %.*s\n", v24, v25); if ( v24 == 8 && !memcmp("http/1.1", v25, 8u) ) { *(_DWORD *)(a1 + 1824) = 2; return 0; } else { return 0; } } else { sub_B7B528(v3, "ALPN, server did not agree to a protocol\n"); return 0; } } return result; } error = SSL_get_error(*(_QWORD *)(v6 + 688), v8); if ( error == 2 || error == 3 ) { *(_DWORD *)(v6 + 672) = error; return 0; } else { v26[0] = 0; memset(&v26[1], 0, 0xFFu); *(_DWORD *)(v6 + 672) = 1; v11 = ERR_get_error(); if ( BYTE3(v11) == 20 && (v11 & 0xFFF) == 0x86 ) { verify_result = SSL_get_verify_result(*(_QWORD *)(v7 + 16)); if ( verify_result ) { *v4 = verify_result; v13 = (const char *)X509_verify_cert_error_string(); sub_B8C278(v26, 256, "SSL certificate problem: %s", v13); } else { strcpy(v26, "SSL certificate verification failed"); } v14 = 60; goto LABEL_11; } ERR_error_string_n(v11, v26, 256); if ( v11 ) { v14 = 35; LABEL_11: sub_B7B690(v3, "%s", v26); return v14; } if ( *(_DWORD *)(a1 + 384) != 2 || *(_DWORD *)(a1 + 40LL * (*(_DWORD *)(a1 + 612) != -1) + 748) == 2 ) { v19 = *(const char **)(a1 + 192); v20 = *(int *)(a1 + 416); } else { v19 = *(const char **)(a1 + 360); v20 = *(_QWORD *)(a1 + 408); } sub_B7B690(v3, "Unknown SSL protocol error in connection to %s:%ld ", v19, v20); return 35; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source