// // sub_7BE300 from 0x7be300 to 0x7bf0b8 (3512 bytes) // // 2 xrefs: // > X509_NAME_print_ex @ 0x7c04c0 // > ASN1_STRING_print_ex @ 0x7c0cfc // // 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 sub_7BE300(int a1, int a2, _DWORD *a3) { int v3; // r7 _DWORD *v4; // r9 __int16 v5; // r5 size_t v6; // r3 int v8; // r4 int result; // r0 char v10; // r4 size_t v11; // r0 int v12; // r3 size_t v13; // r6 int v14; // r3 unsigned __int8 *v15; // r8 unsigned __int8 *v16; // r10 int v17; // r3 unsigned __int8 *v18; // r6 int v19; // r5 int v20; // r4 int v21; // r9 int v22; // r2 unsigned int v23; // r2 char v24; // r1 bool v25; // zf __int16 v26; // r1 __int16 v27; // r2 __int16 v28; // r2 __int16 v29; // r2 __int16 v30; // r2 __int16 v31; // r12 int v32; // r2 unsigned __int8 *v33; // r8 unsigned __int8 *v34; // r6 int *v35; // r3 int v36; // r0 int v37; // r0 int v38; // r0 __int16 v39; // r1 __int16 v40; // r2 __int16 v41; // r2 __int16 v42; // r2 __int16 v43; // r2 int v44; // r7 int v45; // r5 unsigned __int8 *v46; // r8 unsigned int v47; // t1 int v48; // r3 int v49; // r3 unsigned int v50; // r2 int *v51; // r4 int v52; // r0 char *v53; // r5 int v54; // r3 unsigned int v55; // r10 unsigned int v56; // r2 int v57; // r3 int v58; // t1 int v59; // r2 int v60; // r0 int v61; // r7 int v62; // r0 int v63; // r3 int v64; // r3 unsigned __int8 *v65; // r7 int v66; // r4 unsigned __int8 *v67; // r5 unsigned int v68; // t1 int v69; // r3 unsigned int v70; // [sp+0h] [bp-5Ch] size_t v71; // [sp+4h] [bp-58h] unsigned __int8 *v72; // [sp+4h] [bp-58h] char v73; // [sp+8h] [bp-54h] _BYTE *v74; // [sp+8h] [bp-54h] int v75; // [sp+Ch] [bp-50h] int v76; // [sp+10h] [bp-4Ch] int v77; // [sp+10h] [bp-4Ch] int v78; // [sp+14h] [bp-48h] int v79; // [sp+1Ch] [bp-40h] char v80; // [sp+20h] [bp-3Ch] int v81; // [sp+24h] [bp-38h] int v82; // [sp+24h] [bp-38h] _DWORD *v83; // [sp+28h] [bp-34h] unsigned __int8 v84; // [sp+3Eh] [bp-1Eh] BYREF char v85; // [sp+3Fh] [bp-1Dh] BYREF int v86; // [sp+40h] [bp-1Ch] BYREF int v87; // [sp+44h] [bp-18h] BYREF unsigned __int8 v88; // [sp+48h] [bp-14h] unsigned __int8 v89; // [sp+49h] [bp-13h] int v90; // [sp+4Ch] [bp-10h] BYREF _DWORD *v91; // [sp+50h] [bp-Ch] v4 = a3; v5 = a2; v70 = ((a2 << 16) & 0x40F0000u) >> 16; v6 = (unsigned __int16)a2; v73 = a2; v8 = a3[1]; v84 = 0; if ( (a2 & 0x40) != 0 ) { v3 = ASN1_tag2str(v8); v11 = strlen((const char *)v3); v13 = v11; if ( a1 && (v11 != BIO_write(a1, v3, v11, v12) || BIO_write(a1, &unk_9B1F30, 1, v14) != 1) ) return -1; v6 = v13 + 1; v71 = v13 + 1; } else { v71 = 0; } if ( (v5 & 0x80) != 0 ) { LABEL_5: if ( a1 ) { if ( BIO_write(a1, "#", 1, v6) != 1 ) return -1; if ( (v5 & 0x200) != 0 ) { v90 = v4[1]; v91 = v4; v44 = i2d_ASN1_TYPE(&v90, 0); v45 = CRYPTO_malloc(v44, "crypto/asn1/a_strex.c", 263); if ( !v45 ) return -1; v87 = v45; i2d_ASN1_TYPE(&v90, &v87); v46 = (unsigned __int8 *)v45; if ( v45 != v45 + v44 ) { while ( 1 ) { v47 = *v46++; v48 = *((unsigned __int8 *)&word_A0CF7C[144] + (v47 >> 4)); BYTE1(v86) = *((_BYTE *)&word_A0CF7C[144] + (v47 & 0xF)); LOBYTE(v86) = v48; if ( BIO_write(a1, &v86, 2, v48) != 2 ) break; if ( (unsigned __int8 *)(v45 + v44) == v46 ) goto LABEL_230; } CRYPTO_free(v45, "crypto/asn1/a_strex.c", 269); return -1; } goto LABEL_230; } v65 = (unsigned __int8 *)v4[2]; v66 = *v4; v67 = &v65[*v4]; while ( v67 != v65 ) { v68 = *v65++; v69 = *((unsigned __int8 *)&word_A0CF7C[144] + (v68 >> 4)); BYTE1(v90) = *((_BYTE *)&word_A0CF7C[144] + (v68 & 0xF)); LOBYTE(v90) = v69; if ( BIO_write(a1, &v90, 2, v69) != 2 ) return -1; } } else { if ( (v5 & 0x200) != 0 ) { v90 = v4[1]; v91 = v4; v44 = i2d_ASN1_TYPE(&v90, 0); v45 = CRYPTO_malloc(v44, "crypto/asn1/a_strex.c", 263); if ( !v45 ) return -1; v87 = v45; i2d_ASN1_TYPE(&v90, &v87); LABEL_230: v61 = 2 * v44; CRYPTO_free(v45, "crypto/asn1/a_strex.c", 269); if ( v61 < 0 ) return -1; v62 = v61 + 1; return v71 + v62; } v66 = *v4; } if ( (v66 & 0x40000000) != 0 ) return -1; v62 = 2 * v66 + 1; return v71 + v62; } if ( (v5 & 0x20) != 0 ) goto LABEL_20; v6 = v8 - 1; if ( (unsigned int)(v8 - 1) > 0x1D || (v6 = *((unsigned __int8 *)&word_A0CF7C[128] + v8), v10 = v6, (char)v6 == -1) ) { if ( (v5 & 0x100) != 0 ) goto LABEL_5; LABEL_20: if ( (v5 & 0x10) != 0 ) v10 = 9; else v10 = 1; goto LABEL_23; } if ( (v5 & 0x10) != 0 ) { if ( (_BYTE)v6 ) v10 = v6 | 8; else v10 = 1; } LABEL_23: v15 = (unsigned __int8 *)v4[2]; v76 = *v4; v16 = &v15[*v4]; if ( v15 != v16 ) { v80 = v10; v83 = v4; v17 = v10 & 7; v18 = (unsigned __int8 *)v4[2]; v19 = 0; v20 = v10 & 8; v21 = v17; v81 = a1; while ( 1 ) { if ( v15 == v18 ) v17 = v73 & 1; else a1 = 0; if ( v15 == v18 ) a1 = 32 * v17; switch ( v21 ) { case 0: v38 = UTF8_getc(v18, v76, &v86, v17); if ( v38 < 0 ) return -1; v23 = v86; v18 += v38; LABEL_32: if ( v16 == v18 ) { LABEL_95: if ( (v73 & 1) != 0 ) a1 = 64; if ( !v20 ) goto LABEL_98; LABEL_34: v3 = UTF8_putc(&v87, 6); if ( v3 <= 0 ) goto LABEL_81; v24 = a1 | v70; v25 = ((a1 | v70) & 0xF) == 0; a1 = (unsigned __int8)(a1 | v70); if ( !v25 ) { if ( (v87 & 0x80) != 0 ) { LOBYTE(v39) = v24 & 4; } else { v39 = word_A0CF7C[(unsigned __int8)v87] & a1; if ( (v39 & 0x61) != 0 ) { if ( (v39 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } goto LABEL_109; } } if ( (v39 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", (unsigned __int8)v87); v17 = 3; } else if ( (unsigned __int8)v87 == 92 ) { v17 = 2; } else { v17 = 1; } LABEL_109: v19 += v17; if ( v3 == 1 ) goto LABEL_81; if ( (v87 & 0x8000) != 0 ) { LOBYTE(v40) = a1 & 4; } else { v40 = word_A0CF7C[BYTE1(v87)] & a1; if ( (v40 & 0x61) != 0 ) { if ( (v40 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } goto LABEL_115; } } if ( (v40 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", BYTE1(v87)); v17 = 3; } else if ( BYTE1(v87) == 92 ) { v17 = 2; } else { v17 = 1; } LABEL_115: v19 += v17; if ( v3 == 2 ) goto LABEL_81; if ( (v87 & 0x800000) != 0 ) { LOBYTE(v41) = a1 & 4; } else { v41 = word_A0CF7C[BYTE2(v87)] & a1; if ( (v41 & 0x61) != 0 ) { if ( (v41 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } goto LABEL_121; } } if ( (v41 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", BYTE2(v87)); v17 = 3; } else if ( BYTE2(v87) == 92 ) { v17 = 2; } else { v17 = 1; } LABEL_121: v19 += v17; if ( v3 == 3 ) goto LABEL_81; if ( v87 < 0 ) { LOBYTE(v42) = a1 & 4; } else { v42 = word_A0CF7C[HIBYTE(v87)] & a1; if ( (v42 & 0x61) != 0 ) { if ( (v42 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } goto LABEL_127; } } if ( (v42 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X"); v17 = 3; } else if ( HIBYTE(v87) == 92 ) { v17 = 2; } else { v17 = 1; } LABEL_127: v19 += v17; if ( v3 == 4 ) goto LABEL_81; if ( (v88 & 0x80) != 0 ) { LOBYTE(v43) = a1 & 4; } else { v43 = word_A0CF7C[v88] & a1; if ( (v43 & 0x61) != 0 ) { if ( (v43 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } LABEL_133: v19 += v17; if ( v3 == 5 ) goto LABEL_81; if ( (v89 & 0x80) != 0 ) { LOBYTE(v31) = a1 & 4; } else { v31 = a1 & word_A0CF7C[v89]; if ( (v31 & 0x61) != 0 ) goto LABEL_144; } if ( (v31 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X"); v17 = 3; } else if ( v89 == 92 ) { v17 = 2; } else { v17 = 1; } LABEL_80: v19 += v17; goto LABEL_81; } } if ( (v43 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X"); v17 = 3; } else if ( v88 == 92 ) { v17 = 2; } else { v17 = 1; } goto LABEL_133; } if ( (v87 & 0x80) != 0 ) { LOBYTE(v26) = v24 & 4; LABEL_39: if ( (v26 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", (unsigned __int8)v87); v17 = 3; } else { v17 = 1; } goto LABEL_42; } v26 = word_A0CF7C[(unsigned __int8)v87] & a1; if ( (v26 & 0x61) == 0 ) goto LABEL_39; if ( (v26 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } LABEL_42: v19 += v17; if ( v3 == 1 ) goto LABEL_81; if ( (v87 & 0x8000) != 0 ) { LOBYTE(v27) = a1 & 4; LABEL_160: if ( (v27 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", BYTE1(v87)); v17 = 3; } else { v17 = 1; } goto LABEL_50; } v27 = word_A0CF7C[BYTE1(v87)] & a1; if ( (v27 & 0x61) == 0 ) goto LABEL_160; if ( (v27 & 8) != 0 ) v17 = 1; else v17 = 2; if ( (v27 & 8) != 0 ) v84 = v17; LABEL_50: v19 += v17; if ( v3 == 2 ) goto LABEL_81; if ( (v87 & 0x800000) != 0 ) { LOBYTE(v28) = a1 & 4; LABEL_156: if ( (v28 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", BYTE2(v87)); v17 = 3; } else { v17 = 1; } goto LABEL_58; } v28 = word_A0CF7C[BYTE2(v87)] & a1; if ( (v28 & 0x61) == 0 ) goto LABEL_156; if ( (v28 & 8) != 0 ) v17 = 1; else v17 = 2; if ( (v28 & 8) != 0 ) v84 = v17; LABEL_58: v19 += v17; if ( v3 == 3 ) goto LABEL_81; if ( v87 < 0 ) { LOBYTE(v29) = a1 & 4; LABEL_152: if ( (v29 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", HIBYTE(v87)); v17 = 3; } else { v17 = 1; } goto LABEL_66; } v29 = word_A0CF7C[HIBYTE(v87)] & a1; if ( (v29 & 0x61) == 0 ) goto LABEL_152; if ( (v29 & 8) != 0 ) v17 = 1; else v17 = 2; if ( (v29 & 8) != 0 ) v84 = v17; LABEL_66: v19 += v17; if ( v3 == 4 ) goto LABEL_81; if ( (v88 & 0x80) != 0 ) { LOBYTE(v30) = a1 & 4; LABEL_148: if ( (v30 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", v88); v17 = 3; } else { v17 = 1; } goto LABEL_74; } v30 = word_A0CF7C[v88] & a1; if ( (v30 & 0x61) == 0 ) goto LABEL_148; if ( (v30 & 8) != 0 ) v17 = 1; else v17 = 2; if ( (v30 & 8) != 0 ) v84 = v17; LABEL_74: v19 += v17; if ( v3 != 5 ) { if ( (v89 & 0x80) != 0 ) { LOBYTE(v31) = a1 & 4; goto LABEL_77; } v31 = a1 & word_A0CF7C[v89]; if ( (v31 & 0x61) == 0 ) { LABEL_77: if ( (v31 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X", v89); v17 = 3; } else { v17 = 1; } goto LABEL_80; } LABEL_144: if ( (v31 & 8) != 0 ) { v17 = 1; v84 = 1; } else { v17 = 2; } goto LABEL_80; } LABEL_81: if ( v16 == v18 ) goto LABEL_82; } else { LABEL_33: if ( v20 ) goto LABEL_34; LABEL_98: v37 = sub_7BE0F8(v23, (unsigned __int8)(a1 | v70), &v84, v20); if ( v37 < 0 ) return -1; v19 += v37; if ( v16 == v18 ) { LABEL_82: v10 = v80; a1 = v81; v4 = v83; goto LABEL_83; } } break; case 1: v23 = *v18; v86 = v23; ++v18; goto LABEL_32; case 2: v86 = *v18 << 8; v36 = v18[1]; v18 += 2; v23 = v86 | v36; v86 |= v36; if ( v16 == v18 ) goto LABEL_95; goto LABEL_33; case 4: v22 = *v18; v18 += 4; v86 = v22 << 24; v86 = (v22 << 24) | (*(v18 - 3) << 16); v86 |= *(v18 - 2) << 8; v23 = v86 | *(v18 - 1); v86 = v23; goto LABEL_32; default: return -1; } } } v19 = 0; LABEL_83: v32 = v71 + v19; v77 = v71 + v19; if ( v84 ) { v77 = v32 + 2; if ( !a1 ) return v32 + 2; if ( BIO_write(a1, "\"", 1, v32 + 2) != 1 ) return -1; } else if ( !a1 ) { return v77; } v33 = (unsigned __int8 *)v4[2]; v82 = *v4; v72 = &v33[*v4]; if ( v33 != v72 ) { v34 = (unsigned __int8 *)v4[2]; v79 = v73 & 1; v75 = v10 & 7; v74 = (_BYTE *)(v10 & 8); v35 = &v86; while ( 1 ) { if ( v33 == v34 ) v35 = (int *)v79; else v3 = 0; if ( v33 == v34 ) v3 = 32 * (_DWORD)v35; switch ( v75 ) { case 0: v60 = UTF8_getc(v34, v82, &v86, v75); if ( v60 < 0 ) return -1; v50 = v86; v34 += v60; goto LABEL_196; case 1: v50 = *v34; v86 = v50; ++v34; goto LABEL_196; case 2: v86 = *v34 << 8; v59 = v34[1]; v34 += 2; v50 = v86 | v59; v86 = v50; if ( v72 == v34 ) goto LABEL_213; goto LABEL_197; case 4: v49 = *v34; v34 += 4; v86 = v49 << 24; v86 = (v49 << 24) | (*(v34 - 3) << 16); v86 |= *(v34 - 2) << 8; v50 = v86 | *(v34 - 1); v86 = v50; LABEL_196: if ( v72 == v34 ) { LABEL_213: if ( v79 ) v3 = 64; if ( !v74 ) { LABEL_216: if ( sub_7BE0F8(v50, (unsigned __int8)(v3 | v70), v74, a1) < 0 ) return -1; goto LABEL_217; } } else { LABEL_197: if ( !v74 ) goto LABEL_216; } v51 = &v87; v52 = UTF8_putc(&v87, 6); if ( v52 > 0 ) { v53 = (char *)&v87 + v52; v54 = (v3 | v70) & 0xF; v55 = ((v3 | v70) & 4) << 16; v3 = (unsigned __int8)(v3 | v70); v78 = v54; while ( 1 ) { v58 = *(unsigned __int8 *)v51; v51 = (int *)((char *)v51 + 1); v57 = v58; v85 = v58; if ( (v58 & 0x80) != 0 ) { v56 = HIWORD(v55); } else { LOWORD(v56) = word_A0CF7C[v57] & v3; if ( (v56 & 0x61) != 0 ) { if ( (v56 & 8) != 0 ) goto LABEL_202; if ( BIO_write(a1, &word_9B841C, 1, v57) != 1 || BIO_write(a1, &v85, 1, v64) != 1 ) return -1; goto LABEL_203; } } if ( (v56 & 6) != 0 ) { BIO_snprintf(&v90, 11, "\\%02X"); if ( BIO_write(a1, &v90, 3, v63) != 3 ) return -1; if ( v51 == (int *)v53 ) break; } else { if ( v57 != 92 || (v57 = v78) == 0 ) { LABEL_202: if ( BIO_write(a1, &v85, 1, v57) != 1 ) return -1; goto LABEL_203; } if ( BIO_write(a1, &word_9B8418, 2, v78) != 2 ) return -1; LABEL_203: if ( v51 == (int *)v53 ) break; } } } LABEL_217: v35 = (int *)v72; if ( v72 == v34 ) goto LABEL_218; break; default: return -1; } } } LABEL_218: if ( !v84 ) return v77; v25 = BIO_write(a1, "\"", 1, v84) == 1; result = v77; if ( !v25 ) return -1; return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source