// // PKCS7_dataDecode from 0xa3bfac to 0xa3c784 (2008 bytes) // // 1 xrefs: // > @ 0x7f85c // // 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:08:11 +0000 // int __fastcall PKCS7_dataDecode(_DWORD *a1, int a2, _DWORD *a3, int a4) { char *v7; // r0 void *v8; // r7 _BYTE *v9; // r8 _DWORD *v10; // r4 _DWORD *v11; // r6 int v12; // r5 _DWORD *v14; // r3 int v15; // r2 int v16; // r10 char *v17; // r7 char *v18; // r0 char *v19; // r0 char *cipherbyname; // r0 int v21; // r1 bool v22; // r5 int i; // r4 int *v24; // r8 int v25; // r0 char *v26; // r0 char *v27; // r0 int digestbyname; // r12 int v29; // r0 bool v30; // cc int v31; // r2 int v32; // r3 char *v33; // r0 char *v34; // r0 bool v35; // zf int v36; // r0 int v37; // r6 int v38; // r0 int v39; // r1 int v40; // r8 int v41; // r7 int issuer_name; // r0 int serialNumber; // r0 int v44; // r0 int v45; // r5 int v46; // r5 _DWORD *v47; // r3 int v48; // r0 int v49; // r1 int v50; // r0 void *v51; // r0 _DWORD *v52; // r0 int v53; // [sp+8h] [bp-24h] int *v55; // [sp+10h] [bp-1Ch] int *v56; // [sp+14h] [bp-18h] int v57; // [sp+1Ch] [bp-10h] BYREF int v58; // [sp+20h] [bp-Ch] BYREF void *v59; // [sp+24h] [bp-8h] BYREF v57 = 0; v58 = 0; v59 = nullptr; if ( a1 ) { if ( a1[5] ) { v7 = OBJ_obj2nid(a1[4]); a1[2] = 0; if ( v7 == (_BYTE *)&dword_14 + 3 ) { v31 = a1[5]; v32 = *(_DWORD *)(v31 + 8); v16 = *(_DWORD *)(v31 + 4); v53 = *(_DWORD *)(v32 + 8); v56 = *(int **)(v32 + 4); v33 = OBJ_obj2nid(*v56); v34 = OBJ_nid2sn((unsigned int)v33); cipherbyname = (char *)EVP_get_cipherbyname((int)v34); v55 = (int *)cipherbyname; if ( !cipherbyname ) { v8 = nullptr; ERR_put_error(33, 112, 111, (int)"crypto/pkcs7/pk7_doit.c", 420); goto LABEL_7; } v35 = a3 == nullptr; if ( !a3 ) v35 = v53 == 0; v12 = v35; if ( !v35 ) goto LABEL_37; goto LABEL_84; } if ( v7 == (char *)&dword_18 ) { v14 = (_DWORD *)a1[5]; v15 = v14[5]; v16 = v14[6]; v17 = (char *)v14[1]; v56 = *(int **)(v15 + 4); v53 = *(_DWORD *)(v15 + 8); v18 = OBJ_obj2nid(*v56); v19 = OBJ_nid2sn((unsigned int)v18); cipherbyname = (char *)EVP_get_cipherbyname((int)v19); v55 = (int *)cipherbyname; if ( !cipherbyname ) { v8 = nullptr; ERR_put_error(33, 112, 111, (int)"crypto/pkcs7/pk7_doit.c", 408); goto LABEL_7; } v22 = v53 == 0; LABEL_11: if ( a3 ) v12 = 0; else v12 = v22; if ( !v12 ) { if ( v17 ) { for ( i = 0; ; ++i ) { v29 = OPENSSL_sk_num(v17); v21 = i; v30 = i < v29; cipherbyname = v17; if ( !v30 ) break; v24 = (int *)OPENSSL_sk_value(v17, i); v25 = BIO_f_md(); v11 = BIO_new(v25); if ( !v11 ) { ERR_put_error(33, 112, 32, (int)"crypto/pkcs7/pk7_doit.c", 440); v10 = nullptr; v8 = nullptr; v9 = nullptr; goto LABEL_8; } v26 = OBJ_obj2nid(*v24); v27 = OBJ_nid2sn((unsigned int)v26); digestbyname = EVP_get_digestbyname((int)v27); if ( !digestbyname ) { v8 = nullptr; ERR_put_error(33, 112, 109, (int)"crypto/pkcs7/pk7_doit.c", 448); v9 = nullptr; v10 = nullptr; goto LABEL_8; } BIO_ctrl(v11, 111, 0, digestbyname); if ( v12 ) BIO_push((_DWORD *)v12, (int)v11); else v12 = (int)v11; } } else { v12 = 0; } if ( !v55 ) { v8 = nullptr; goto LABEL_28; } LABEL_37: v36 = BIO_f_cipher(cipherbyname, v21); v10 = BIO_new(v36); if ( !v10 ) { ERR_put_error(33, 112, 32, (int)"crypto/pkcs7/pk7_doit.c", 463); v11 = nullptr; v8 = nullptr; v9 = nullptr; goto LABEL_8; } if ( a4 ) { v37 = 0; while ( 1 ) { v38 = OPENSSL_sk_num(v16); v39 = v37; if ( v37 >= v38 ) { v8 = nullptr; ERR_put_error(33, 112, 115, (int)"crypto/pkcs7/pk7_doit.c", 486); v9 = nullptr; v11 = nullptr; goto LABEL_8; } ++v37; v40 = OPENSSL_sk_value(v16, v39); v41 = **(_DWORD **)(v40 + 4); issuer_name = X509_get_issuer_name(a4); if ( !X509_NAME_cmp(v41, issuer_name) ) { serialNumber = X509_get_serialNumber(a4); if ( !ASN1_INTEGER_cmp(serialNumber, *(_DWORD *)(*(_DWORD *)(v40 + 4) + 4)) ) break; } } v8 = nullptr; if ( sub_A3B4D4((_BYTE **)&v58, (unsigned int *)&v59, v40, a2) < 0 ) { v9 = nullptr; v11 = nullptr; goto LABEL_8; } ERR_clear_error(); } else { while ( 1 ) { v48 = OPENSSL_sk_num(v16); v49 = a4; v30 = a4++ < v48; if ( !v30 ) break; v50 = OPENSSL_sk_value(v16, v49); if ( sub_A3B4D4((_BYTE **)&v58, (unsigned int *)&v59, v50, a2) < 0 ) { v8 = nullptr; v9 = nullptr; v11 = nullptr; goto LABEL_8; } ERR_clear_error(); } } v11 = nullptr; v57 = 0; BIO_ctrl(v10, 129, 0, (int)&v57); if ( EVP_CipherInit_ex((int *)v57, v55, nullptr, 0, nullptr, 0) <= 0 || EVP_CIPHER_asn1_to_param(v57, v56[1]) < 0 ) { v8 = nullptr; v9 = nullptr; goto LABEL_8; } v8 = (void *)EVP_CIPHER_CTX_key_length(v57); v9 = CRYPTO_malloc(v8, (int)"crypto/pkcs7/pk7_doit.c", 519); if ( !v9 ) goto LABEL_78; if ( EVP_CIPHER_CTX_rand_key((_DWORD *)v57, (int)v9) <= 0 ) goto LABEL_8; if ( !v58 ) { v58 = (int)v9; v59 = v8; v9 = nullptr; } v44 = EVP_CIPHER_CTX_key_length(v57); if ( (void *)v44 != v59 && !EVP_CIPHER_CTX_set_key_length((_DWORD *)v57, (int)v59) ) { CRYPTO_clear_free((_BYTE *)v58, (unsigned int)v59, (int)"crypto/pkcs7/pk7_doit.c", 538); v58 = (int)v9; v59 = v8; v9 = nullptr; } v11 = nullptr; ERR_clear_error(); if ( EVP_CipherInit_ex((int *)v57, nullptr, nullptr, v58, nullptr, 0) <= 0 ) goto LABEL_8; CRYPTO_clear_free((_BYTE *)v58, (unsigned int)v59, (int)"crypto/pkcs7/pk7_doit.c", 549); v58 = 0; CRYPTO_clear_free(v9, (unsigned int)v8, (int)"crypto/pkcs7/pk7_doit.c", 551); if ( v12 ) BIO_push((_DWORD *)v12, (int)v10); else v12 = (int)v10; LABEL_28: if ( a3 ) { LABEL_29: BIO_push((_DWORD *)v12, (int)a3); return v12; } if ( *(int *)v53 <= 0 ) { v51 = BIO_s_mem(); v52 = BIO_new((int)v51); a3 = v52; if ( v52 ) { BIO_ctrl(v52, 130, 0, 0); goto LABEL_29; } } else { a3 = BIO_new_mem_buf(*(const char **)(v53 + 8), *(_DWORD *)v53); if ( a3 ) goto LABEL_29; } v9 = a3; v10 = a3; LABEL_78: v11 = v9; goto LABEL_8; } LABEL_84: v8 = nullptr; ERR_put_error(33, 112, 122, (int)"crypto/pkcs7/pk7_doit.c", 431); goto LABEL_7; } if ( v7 != (_BYTE *)&dword_14 + 2 ) { v8 = nullptr; ERR_put_error(33, 112, 112, (int)"crypto/pkcs7/pk7_doit.c", 425); LABEL_7: v9 = nullptr; v10 = nullptr; v11 = nullptr; v12 = 0; LABEL_8: CRYPTO_clear_free((_BYTE *)v58, (unsigned int)v59, (int)"crypto/pkcs7/pk7_doit.c", 579); CRYPTO_clear_free(v9, (unsigned int)v8, (int)"crypto/pkcs7/pk7_doit.c", 580); BIO_free_all(v12); BIO_free_all((int)v11); BIO_free_all((int)v10); BIO_free_all(0); return 0; } v45 = *(_DWORD *)(a1[5] + 20); if ( OBJ_obj2nid(*(_DWORD *)(v45 + 16)) == (_BYTE *)&dword_14 + 1 ) { v46 = *(_DWORD *)(v45 + 20); } else { if ( (unsigned int)(OBJ_obj2nid(*(_DWORD *)(v45 + 16)) - 21) <= 5 ) { if ( OBJ_obj2nid(a1[4]) != (_BYTE *)&dword_14 + 2 ) goto LABEL_64; v53 = 0; goto LABEL_85; } v47 = *(_DWORD **)(v45 + 20); if ( !v47 || *v47 != 4 ) { if ( OBJ_obj2nid(a1[4]) == (_BYTE *)&dword_14 + 2 ) { cipherbyname = (char *)PKCS7_ctrl(a1, 2, 0, 0); if ( cipherbyname ) { v22 = 1; v53 = 0; goto LABEL_69; } } goto LABEL_64; } v46 = v47[1]; } cipherbyname = OBJ_obj2nid(a1[4]); v53 = v46; if ( cipherbyname != (_BYTE *)&dword_14 + 2 ) { LABEL_67: if ( v53 ) { v22 = 0; LABEL_69: v16 = 0; v17 = *(char **)(a1[5] + 4); v56 = nullptr; v55 = nullptr; goto LABEL_11; } LABEL_64: v8 = nullptr; ERR_put_error(33, 112, 155, (int)"crypto/pkcs7/pk7_doit.c", 394); goto LABEL_7; } LABEL_85: cipherbyname = (char *)PKCS7_ctrl(a1, 2, 0, 0); if ( cipherbyname ) { v22 = v53 == 0; goto LABEL_69; } goto LABEL_67; } ERR_put_error(33, 112, 122, (int)"crypto/pkcs7/pk7_doit.c", 376); return 0; } else { ERR_put_error(33, 112, 143, (int)"crypto/pkcs7/pk7_doit.c", 371); return 0; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source