// // sub_9D9D48 from 0x9d9d48 to 0x9daa20 (3288 bytes) // // 2 xrefs: // > sub_9DAAB8 @ 0x9dabb4 // > sub_9DAAB8 @ 0x9dacac // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 12:07:17 +0000 // int __fastcall sub_9D9D48(int result, unsigned __int8 **a2, int a3, int *a4, unsigned __int8 a5, int a6) { int v7; // r3 int v8; // r4 int v9; // r0 int v10; // r2 int v11; // r0 int v12; // r4 int v13; // r0 int v14; // r1 int v15; // r5 unsigned __int8 *v16; // r10 int v17; // r4 int v18; // r6 int v19; // r0 int v20; // r0 unsigned __int8 *v21; // r2 int v22; // r0 int choice_selector; // r0 int v24; // r3 int v25; // r8 int v26; // r7 int v27; // r5 int v28; // r0 int v29; // r0 int v30; // r2 _DWORD *v31; // r6 int v32; // r8 int v33; // r7 int v34; // r8 int v35; // r0 int v36; // r0 int v37; // r0 int v38; // r10 unsigned __int8 *v39; // r5 int v40; // r5 int (__fastcall *v41)(int, int *, int, _DWORD); // r3 _DWORD *v42; // r0 int v43; // r0 int v44; // r5 int field_ptr; // r0 int v46; // r0 int *v47; // [sp+20h] [bp-54h] int (__fastcall *v48)(int, int *, int, _DWORD); // [sp+28h] [bp-4Ch] int v50; // [sp+44h] [bp-30h] char *v51; // [sp+48h] [bp-2Ch] int v52; // [sp+4Ch] [bp-28h] BYREF char v53; // [sp+54h] [bp-20h] BYREF unsigned __int8 v54; // [sp+55h] [bp-1Fh] BYREF unsigned __int8 v55; // [sp+56h] [bp-1Eh] BYREF char v56; // [sp+57h] [bp-1Dh] BYREF int v57; // [sp+58h] [bp-1Ch] BYREF unsigned __int8 *v58; // [sp+5Ch] [bp-18h] BYREF int v59; // [sp+60h] [bp-14h] BYREF int v60; // [sp+64h] [bp-10h] BYREF char *v61; // [sp+68h] [bp-Ch] BYREF int v62[2]; // [sp+6Ch] [bp-8h] BYREF v47 = (int *)result; v52 = a3; if ( !result ) return result; v7 = *a4; v58 = *a2; if ( (v7 & 0x1000) != 0 ) { v57 = result; v47 = &v57; } v8 = v7 & 6; v9 = v7 & 0xC0; if ( (v7 & 6) == 0 ) { if ( (v7 & 8) != 0 ) { v19 = sub_9DAE6C(v47, &v58, v52, a4[4], a4[1], v9, a5, a6); if ( !v19 ) { ERR_put_error(13, 131, 58, "crypto/asn1/tasn_dec.c", 600); return v8; } } else { v19 = sub_9DAE6C(v47, &v58, v52, a4[4], -1, 0, a5, a6); if ( !v19 ) { ERR_put_error(13, 131, 58, "crypto/asn1/tasn_dec.c", 609); return v8; } } if ( v19 != -1 ) goto LABEL_24; return -1; } if ( (v7 & 8) != 0 ) { v10 = a4[1]; } else { v9 = 0; if ( (v7 & 2) != 0 ) v10 = 17; else v10 = 16; } v11 = sub_9D8B3C(&v52, nullptr, nullptr, &v53, nullptr, &v58, v52, v10, v9, a5, a6); v8 = v11; if ( !v11 ) { ERR_put_error(13, 131, 58, "crypto/asn1/tasn_dec.c", 536); return 0; } if ( v11 == -1 ) return v8; v12 = *v47; if ( *v47 ) { while ( OPENSSL_sk_num(v12) > 0 ) { v13 = OPENSSL_sk_pop(v12); v14 = a4[4]; v62[0] = v13; ASN1_item_ex_free(v62, v14); } v46 = *v47; } else { v46 = OPENSSL_sk_new_null(v11); *v47 = v46; } if ( !v46 ) { ERR_put_error(13, 131, 65, "crypto/asn1/tasn_dec.c", 555); return 0; } v15 = v52; if ( v52 <= 0 ) { LABEL_31: if ( v53 ) { ERR_put_error(13, 131, 137, "crypto/asn1/tasn_dec.c", 591); return 0; } LABEL_24: v8 = 1; *a2 = v58; return v8; } while ( 1 ) { v16 = v58; if ( v15 != 1 && !*v58 && !v58[1] ) break; v59 = 0; v17 = a4[4]; v60 = v15; v18 = *(_DWORD *)(v17 + 16); v61 = nullptr; if ( v18 ) { v48 = *(int (__fastcall **)(int, int *, int, _DWORD))(v18 + 16); switch ( *(_BYTE *)v17 ) { case 0: goto LABEL_74; case 1: case 6: goto LABEL_46; case 2: if ( !v48 ) goto LABEL_94; if ( !v48(4, &v59, v17, 0) ) goto LABEL_85; if ( !v59 ) goto LABEL_94; choice_selector = asn1_get_choice_selector(&v59, v17); v24 = *(_DWORD *)(v17 + 12); if ( choice_selector >= 0 && choice_selector < v24 ) { v44 = *(_DWORD *)(v17 + 8) + 20 * choice_selector; field_ptr = asn1_get_field_ptr(&v59, v44); asn1_template_free(field_ptr, v44); asn1_set_choice_selector(&v59, -1, v17); v24 = *(_DWORD *)(v17 + 12); } break; case 4: v20 = ((int (__fastcall *)(int *, unsigned __int8 **, int, int, int, _DWORD, _DWORD, int))v48)( &v59, &v58, v15, v17, -1, 0, 0, a6); goto LABEL_27; case 5: goto LABEL_76; default: goto LABEL_80; } LABEL_39: v25 = 0; v61 = (char *)v58; v26 = *(_DWORD *)(v17 + 8); if ( v24 > 0 ) { while ( 1 ) { v27 = asn1_get_field_ptr(&v59, v26); v28 = sub_9DAAB8(v27, &v61, v60); if ( v28 != -1 ) break; v24 = *(_DWORD *)(v17 + 12); ++v25; v26 += 20; if ( v25 >= v24 ) goto LABEL_43; } if ( v28 <= 0 ) { asn1_template_free(v27, v26); ERR_put_error(13, 120, 58, "crypto/asn1/tasn_dec.c", 237); if ( v26 ) goto LABEL_98; goto LABEL_79; } v24 = *(_DWORD *)(v17 + 12); } LABEL_43: if ( v25 == v24 ) { ERR_put_error(13, 120, 143, "crypto/asn1/tasn_dec.c", 249); goto LABEL_79; } asn1_set_choice_selector(&v59, v25, v17); v41 = v48; if ( !v48 ) goto LABEL_120; LABEL_84: if ( !v41(5, &v59, v17, 0) ) goto LABEL_85; goto LABEL_120; } switch ( *(_BYTE *)v17 ) { case 0: LABEL_74: if ( *(_DWORD *)(v17 + 8) ) v20 = sub_9DAAB8(&v59, &v58, v15); else v20 = sub_9D92C4(&v59, (void **)&v58, v15, v17, -1, 0, 0, a6); goto LABEL_27; case 1: case 6: v48 = nullptr; LABEL_46: v61 = (char *)v58; v29 = sub_9D8B3C(&v60, nullptr, nullptr, &v55, &v56, (unsigned __int8 **)&v61, v15, 16, 0, 0, a6); if ( !v29 ) { ERR_put_error(13, 120, 58, "crypto/asn1/tasn_dec.c", 274); goto LABEL_79; } if ( v29 == -1 ) goto LABEL_28; if ( v18 && (*(_DWORD *)(v18 + 4) & 4) != 0 ) { v50 = 1; v60 = v15 + v58 - (unsigned __int8 *)v61; } else { v50 = v55; } if ( !v56 ) { ERR_put_error(13, 120, 149, "crypto/asn1/tasn_dec.c", 286); goto LABEL_79; } if ( !v59 && !ASN1_item_ex_new(&v59, v17) ) { ERR_put_error(13, 120, 58, "crypto/asn1/tasn_dec.c", 291); goto LABEL_79; } if ( v48 && !v48(4, &v59, v17, 0) ) goto LABEL_85; v30 = *(_DWORD *)(v17 + 12); v31 = *(_DWORD **)(v17 + 8); if ( v30 <= 0 ) { v32 = 0; goto LABEL_107; } v33 = 0; break; case 2: v48 = nullptr; LABEL_94: if ( !ASN1_item_ex_new(&v59, v17) ) { ERR_put_error(13, 120, 58, "crypto/asn1/tasn_dec.c", 214); goto LABEL_79; } v24 = *(_DWORD *)(v17 + 12); goto LABEL_39; case 4: v20 = ((int (__fastcall *)(int *, unsigned __int8 **, int, int, int, _DWORD, _DWORD, int))((char *)&stru_27FFFC.r_info + 2))( &v59, &v58, v15, v17, -1, 0, 0, a6); goto LABEL_27; case 5: LABEL_76: v61 = (char *)v58; if ( !sub_9D8DC0(nullptr, v62, &v54, nullptr, nullptr, (unsigned __int8 **)&v61, v15, 1, a6) ) { ERR_put_error(13, 120, 58, "crypto/asn1/tasn_dec.c", 174); goto LABEL_79; } v40 = v54; if ( v54 ) { ERR_put_error(13, 120, 139, "crypto/asn1/tasn_dec.c", 183); goto LABEL_79; } if ( (ASN1_tag2bit(v62[0]) & *(_DWORD *)(v17 + 4)) == 0 ) { ERR_put_error(13, 120, 140, "crypto/asn1/tasn_dec.c", 191); goto LABEL_79; } v20 = sub_9D92C4(&v59, (void **)&v58, v60, v17, v62[0], v40, v40, a6); LABEL_27: if ( !v20 ) goto LABEL_80; LABEL_28: v21 = v58; goto LABEL_29; default: goto LABEL_80; } do { while ( (*v31 & 0x300) == 0 ) { ++v33; v31 += 5; if ( v33 >= v30 ) goto LABEL_63; } v34 = asn1_do_adb(&v59, v31, 0); if ( v34 ) { v35 = asn1_get_field_ptr(&v59, v34); asn1_template_free(v35, v34); } v30 = *(_DWORD *)(v17 + 12); ++v33; v31 += 5; } while ( v33 < v30 ); LABEL_63: v32 = 0; v31 = *(_DWORD **)(v17 + 8); if ( v30 <= 0 ) goto LABEL_107; v51 = (char *)v16; do { v26 = asn1_do_adb(&v59, v31, 1); if ( !v26 ) goto LABEL_79; v37 = asn1_get_field_ptr(&v59, v26); v38 = v37; if ( !v60 ) { v16 = (unsigned __int8 *)v51; if ( !v55 ) goto LABEL_117; goto LABEL_136; } v39 = (unsigned __int8 *)v61; if ( v60 > 1 && !*v61 && !v61[1] ) { v16 = (unsigned __int8 *)v51; v61 += 2; if ( v55 ) { v60 -= 2; v55 = 0; goto LABEL_112; } ERR_put_error(13, 120, 159, "crypto/asn1/tasn_dec.c", 325); goto LABEL_79; } v36 = sub_9DAAB8(v37, &v61, v60); if ( !v36 ) { LABEL_98: ERR_add_error_data(4, "Field=", *(_DWORD *)(v26 + 12)); goto LABEL_80; } if ( v36 == -1 ) asn1_template_free(v38, v26); else v60 += v39 - (unsigned __int8 *)v61; ++v32; v31 += 5; } while ( v32 < *(_DWORD *)(v17 + 12) ); v16 = (unsigned __int8 *)v51; LABEL_107: if ( v55 ) { if ( v60 > 1 && !*v61 && !v61[1] ) { v61 += 2; goto LABEL_112; } LABEL_136: ERR_put_error(13, 120, 137, "crypto/asn1/tasn_dec.c", 364); LABEL_79: ERR_add_error_data(2, "Type=", *(_DWORD *)(v17 + 24)); LABEL_80: ERR_put_error(13, 131, 58, "crypto/asn1/tasn_dec.c", 578); ASN1_item_free(v59, a4[4]); return 0; } LABEL_112: if ( !v50 && v60 ) { ERR_put_error(13, 120, 148, "crypto/asn1/tasn_dec.c", 369); goto LABEL_79; } LABEL_117: while ( v32 < *(_DWORD *)(v17 + 12) ) { v42 = (_DWORD *)asn1_do_adb(&v59, v31, 1); ++v32; v31 += 5; v26 = (int)v42; if ( !v42 ) goto LABEL_79; if ( (*v42 & 1) == 0 ) { ERR_put_error(13, 120, 121, "crypto/asn1/tasn_dec.c", 389); goto LABEL_98; } v43 = asn1_get_field_ptr(&v59, v42); asn1_template_free(v43, v26); } if ( !asn1_enc_save(&v59, v58, v61 - (char *)v58, v17) ) { LABEL_85: ERR_put_error(13, 120, 100, "crypto/asn1/tasn_dec.c", 405); goto LABEL_79; } v41 = v48; if ( v48 ) goto LABEL_84; LABEL_120: v21 = (unsigned __int8 *)v61; v58 = (unsigned __int8 *)v61; LABEL_29: v22 = *v47; v52 += v16 - v21; if ( !OPENSSL_sk_push(v22, v59) ) { ERR_put_error(13, 131, 65, "crypto/asn1/tasn_dec.c", 585); ASN1_item_free(v59, a4[4]); return 0; } v15 = v52; if ( v52 <= 0 ) goto LABEL_31; } v58 += 2; if ( v53 ) goto LABEL_24; ERR_put_error(13, 131, 159, "crypto/asn1/tasn_dec.c", 567); return 0; }
GD Web Decomp Icon

GD Web Decomp

Raw Source