// // sub_7C46C4 from 0x7c46c4 to 0x7c5088 (2500 bytes) // // 5 xrefs: // > sub_7C5148 @ 0x7c5d3c // > sub_7C626C @ 0x7c6abc // > sub_7C626C @ 0x7c6b18 // > ASN1_item_ex_d2i @ 0x7c74c4 // > ASN1_item_ex_d2i @ 0x7c74f8 // // 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_7C46C4(int *a1, void **a2, int a3, int a4, int a5, int a6, char a7, int a8) { int *v8; // r8 int v9; // r6 char *v13; // r10 int v14; // r3 int object; // r0 int v16; // r1 int v17; // r2 char *v19; // r3 int v20; // r2 int v21; // lr int v22; // r11 int v23; // r5 _BOOL4 v24; // r10 void *v25; // r9 int v26; // r3 void *v27; // r6 int v28; // r3 int (__fastcall *v29)(int *, void *, int, int, unsigned __int8 *, int); // r12 int v30; // r0 int v31; // r3 int v32; // r8 bool v33; // cc int v34; // r11 _DWORD *v35; // r4 int *v36; // r6 int v37; // r2 signed int *v38; // r9 int v39; // r10 char v40; // r0 int v41; // r2 char *v42; // r3 int v43; // r0 int v44; // r0 int v45; // r0 unsigned __int8 v46; // [sp+2Fh] [bp-2Dh] BYREF unsigned int v47; // [sp+30h] [bp-2Ch] BYREF void *v48; // [sp+34h] [bp-28h] BYREF int v49; // [sp+38h] [bp-24h] BYREF int v50; // [sp+3Ch] [bp-20h] BYREF int v51; // [sp+40h] [bp-1Ch] BYREF void *v52; // [sp+44h] [bp-18h] BYREF int v53; // [sp+48h] [bp-14h] BYREF _BYTE *v54; // [sp+4Ch] [bp-10h] int v55; // [sp+50h] [bp-Ch] int v56; // [sp+54h] [bp-8h] v8 = a1; v46 = 0; v53 = 0; v54 = nullptr; v55 = 0; v56 = 0; v9 = a5; if ( !a1 ) { ERR_put_error(13, 108, 125, "crypto/asn1/tasn_dec.c", 635); return 0; } if ( *(_BYTE *)a4 == 5 ) { v47 = a5; if ( a5 != -4 ) goto LABEL_23; v9 = -1; goto LABEL_25; } v47 = *(_DWORD *)(a4 + 4); if ( v47 == -4 ) { if ( a5 >= 0 ) { ERR_put_error(13, 108, 127, "crypto/asn1/tasn_dec.c", 649); return 0; } LABEL_25: if ( a7 ) { ERR_put_error(13, 108, 126, "crypto/asn1/tasn_dec.c", 654); return 0; } v48 = *a2; if ( !sub_7C41C0(nullptr, &v47, &v52, nullptr, nullptr, (unsigned __int8 **)&v48, a3, 0, a8) ) { ERR_put_error(13, 108, 58, "crypto/asn1/tasn_dec.c", 661); return 0; } if ( (_BYTE)v52 ) v47 = -3; } if ( v9 != -1 ) goto LABEL_5; v9 = v47; LABEL_23: a6 = 0; LABEL_5: v13 = (char *)*a2; v48 = v13; v52 = v13; if ( a8 ) { if ( *(_BYTE *)a8 ) { v14 = *(_DWORD *)(a8 + 20); v51 = *(_DWORD *)(a8 + 8); object = *(_DWORD *)(a8 + 4); v16 = *(_DWORD *)(a8 + 16); v17 = *(_DWORD *)(a8 + 12); v52 = &v13[v14]; v50 = v16; v49 = v17; } else { object = ASN1_get_object((unsigned __int8 **)&v52, &v51, &v49, &v50, a3); v19 = (char *)((_BYTE *)v52 - v13); v20 = v51; v21 = v49; *(_DWORD *)(a8 + 16) = v50; *(_DWORD *)(a8 + 20) = v19; *(_DWORD *)(a8 + 8) = v20; *(_DWORD *)(a8 + 12) = v21; *(_BYTE *)a8 = 1; *(_DWORD *)(a8 + 4) = object; if ( (object & 0x81) == 0 && a3 < (int)&v19[v20] ) { ERR_put_error(13, 104, 155, "crypto/asn1/tasn_dec.c", 1092); *(_BYTE *)a8 = 0; goto LABEL_15; } } if ( (object & 0x80) == 0 ) goto LABEL_9; ERR_put_error(13, 104, 102, "crypto/asn1/tasn_dec.c", 1100); *(_BYTE *)a8 = 0; LABEL_15: ERR_put_error(13, 108, 58, "crypto/asn1/tasn_dec.c", 676); return 0; } LOBYTE(object) = ASN1_get_object((unsigned __int8 **)&v52, &v51, &v49, &v50, a3); if ( (object & 0x80) != 0 ) { ERR_put_error(13, 104, 102, "crypto/asn1/tasn_dec.c", 1100); goto LABEL_15; } LABEL_9: if ( v9 >= 0 ) { if ( v9 == v49 && a6 == v50 ) { if ( a8 ) *(_BYTE *)a8 = 0; goto LABEL_31; } if ( a7 ) return -1; if ( a8 ) *(_BYTE *)a8 = 0; ERR_put_error(13, 104, 168, "crypto/asn1/tasn_dec.c", 1112); goto LABEL_15; } LABEL_31: if ( (object & 1) != 0 ) v9 = (int)v52; v22 = v47; if ( (object & 1) != 0 ) v13 -= v9; else v9 = (int)v52; if ( (object & 1) != 0 ) v23 = (int)&v13[a3]; else v23 = v51; v24 = v47 - 16 <= 1 || v47 == -3; v48 = (void *)v9; if ( !v24 ) { if ( (object & 0x20) != 0 ) { v33 = v47 > 0xA; if ( v47 != 10 ) v33 = (v47 & 0xFFFFFFFB) - 1 > 1; v34 = !v33; if ( !v33 ) { ERR_put_error(13, 108, 195, "crypto/asn1/tasn_dec.c", 712); return 0; } v46 = 1; v30 = sub_7C43BC(&v53, &v48, v23, object & 1, v34); if ( !v30 ) { LABEL_50: v31 = v46; v32 = v30; goto LABEL_51; } v23 = v53; if ( !BUF_MEM_grow_clean(&v53, v53 + 1) ) { v32 = 0; ERR_put_error(13, 108, 65, "crypto/asn1/tasn_dec.c", 730); v31 = v46; goto LABEL_51; } v54[v23] = v34; v25 = v54; v22 = v47; } else { v25 = (void *)v9; v48 = (void *)(v9 + v23); } goto LABEL_47; } if ( v47 == -3 ) { if ( a8 ) *(_BYTE *)a8 = 0; } else if ( (object & 0x20) == 0 ) { ERR_put_error(13, 108, 156, "crypto/asn1/tasn_dec.c", 694); return 0; } v25 = *a2; if ( (object & 1) == 0 ) { v26 = v9 - (_DWORD)v25; v27 = (void *)(v9 + v23); v23 += v26; v48 = v27; goto LABEL_47; } if ( v23 <= 0 ) { LABEL_122: ERR_put_error(13, 190, 137, "crypto/asn1/tasn_dec.c", 943); goto LABEL_83; } v39 = 1; while ( v23 != 1 && !*(_BYTE *)v9 && !*(_BYTE *)(v9 + 1) ) { --v39; v9 += 2; if ( !v39 ) { v48 = (void *)v9; v23 = v9 - (_DWORD)v25; v22 = v47; LABEL_47: v28 = *(_DWORD *)(a4 + 16); v52 = v25; if ( v28 ) { v29 = *(int (__fastcall **)(int *, void *, int, int, unsigned __int8 *, int))(v28 + 20); if ( v29 ) { v30 = v29(v8, v25, v23, v22, &v46, a4); if ( !v30 ) goto LABEL_50; LABEL_71: v31 = v46; LABEL_72: v32 = 1; *a2 = v48; goto LABEL_51; } } if ( *(_DWORD *)(a4 + 4) == -4 ) { v35 = (_DWORD *)*v8; if ( !*v8 ) { v44 = ASN1_TYPE_new(); v35 = (_DWORD *)v44; if ( !v44 ) { ((void (*)(void))ASN1_TYPE_free)(); goto LABEL_83; } *v8 = v44; } if ( *v35 != v22 ) ASN1_TYPE_set(v35, v22, 0); v36 = v8; v8 = v35 + 1; } else { v35 = nullptr; v36 = nullptr; } switch ( v22 ) { case 1: if ( v23 == 1 ) { *v8 = *(unsigned __int8 *)v52; goto LABEL_71; } ERR_put_error(13, 204, 106, "crypto/asn1/tasn_dec.c", 800); goto LABEL_81; case 2: case 10: if ( !c2i_ASN1_INTEGER(v8, &v52, v23) ) goto LABEL_81; v31 = v46; *(_DWORD *)(*v8 + 4) = v22 | *(_DWORD *)(*v8 + 4) & 0x100; goto LABEL_86; case 3: if ( c2i_ASN1_BIT_STRING(v8, &v52, v23) ) goto LABEL_71; goto LABEL_81; case 5: if ( !v23 ) { *v8 = 1; v31 = v46; goto LABEL_86; } ERR_put_error(13, 204, 144, "crypto/asn1/tasn_dec.c", 792); goto LABEL_81; case 6: if ( c2i_ASN1_OBJECT(v8, (char **)&v52, v23) ) goto LABEL_71; goto LABEL_81; default: if ( v22 == 30 ) { if ( (v23 & 1) != 0 ) { ERR_put_error(13, 204, 214, "crypto/asn1/tasn_dec.c", 842); goto LABEL_81; } } else if ( v22 == 28 && (v23 & 3) != 0 ) { ERR_put_error(13, 204, 215, "crypto/asn1/tasn_dec.c", 847); goto LABEL_81; } v38 = (signed int *)*v8; if ( *v8 ) { v38[1] = v22; } else { v45 = ASN1_STRING_type_new(v22); v38 = (signed int *)v45; if ( !v45 ) { ERR_put_error(13, 204, 65, "crypto/asn1/tasn_dec.c", 854); LABEL_81: ASN1_TYPE_free(v35); if ( v36 ) *v36 = 0; goto LABEL_83; } *v8 = v45; } if ( v46 ) { CRYPTO_free(v38[2], "crypto/asn1/tasn_dec.c", 864); v38[2] = (signed int)v52; *v38 = v23; v31 = 0; v46 = 0; } else { if ( !ASN1_STRING_set(v38, (const char *)v52, v23) ) { ERR_put_error(13, 204, 65, "crypto/asn1/tasn_dec.c", 870); ASN1_STRING_free((int)v38); *v8 = 0; goto LABEL_81; } v31 = v46; } LABEL_86: v37 = (int)v35; if ( v35 ) v37 = 1; if ( v22 != 5 ) v37 = 0; if ( v37 ) v35[1] = 0; goto LABEL_72; } } v23 -= 2; LABEL_121: if ( v23 <= 0 ) goto LABEL_122; } v52 = (void *)v9; v40 = ASN1_get_object((unsigned __int8 **)&v52, &v51, &v49, &v50, v23); if ( v40 < 0 ) { ERR_put_error(13, 104, 102, "crypto/asn1/tasn_dec.c", 1100); ERR_put_error(13, 190, 58, "crypto/asn1/tasn_dec.c", 928); goto LABEL_83; } v43 = v40 & 1; if ( v43 ) v42 = (char *)v52; else v41 = v51; if ( v43 ) v41 = v9 - (_DWORD)v42; else v42 = (char *)v52; if ( !v43 ) { v42 += v41; goto LABEL_133; } if ( v39 != -1 ) { ++v39; LABEL_133: v23 += v9 - (_DWORD)v42; v9 = (int)v42; goto LABEL_121; } ERR_put_error(13, 190, 58, "crypto/asn1/tasn_dec.c", 933); LABEL_83: v31 = v46; v32 = 0; LABEL_51: if ( v31 ) CRYPTO_free(v54, "crypto/asn1/tasn_dec.c", 750); return v32; }
GD Web Decomp Icon

GD Web Decomp

Raw Source