// // PKCS7_dataDecode from 0x104af6c to 0x104b6d4 (1896 bytes) // // 1 xrefs: // > @ 0xfad50 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // 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 13:16:36 +0000 // __int64 __fastcall PKCS7_dataDecode(__int64 a1, __int64 a2, __int64 a3, __int64 a4) { int v8; // w0 __int16 v9; // w2 int v10; // w4 unsigned __int64 v11; // x20 _BYTE *v12; // x24 __int64 v13; // x23 __int64 v14; // x19 __int64 v15; // x21 _QWORD *v17; // x0 __int64 v18; // x1 __int64 v19; // x25 __int64 v20; // x22 __int64 v21; // x27 __int64 *v22; // d9 unsigned int v23; // w0 char *v24; // x0 unsigned int *cipherbyname; // d8 _BOOL4 v26; // w0 int v27; // w20 bool v28; // cc __int64 v29; // x1 __int64 v30; // x0 __int64 *v31; // x23 __int64 v32; // x0 unsigned int v33; // w0 char *v34; // x0 __int64 digestbyname; // x3 __int64 v36; // x1 __int64 v37; // x0 unsigned int v38; // w0 char *v39; // x0 __int64 v40; // x0 int v41; // w19 __int64 v42; // x1 __int64 v43; // x20 __int64 v44; // x22 __int64 issuer_name; // x0 __int64 serialNumber; // x0 int v47; // w0 __int64 v48; // x19 __int64 v49; // x0 __int64 v50; // x1 __int64 v51; // x2 void *v52; // x0 __int64 v53; // x0 int v54; // [xsp+7Ch] [xbp+7Ch] BYREF unsigned int *v55; // [xsp+80h] [xbp+80h] BYREF _BYTE *v56; // [xsp+88h] [xbp+88h] BYREF v55 = nullptr; v56 = nullptr; v54 = 0; if ( a1 ) { if ( *(_QWORD *)(a1 + 32) ) { v8 = OBJ_obj2nid(*(_QWORD *)(a1 + 24)); *(_DWORD *)(a1 + 16) = 0; if ( v8 == 23 ) { v36 = *(_QWORD *)(a1 + 32); v37 = *(_QWORD *)(v36 + 16); v19 = *(_QWORD *)(v36 + 8); v21 = *(_QWORD *)(v37 + 16); v22 = *(__int64 **)(v37 + 8); v38 = OBJ_obj2nid(*v22); v39 = OBJ_nid2sn(v38); cipherbyname = (unsigned int *)EVP_get_cipherbyname((__int64)v39); if ( !cipherbyname ) { v9 = 111; v10 = 420; goto LABEL_7; } if ( a3 || v21 ) { v15 = 0; goto LABEL_29; } LABEL_75: v9 = 122; v10 = 431; goto LABEL_7; } if ( v8 == 24 ) { v17 = *(_QWORD **)(a1 + 32); v18 = v17[5]; v19 = v17[6]; v20 = v17[1]; v21 = *(_QWORD *)(v18 + 16); v22 = *(__int64 **)(v18 + 8); v23 = OBJ_obj2nid(*v22); v24 = OBJ_nid2sn(v23); cipherbyname = (unsigned int *)EVP_get_cipherbyname((__int64)v24); if ( !cipherbyname ) { v9 = 111; v10 = 408; goto LABEL_7; } v26 = v21 == 0; LABEL_11: if ( !v26 || a3 ) { v15 = v20; if ( v20 ) { v15 = 0; v27 = 0; v28 = (int)OPENSSL_sk_num(v20) > 0; v29 = 0; v30 = v20; if ( v28 ) { while ( 1 ) { v31 = (__int64 *)OPENSSL_sk_value(v30, v29); v32 = BIO_f_md(); v14 = BIO_new(v32); if ( !v14 ) { v13 = 0; v11 = 0; ERR_put_error(33, 112, 32, (__int64)"crypto/pkcs7/pk7_doit.c", 440); v12 = nullptr; goto LABEL_8; } v33 = OBJ_obj2nid(*v31); v34 = OBJ_nid2sn(v33); digestbyname = EVP_get_digestbyname((__int64)v34); if ( !digestbyname ) break; BIO_ctrl(v14, 0x6Fu, 0, digestbyname); if ( v15 ) { ++v27; BIO_push(v15, v14); } else { v15 = v14; ++v27; } v28 = v27 < (int)OPENSSL_sk_num(v20); v29 = (unsigned int)v27; v30 = v20; if ( !v28 ) goto LABEL_21; } v11 = 0; v12 = nullptr; ERR_put_error(33, 112, 109, (__int64)"crypto/pkcs7/pk7_doit.c", 448); v13 = 0; goto LABEL_8; } } LABEL_21: v11 = 0; if ( !cipherbyname ) goto LABEL_22; LABEL_29: v40 = BIO_f_cipher(); v13 = BIO_new(v40); if ( !v13 ) { v14 = 0; v11 = 0; ERR_put_error(33, 112, 32, (__int64)"crypto/pkcs7/pk7_doit.c", 463); v12 = nullptr; goto LABEL_8; } v41 = 0; if ( a4 ) { while ( 1 ) { v28 = v41 < (int)OPENSSL_sk_num(v19); v42 = (unsigned int)v41++; if ( !v28 ) { v11 = 0; ERR_put_error(33, 112, 115, (__int64)"crypto/pkcs7/pk7_doit.c", 486); v12 = nullptr; v14 = 0; goto LABEL_8; } v43 = OPENSSL_sk_value(v19, v42); v44 = **(_QWORD **)(v43 + 8); issuer_name = X509_get_issuer_name(a4); if ( !(unsigned int)X509_NAME_cmp(v44, issuer_name) ) { serialNumber = X509_get_serialNumber(a4); if ( !(unsigned int)ASN1_INTEGER_cmp(serialNumber, *(_QWORD *)(*(_QWORD *)(v43 + 8) + 8LL)) ) break; } } if ( (sub_104A4A8(&v56, &v54, v43, a2) & 0x80000000) != 0 ) goto LABEL_72; ERR_clear_error(); } else { while ( 1 ) { v28 = (int)a4 < (int)OPENSSL_sk_num(v19); v50 = (unsigned int)a4; LODWORD(a4) = a4 + 1; if ( !v28 ) break; v51 = OPENSSL_sk_value(v19, v50); if ( (sub_104A4A8(&v56, &v54, v51, a2) & 0x80000000) != 0 ) goto LABEL_72; ERR_clear_error(); } } v55 = nullptr; BIO_ctrl(v13, 0x81u, 0, (__int64)&v55); if ( (int)EVP_CipherInit_ex((__int64)v55, cipherbyname, 0, 0, nullptr, 0) > 0 && (EVP_CIPHER_asn1_to_param((__int64)v55, v22[1]) & 0x80000000) == 0 ) { v11 = (int)EVP_CIPHER_CTX_key_length((__int64)v55); v12 = CRYPTO_malloc((void *)v11, (__int64)"crypto/pkcs7/pk7_doit.c", 519); if ( !v12 ) goto LABEL_66; if ( (int)EVP_CIPHER_CTX_rand_key(v55, (__int64)v12) <= 0 ) goto LABEL_83; if ( !v56 ) { v56 = v12; v12 = nullptr; v54 = v11; } v47 = EVP_CIPHER_CTX_key_length((__int64)v55); if ( v47 != v54 && !(unsigned int)EVP_CIPHER_CTX_set_key_length(v55, v54) ) { CRYPTO_clear_free(v56, v54, (__int64)"crypto/pkcs7/pk7_doit.c", 0x21Au); v56 = v12; v54 = v11; v12 = nullptr; } ERR_clear_error(); if ( (int)EVP_CipherInit_ex((__int64)v55, nullptr, 0, (__int64)v56, nullptr, 0) <= 0 ) { LABEL_83: v14 = 0; goto LABEL_8; } CRYPTO_clear_free(v56, v54, (__int64)"crypto/pkcs7/pk7_doit.c", 0x225u); v56 = nullptr; CRYPTO_clear_free(v12, v11, (__int64)"crypto/pkcs7/pk7_doit.c", 0x227u); if ( v15 ) BIO_push(v15, v13); else v15 = v13; LABEL_22: if ( a3 ) { LABEL_23: BIO_push(v15, a3); return v15; } if ( *(int *)v21 <= 0 ) { v52 = BIO_s_mem(); v53 = BIO_new((__int64)v52); a3 = v53; if ( v53 ) { BIO_ctrl(v53, 0x82u, 0, 0); goto LABEL_23; } } else { a3 = BIO_new_mem_buf(*(const char **)(v21 + 8), *(_DWORD *)v21); if ( a3 ) goto LABEL_23; } v12 = (_BYTE *)a3; v13 = a3; LABEL_66: v14 = (__int64)v12; goto LABEL_8; } LABEL_72: v11 = 0; v12 = nullptr; v14 = 0; goto LABEL_8; } goto LABEL_75; } if ( v8 != 22 ) { v9 = 112; v10 = 425; LABEL_7: v11 = 0; ERR_put_error(33, 112, v9, (__int64)"crypto/pkcs7/pk7_doit.c", v10); v12 = nullptr; v13 = 0; v14 = 0; v15 = 0; LABEL_8: CRYPTO_clear_free(v56, v54, (__int64)"crypto/pkcs7/pk7_doit.c", 0x243u); CRYPTO_clear_free(v12, v11, (__int64)"crypto/pkcs7/pk7_doit.c", 0x244u); BIO_free_all(v15); BIO_free_all(v14); BIO_free_all(v13); BIO_free_all(0); return 0; } v48 = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 40LL); if ( (unsigned int)OBJ_obj2nid(*(_QWORD *)(v48 + 24)) == 21 ) { v21 = *(_QWORD *)(v48 + 32); } else { if ( (unsigned int)OBJ_obj2nid(*(_QWORD *)(v48 + 24)) - 21 <= 5 ) { v21 = 0; if ( (unsigned int)OBJ_obj2nid(*(_QWORD *)(a1 + 24)) != 22 ) { LABEL_52: v9 = 155; v10 = 394; goto LABEL_7; } LABEL_73: if ( PKCS7_ctrl(a1, 2, 0, 0) ) { v26 = v21 == 0; LABEL_57: v19 = 0; v22 = nullptr; cipherbyname = nullptr; v20 = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 8LL); goto LABEL_11; } LABEL_55: if ( !v21 ) goto LABEL_52; v26 = 0; goto LABEL_57; } v49 = *(_QWORD *)(v48 + 32); if ( !v49 || *(_DWORD *)v49 != 4 ) { if ( (unsigned int)OBJ_obj2nid(*(_QWORD *)(a1 + 24)) != 22 || !PKCS7_ctrl(a1, 2, 0, 0) ) goto LABEL_52; v26 = 1; v21 = 0; goto LABEL_57; } v21 = *(_QWORD *)(v49 + 8); } if ( (unsigned int)OBJ_obj2nid(*(_QWORD *)(a1 + 24)) != 22 ) goto LABEL_55; goto LABEL_73; } ERR_put_error(33, 112, 122, (__int64)"crypto/pkcs7/pk7_doit.c", 376); return 0; } else { ERR_put_error(33, 112, 143, (__int64)"crypto/pkcs7/pk7_doit.c", 371); return 0; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source