// // SMIME_write_ASN1 from 0xadb1e4 to 0xadb958 (1908 bytes) // // 2 xrefs: // > SMIME_write_CMS @ 0xa89084 // > @ 0x83d7c // // 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:09:31 +0000 // int __fastcall SMIME_write_ASN1( _DWORD *a1, size_t *a2, _DWORD *a3, unsigned int a4, int a5, int a6, _DWORD *a7, int a8) { const char *v9; // r11 const char *v13; // r5 char *v14; // r2 char v15; // t1 unsigned int v16; // r3 char v17; // r3 int v18; // r10 signed int i; // r9 int *v20; // r0 char *v21; // r10 char *v22; // r0 int digestbyname; // r0 int (__fastcall *v24)(_DWORD, int, _DWORD, void **); // r12 int v25; // r0 int v26; // r9 int (__fastcall *v27)(int, size_t **, int, void **); // r12 int v28; // r7 _DWORD *v29; // r0 _DWORD *v30; // r6 const char *v32; // r9 int v33; // r0 int v34; // r0 _DWORD *v35; // r0 _DWORD *v36; // r9 _DWORD *v37; // r10 int v38; // r6 const char *v39; // r10 int v40; // r0 int v41; // r0 _DWORD *v42; // r0 _DWORD *v43; // r7 _DWORD *v44; // r6 int v45; // [sp+10h] [bp-54h] size_t *v46; // [sp+2Ch] [bp-38h] BYREF void *v47; // [sp+30h] [bp-34h] BYREF _DWORD *v48; // [sp+34h] [bp-30h] int v49; // [sp+38h] [bp-2Ch] BYREF char v50[31]; // [sp+3Ch] [bp-28h] BYREF _BYTE v51[9]; // [sp+5Bh] [bp-9h] BYREF v9 = "application/pkcs7-"; if ( (a4 & 0x400) != 0 ) v9 = "application/x-pkcs7-"; v13 = "\n"; if ( (a4 & 0x800) != 0 ) v13 = (const char *)&word_BF5394; if ( ((a3 != nullptr) & (a4 >> 6)) == 0 ) { switch ( a5 ) { case 23: v39 = "enveloped-data"; v32 = "smime.p7m"; break; case 22: if ( a6 == 204 ) { v39 = "signed-receipt"; v32 = "smime.p7m"; } else { if ( OPENSSL_sk_num((int)a7) < 0 ) v39 = "certs-only"; else v39 = "signed-data"; v32 = "smime.p7m"; } break; case 786: v39 = "compressed-data"; v32 = "smime.p7z"; break; default: BIO_printf((int)a1, "MIME-Version: 1.0%s", v13); BIO_printf((int)a1, "Content-Disposition: attachment;"); v32 = "smime.p7m"; BIO_printf((int)a1, " filename=\"%s\"%s", "smime.p7m", v13); BIO_printf((int)a1, "Content-Type: %smime;", v9); goto LABEL_41; } BIO_printf((int)a1, "MIME-Version: 1.0%s", v13); BIO_printf((int)a1, "Content-Disposition: attachment;"); BIO_printf((int)a1, " filename=\"%s\"%s", v32, v13); BIO_printf((int)a1, "Content-Type: %smime;", v9); BIO_printf((int)a1, " smime-type=%s;", v39); LABEL_41: BIO_printf((int)a1, " name=\"%s\"%s", v32, v13); v33 = BIO_printf((int)a1, "Content-Transfer-Encoding: base64%s%s", v13, v13); v34 = BIO_f_base64(v33); v35 = BIO_new(v34); v36 = v35; if ( v35 ) { v37 = BIO_push(v35, (int)a1); v38 = i2d_ASN1_bio_stream((int)v37, a2, a3, a4, (unsigned __int8 *)a8); BIO_ctrl(v37, 11, 0, 0); BIO_pop(v37); BIO_free(v36); if ( !v38 ) return 0; BIO_printf((int)a1, "%s", v13); return 1; } else { ERR_put_error(13, 210, 65, (int)"crypto/asn1/asn_mime.c", 105); return 0; } } if ( RAND_bytes((int)v50, 32) <= 0 ) return 0; v14 = (char *)&v49 + 3; do { v15 = *++v14; v16 = v15 & 0xF; if ( v16 > 9 ) v17 = v16 + 55; else v17 = v16 + 48; *v14 = v17; } while ( v14 != v51 ); v18 = 0; v51[1] = 0; BIO_printf((int)a1, "MIME-Version: 1.0%s", v13); BIO_printf((int)a1, "Content-Type: multipart/signed;"); BIO_printf((int)a1, " protocol=\"%ssignature\";", v9); v45 = 0; BIO_puts((int)a1, (int)" micalg=\""); for ( i = 0; i < OPENSSL_sk_num((int)a7); ++i ) { if ( v18 ) BIO_write((int)a1, (int)",", 1); v20 = (int *)OPENSSL_sk_value(a7, i); v21 = OBJ_obj2nid(*v20); v22 = OBJ_nid2sn((unsigned int)v21); digestbyname = EVP_get_digestbyname((int)v22); if ( digestbyname ) { v24 = *(int (__fastcall **)(_DWORD, int, _DWORD, void **))(digestbyname + 44); if ( v24 ) { v25 = v24(0, 2, 0, &v47); if ( v25 > 0 ) { BIO_puts((int)a1, (int)v47); CRYPTO_free(v47, (int)"crypto/asn1/asn_mime.c", 170); v18 = 1; continue; } if ( v25 != -2 ) break; } } if ( v21 == (char *)&stru_29C.st_value ) { BIO_puts((int)a1, (int)"sha-256"); v18 = 1; continue; } if ( (int)v21 <= 672 ) { if ( v21 == (char *)&byte_4 ) { BIO_puts((int)a1, (int)"md5"); v18 = 1; continue; } if ( v21 == (char *)&dword_40 ) { BIO_puts((int)a1, (int)"sha1"); v18 = 1; continue; } } else { if ( v21 == (_BYTE *)&stru_29C.st_value + 2 ) { BIO_puts((int)a1, (int)"sha-512"); v18 = 1; continue; } if ( (int)v21 < 674 ) { BIO_puts((int)a1, (int)"sha-384"); v18 = 1; continue; } if ( v21 == (char *)&stru_31C.st_other ) { BIO_puts((int)a1, (int)"gostr3411-94"); break; } } if ( v45 ) { v18 = 0; } else { v18 = 1; v45 = 1; BIO_puts((int)a1, (int)"unknown"); } } BIO_printf((int)a1, "\"; boundary=\"----%s\"%s%s", v50, v13, v13); BIO_printf((int)a1, "This is an S/MIME signed message%s%s", v13, v13); BIO_printf((int)a1, "------%s%s", v50, v13); v46 = a2; v26 = *(_DWORD *)(a8 + 16); if ( (a4 & 0x8040) == 0x40 ) { if ( !v26 || (v27 = *(int (__fastcall **)(int, size_t **, int, void **))(v26 + 16)) == nullptr ) { ERR_put_error(13, 214, 202, (int)"crypto/asn1/asn_mime.c", 332); return 0; } v48 = nullptr; v49 = 0; v47 = a1; if ( v27(12, &v46, a8, &v47) <= 0 ) return 0; SMIME_crlf_copy(a3, (int)v48, a4); v28 = (*(int (__fastcall **)(int, size_t **, int, void **))(v26 + 16))(13, &v46, a8, &v47); v29 = v48; if ( a1 != v48 ) { do { v30 = (_DWORD *)BIO_pop(v29); BIO_free(v48); v29 = v30; v48 = v30; } while ( a1 != v30 ); } if ( v28 <= 0 ) return 0; } else { SMIME_crlf_copy(a3, (int)a1, a4); } BIO_printf((int)a1, "%s------%s%s", v13, v50, v13); BIO_printf((int)a1, "Content-Type: %ssignature;", v9); BIO_printf((int)a1, " name=\"smime.p7s\"%s", v13); BIO_printf((int)a1, "Content-Transfer-Encoding: base64%s", v13); BIO_printf((int)a1, "Content-Disposition: attachment;"); v40 = BIO_printf((int)a1, " filename=\"smime.p7s\"%s%s", v13, v13); v41 = BIO_f_base64(v40); v42 = BIO_new(v41); v43 = v42; if ( v42 ) { v44 = BIO_push(v42, (int)a1); i2d_ASN1_bio_stream((int)v44, a2, nullptr, 0, (unsigned __int8 *)a8); BIO_ctrl(v44, 11, 0, 0); BIO_pop(v44); BIO_free(v43); } else { ERR_put_error(13, 210, 65, (int)"crypto/asn1/asn_mime.c", 105); } BIO_printf((int)a1, "%s------%s--%s%s", v13, v50, v13, v13); return 1; }
GD Web Decomp Icon

GD Web Decomp

Raw Source