// // PKCS12_key_gen_uni from 0x1047ce4 to 0x1048208 (1316 bytes) // // 3 xrefs: // > PKCS12_key_gen_asc @ 0x1048274 // > PKCS12_key_gen_utf8 @ 0x1048374 // > @ 0x50608 // // 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:34 +0000 // __int64 __fastcall PKCS12_key_gen_uni( __int64 a1, int a2, __int64 a3, int a4, unsigned __int8 a5, int a6, int a7, char *a8, __int64 a9) { __int64 *v17; // x21 int v18; // w22 int v19; // w0 __int64 v20; // x20 _QWORD *v21; // x25 void *v22; // x23 char *v23; // x24 void *v24; // x27 _BYTE *v25; // x26 unsigned int v26; // w22 int v28; // s15 int v29; // w3 __int64 v30; // x0 __int64 v31; // x0 char *v32; // x0 __int64 i; // x1 int v34; // w28 int v35; // w2 __int64 v36; // x0 char *v37; // x28 int v38; // s8 int v39; // w0 bool v40; // nf int v41; // w1 int v42; // w0 int v43; // w3 int v44; // [xsp+A8h] [xbp+A8h] int v45; // [xsp+A8h] [xbp+A8h] int v46; // [xsp+C8h] [xbp+C8h] int v47; // [xsp+CCh] [xbp+CCh] v17 = (__int64 *)EVP_MD_CTX_new(); if ( v17 && (v18 = EVP_MD_block_size(a9), v19 = EVP_MD_size(a9), v47 = v19, v18 > 0) && v19 >= 0 ) { v28 = (unsigned int)v19 >> 31; v24 = CRYPTO_malloc((void *)v18, (__int64)"crypto/pkcs12/p12_key.c", 107); v22 = CRYPTO_malloc((void *)v47, (__int64)"crypto/pkcs12/p12_key.c", 108); v25 = CRYPTO_malloc((void *)(v18 + 1), (__int64)"crypto/pkcs12/p12_key.c", 109); v29 = (a4 + v18 - 1) / v18 * v18; if ( a2 ) v28 = (a2 + v18 - 1) / v18 * v18; v44 = (a4 + v18 - 1) / v18 * v18; v46 = v29 + v28; v23 = (char *)CRYPTO_malloc((void *)(v29 + v28), (__int64)"crypto/pkcs12/p12_key.c", 116); v21 = (_QWORD *)BN_new(); v30 = BN_new(); v20 = v30; if ( v24 && v22 && v25 && v23 && v21 && v30 ) { memset(v24, a5, (unsigned int)(v18 - 1) + 1LL); if ( v44 <= 0 ) { v32 = v23; } else { v31 = 0; do { v23[v31] = *(_BYTE *)(a3 + (int)v31 % a4); ++v31; } while ( v44 > (int)v31 ); v32 = &v23[v44 - 1 + 1]; } for ( i = 0; v28 > (int)i; ++i ) v32[i] = *(_BYTE *)(a1 + (int)i % a2); while ( (unsigned int)EVP_DigestInit_ex(v17, a9, 0) && (unsigned int)EVP_DigestUpdate((__int64)v17) && (unsigned int)EVP_DigestUpdate((__int64)v17) && (unsigned int)EVP_DigestFinal_ex((int **)v17, (__int64)v22, nullptr) ) { v34 = 1; if ( a6 > 1 ) { do { ++v34; if ( !(unsigned int)EVP_DigestInit_ex(v17, a9, 0) || !(unsigned int)EVP_DigestUpdate((__int64)v17) || !(unsigned int)EVP_DigestFinal_ex((int **)v17, (__int64)v22, nullptr) ) { goto LABEL_5; } } while ( v34 != a6 ); } v35 = v47; if ( a7 <= v47 ) v35 = a7; memcpy(a8, v22, v35); if ( a7 <= v47 ) { v26 = 1; goto LABEL_6; } v36 = 0; do { v25[v36] = *((_BYTE *)v22 + (int)v36 % v47); ++v36; } while ( v18 > (int)v36 ); if ( !BN_bin2bn(v25, v18, v20) || !(unsigned int)BN_add_word(v20, 1u) ) break; v37 = v23; v38 = v18; if ( v46 > 0 ) { while ( BN_bin2bn(v37, v18, (__int64)v21) && (unsigned int)BN_add(v21, v21, v20) && (unsigned int)BN_bn2bin(v21, v25) ) { v39 = BN_num_bits((__int64)v21); v41 = v39 + 7; v40 = v39 + 7 < 0; v42 = v39 + 14; if ( !v40 ) v42 = v41; v43 = v42 >> 3; if ( v18 < v42 >> 3 ) { if ( !(unsigned int)BN_bn2bin(v21, v25) ) goto LABEL_5; memcpy(v37, v25 + 1, v18); } else if ( v18 > v43 ) { v45 = v42 >> 3; memset(v37, 0, v18 - v43); if ( !(unsigned int)BN_bn2bin(v21, &v37[v18 - v45]) ) goto LABEL_5; } else if ( !(unsigned int)BN_bn2bin(v21, v37) ) { goto LABEL_5; } v37 += v18; v38 += v18; if ( v46 <= v38 - v18 ) goto LABEL_53; } break; } LABEL_53: a7 -= v47; a8 += v47; } } } else { v20 = 0; v21 = nullptr; v22 = nullptr; v23 = nullptr; v24 = nullptr; v25 = nullptr; } LABEL_5: v26 = 0; ERR_put_error(35, 111, 65, (__int64)"crypto/pkcs12/p12_key.c", 185); LABEL_6: CRYPTO_free(v22, (__int64)"crypto/pkcs12/p12_key.c", 188); CRYPTO_free(v25, (__int64)"crypto/pkcs12/p12_key.c", 189); CRYPTO_free(v24, (__int64)"crypto/pkcs12/p12_key.c", 190); CRYPTO_free(v23, (__int64)"crypto/pkcs12/p12_key.c", 191); BN_free((__int64)v21); BN_free(v20); EVP_MD_CTX_free(v17); return v26; }
GD Web Decomp Icon

GD Web Decomp

Raw Source