// // CRYPTO_secure_malloc from 0x1034718 to 0x1034d48 (1584 bytes) // // 6 xrefs: // > BUF_MEM_grow @ 0xffdd4c // > BUF_MEM_grow_clean @ 0xffdea8 // > sub_1019F3C @ 0x1019f7c // > sub_101A074 @ 0x101a158 // > CRYPTO_secure_zalloc @ 0x1034d58 // > @ 0x4ed90 // // 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:23 +0000 // unsigned __int64 *__fastcall CRYPTO_secure_malloc(void *a1, __int64 a2, __int64 a3) { unsigned __int64 v4; // x1 __int64 v5; // x2 __int64 i; // x25 __int64 v7; // x28 __int64 v8; // x20 unsigned __int64 *v9; // x19 unsigned __int64 v10; // x2 int v12; // w26 __int64 v13; // x6 unsigned __int64 v14; // x2 __int64 j; // x21 unsigned __int64 v16; // x0 __int64 v17; // x1 __int64 v18; // x27 unsigned __int64 v19; // x0 unsigned __int64 v20; // x1 unsigned __int64 v21; // x0 unsigned __int64 v22; // x3 __int64 v23; // x9 unsigned __int64 v24; // x1 unsigned __int64 v25; // x27 unsigned __int64 v26; // x2 unsigned __int64 v27; // x0 int v28; // w1 unsigned __int64 v29; // x0 unsigned __int64 v30; // x0 unsigned __int64 v31; // x1 unsigned __int64 v32; // x0 if ( dword_1567F58 ) { CRYPTO_THREAD_write_lock(qword_1567F60); v4 = qword_1567F38; v5 = qword_1567F30; for ( i = qword_1567F30 - 1; (unsigned __int64)a1 > v4; --i ) v4 *= 2LL; if ( i < 0 ) { v9 = nullptr; goto LABEL_8; } v7 = i; v8 = 8 * i; while ( 1 ) { v9 = *(unsigned __int64 **)(qword_1567F28 + v8); if ( v9 ) break; --v7; v8 -= 8; if ( v7 == -1 ) goto LABEL_8; } if ( i == v7 ) { v23 = qword_1567F40; v9 = *(unsigned __int64 **)(qword_1567F28 + 8 * i); v28 = i; if ( (i & 0x80000000) != 0 ) goto LABEL_70; } else { v12 = v7; v13 = qword_1567F48; if ( (v7 & 0x80000000) != 0 || qword_1567F30 <= (int)v7 ) goto LABEL_70; if ( ((((unsigned __int64)qword_1567F20 >> v7) - 1) & ((unsigned __int64)v9 - qword_1567F18)) != 0 ) goto LABEL_73; v14 = ((unsigned __int64)v9 - qword_1567F18) / ((unsigned __int64)qword_1567F20 >> v7); for ( j = 8 * (v7 + 1); ; j += 8 ) { v26 = (1LL << v12) + v14; if ( !v26 || v26 >= qword_1567F50 ) goto LABEL_71; if ( (*(unsigned __int8 *)(v13 + (v26 >> 3)) & (unsigned int)(1LL << (v26 & 7))) != 0 ) OPENSSL_die("assertion failed: !sh_testbit(temp, slist, sh.bitmalloc)", "crypto/mem_sec.c", 496); sub_1034120((__int64)v9, v12, qword_1567F40); v27 = *v9; if ( *v9 ) *(_QWORD *)(v27 + 8) = v9[1]; *(_QWORD *)v9[1] = v27; if ( *v9 ) { v16 = *(_QWORD *)(*v9 + 8); v17 = qword_1567F28; if ( (v16 < qword_1567F28 || v16 >= qword_1567F28 + 8 * qword_1567F30) && (v16 < qword_1567F18 || v16 >= qword_1567F18 + qword_1567F20) ) { goto LABEL_74; } } else { v17 = qword_1567F28; } if ( v9 == *(unsigned __int64 **)(v17 + v8) ) OPENSSL_die("assertion failed: temp != sh.freelist[slist]", "crypto/mem_sec.c", 499); v12 = ++v7; if ( (v7 & 0x80000000) != 0 || (int)v7 >= qword_1567F30 ) goto LABEL_70; if ( ((((unsigned __int64)qword_1567F20 >> v7) - 1) & ((unsigned __int64)v9 - qword_1567F18)) != 0 ) goto LABEL_73; v18 = 1LL << v7; v19 = ((unsigned __int64)v9 - qword_1567F18) / ((unsigned __int64)qword_1567F20 >> v7) + (1LL << v7); if ( !v19 || v19 >= qword_1567F50 ) goto LABEL_71; if ( (*(unsigned __int8 *)(qword_1567F48 + (v19 >> 3)) & (unsigned int)(1LL << (v19 & 7))) != 0 ) OPENSSL_die("assertion failed: !sh_testbit(temp, slist, sh.bitmalloc)", "crypto/mem_sec.c", 505); sub_1033F44((__int64)v9, v7, qword_1567F40); sub_103402C((unsigned __int64 *)(qword_1567F28 + j), v9); if ( v9 != *(unsigned __int64 **)(qword_1567F28 + j) ) OPENSSL_die("assertion failed: sh.freelist[slist] == temp", "crypto/mem_sec.c", 508); v20 = (unsigned __int64)qword_1567F20 >> v7; v9 = (unsigned __int64 *)((char *)v9 + ((unsigned __int64)qword_1567F20 >> v7)); if ( (int)v7 >= qword_1567F30 ) goto LABEL_70; if ( (((unsigned __int64)v9 - qword_1567F18) & (v20 - 1)) != 0 ) goto LABEL_73; v21 = ((unsigned __int64)v9 - qword_1567F18) / v20 + v18; if ( !v21 || v21 >= qword_1567F50 ) goto LABEL_71; if ( (*(unsigned __int8 *)(qword_1567F48 + (v21 >> 3)) & (unsigned int)(1LL << (v21 & 7))) != 0 ) OPENSSL_die("assertion failed: !sh_testbit(temp, slist, sh.bitmalloc)", "crypto/mem_sec.c", 512); sub_1033F44((__int64)v9, v7, qword_1567F40); sub_103402C((unsigned __int64 *)(qword_1567F28 + j), v9); if ( v9 != *(unsigned __int64 **)(qword_1567F28 + j) ) OPENSSL_die("assertion failed: sh.freelist[slist] == temp", "crypto/mem_sec.c", 515); v22 = (unsigned __int64)qword_1567F20 >> v7; v23 = qword_1567F40; v14 = ((unsigned __int64)v9 - qword_1567F18) / ((unsigned __int64)qword_1567F20 >> v7); v24 = (v14 + v18) ^ 1; if ( ((*(unsigned __int8 *)(qword_1567F40 + (v24 >> 3)) >> (v24 & 7)) & 1) != 0 ) { if ( ((*(unsigned __int8 *)(qword_1567F48 + (v24 >> 3)) >> (v24 & 7)) & 1) != 0 ) v25 = 0; else v25 = qword_1567F18 + (v24 & (v18 - 1)) * v22; } else { v25 = (*(unsigned __int8 *)(qword_1567F40 + (v24 >> 3)) >> (v24 & 7)) & 1LL; } if ( (unsigned __int64 *)((char *)v9 - ((unsigned __int64)qword_1567F20 >> v7)) != (unsigned __int64 *)v25 ) OPENSSL_die( "assertion failed: temp-(sh.arena_size >> slist) == sh_find_my_buddy(temp, slist)", "crypto/mem_sec.c", 517); if ( i == v7 ) break; v13 = qword_1567F48; if ( qword_1567F30 <= (int)v7 ) goto LABEL_70; v8 = j; if ( ((v22 - 1) & ((unsigned __int64)v9 - qword_1567F18)) != 0 ) goto LABEL_73; } v5 = qword_1567F30; v9 = *(unsigned __int64 **)(qword_1567F28 + 8 * i); v28 = i; } if ( v5 > v28 ) { if ( (((unsigned __int64)v9 - qword_1567F18) & (((unsigned __int64)qword_1567F20 >> v28) - 1)) == 0 ) { v29 = ((unsigned __int64)v9 - qword_1567F18) / ((unsigned __int64)qword_1567F20 >> v28) + (1LL << v28); if ( !v29 || v29 >= qword_1567F50 ) LABEL_71: OPENSSL_die("assertion failed: bit > 0 && bit < sh.bittable_size", "crypto/mem_sec.c", 273); if ( (*(unsigned __int8 *)(v23 + (v29 >> 3)) & (unsigned int)(1LL << (v29 & 7))) == 0 ) OPENSSL_die("assertion failed: sh_testbit(chunk, list, sh.bittable)", "crypto/mem_sec.c", 522); sub_1033F44((__int64)v9, v28, qword_1567F48); v30 = *v9; if ( *v9 ) *(_QWORD *)(v30 + 8) = v9[1]; *(_QWORD *)v9[1] = v30; if ( *v9 && ((v31 = *(_QWORD *)(*v9 + 8), v31 < qword_1567F28) || v31 >= qword_1567F28 + 8 * qword_1567F30) ) { v32 = qword_1567F18; if ( v31 < qword_1567F18 || v31 >= qword_1567F18 + qword_1567F20 ) LABEL_74: sub_632B9C(); } else { v32 = qword_1567F18; } if ( (unsigned __int64)v9 < v32 || (unsigned __int64)v9 >= v32 + qword_1567F20 ) OPENSSL_die("assertion failed: WITHIN_ARENA(chunk)", "crypto/mem_sec.c", 526); if ( v9 ) { v10 = sub_1034208((unsigned __int64)v9); goto LABEL_9; } LABEL_8: v10 = (unsigned __int64)v9; LABEL_9: qword_1567F68 += v10; CRYPTO_THREAD_unlock(qword_1567F60); return v9; } LABEL_73: sub_632B7C(); } LABEL_70: OPENSSL_die("assertion failed: list >= 0 && list < sh.freelist_size", "crypto/mem_sec.c", 270); } return (unsigned __int64 *)CRYPTO_malloc(a1, a2, a3); }
GD Web Decomp Icon

GD Web Decomp

Raw Source