// // ASN1_item_d2i_bio from 0x8604b0 to 0x8608a0 (1008 bytes) // // 12 xrefs: // > d2i_PKCS12_bio @ 0x826510 // > d2i_X509_bio @ 0x848364 // > d2i_X509_CRL_bio @ 0x8483c4 // > d2i_PKCS7_bio @ 0x848424 // > d2i_X509_REQ_bio @ 0x848484 // > d2i_RSAPrivateKey_bio @ 0x848558 // > d2i_RSAPublicKey_bio @ 0x848588 // > ASN1_item_d2i_fp @ 0x860908 // > d2i_CMS_bio @ 0x874284 // > SMIME_read_ASN1 @ 0x8c58bc // > SMIME_read_ASN1 @ 0x8c5a38 // > @ 0x659ec // // 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 ASN1_item_d2i_bio(int a1, int a2, int *a3) { size_t *v6; // r11 int v7; // r4 unsigned int v9; // r6 unsigned int v10; // r8 int v11; // r9 int v12; // r0 unsigned __int8 *v13; // r4 char object; // r9 unsigned int v15; // r3 unsigned int v16; // r9 unsigned int v17; // r4 int v18; // r10 int v19; // r7 int v20; // r0 int v21; // r7 int *v22; // r8 int v23; // r2 int v24; // [sp+10h] [bp-2Ch] int v25; // [sp+20h] [bp-1Ch] int *v26; // [sp+24h] [bp-18h] unsigned __int8 *v27; // [sp+28h] [bp-14h] BYREF unsigned int v28; // [sp+2Ch] [bp-10h] BYREF int v29; // [sp+30h] [bp-Ch] BYREF unsigned __int8 *v30[2]; // [sp+34h] [bp-8h] BYREF v6 = (size_t *)BUF_MEM_new(); if ( v6 ) { ERR_clear_error(); v26 = a3; v9 = 0; v10 = 0; v24 = 0; v25 = a1; while ( 1 ) { LABEL_6: v11 = v10 - v9; if ( v10 - v9 > 8 ) goto LABEL_13; LABEL_7: if ( v10 > v9 + 8 || !BUF_MEM_grow_clean(v6, v9 + 8) ) { ERR_put_error(13, 107, 65, (int)"crypto/asn1/a_d2i_fp.c", 121); goto LABEL_43; } v12 = BIO_read(a2, v6[1] + v10, v9 + 8 - v10); if ( ((v10 == v9) & ((unsigned int)v12 >> 31)) != 0 ) { ERR_put_error(13, 107, 142, (int)"crypto/asn1/a_d2i_fp.c", 126); goto LABEL_43; } if ( v12 <= 0 ) goto LABEL_13; if ( __CFADD__(v12, v10) ) { ERR_put_error(13, 107, 155, (int)"crypto/asn1/a_d2i_fp.c", 131); goto LABEL_43; } v11 = v12 + v10 - v9; v10 += v12; while ( 1 ) { LABEL_13: v13 = (unsigned __int8 *)(v6[1] + v9); v27 = v13; object = ASN1_get_object(&v27, (int *)&v28, &v29, (int *)v30, v11); if ( object < 0 ) { if ( ERR_peek_error() << 20 != 162529280 ) goto LABEL_43; ERR_clear_error(); } v9 += v27 - v13; if ( (object & 1) == 0 ) break; if ( v24 == -1 ) { ERR_put_error(13, 107, 123, (int)"crypto/asn1/a_d2i_fp.c", 157); goto LABEL_43; } v11 = v10 - v9; ++v24; if ( v10 - v9 <= 8 ) goto LABEL_7; } if ( !v24 || v28 ) break; if ( !v29 && !--v24 ) { v21 = v25; v22 = v26; v23 = v9; goto LABEL_47; } } v15 = v28 + v9; if ( v28 > v10 - v9 ) { v16 = v15 - v10; if ( (int)(v15 - v10) < 0 || v15 < v10 ) { ERR_put_error(13, 107, 155, (int)"crypto/asn1/a_d2i_fp.c", 178); goto LABEL_43; } if ( v16 ) { v17 = 0x4000; while ( 1 ) { v18 = v16 >= v17 ? v17 : v16; if ( !BUF_MEM_grow_clean(v6, v18 + v10) ) break; v19 = v18; do { v20 = BIO_read(a2, v6[1] + v10, v19); if ( v20 <= 0 ) { ERR_put_error(13, 107, 142, (int)"crypto/asn1/a_d2i_fp.c", 199); goto LABEL_43; } v19 -= v20; v10 += v20; } while ( v19 ); if ( v17 <= 0x3FFFFFFE ) v17 *= 2; v16 -= v18; if ( !v16 ) { v15 = v9 + v28; goto LABEL_37; } } ERR_put_error(13, 107, 65, (int)"crypto/asn1/a_d2i_fp.c", 191); goto LABEL_43; } } LABEL_37: if ( v9 > v15 ) { ERR_put_error(13, 107, 155, (int)"crypto/asn1/a_d2i_fp.c", 214); goto LABEL_43; } if ( v24 ) { v9 = v15; goto LABEL_6; } v23 = v15; v21 = v25; v22 = v26; LABEL_47: if ( v23 >= 0 ) { v30[0] = (unsigned __int8 *)v6[1]; v7 = ASN1_item_d2i(v22, v30, v23, v21); goto LABEL_4; } ERR_put_error(13, 107, 155, (int)"crypto/asn1/a_d2i_fp.c", 226); LABEL_43: BUF_MEM_free((int)v6); } else { ERR_put_error(13, 107, 65, (int)"crypto/asn1/a_d2i_fp.c", 111); } v6 = nullptr; v7 = 0; LABEL_4: BUF_MEM_free((int)v6); return v7; }
GD Web Decomp Icon

GD Web Decomp

Raw Source