// // CRYPTO_secure_malloc from 0xdb63b8 to 0xdb69e8 (1584 bytes) // // 6 xrefs: // > BUF_MEM_grow @ 0xd7f9ec // > BUF_MEM_grow_clean @ 0xd7fb48 // > sub_D9BBDC @ 0xd9bc1c // > sub_D9BD14 @ 0xd9bdf8 // > CRYPTO_secure_zalloc @ 0xdb69f8 // > @ 0x35c28 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // 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_125F158 ) { CRYPTO_THREAD_write_lock(qword_125F160); v4 = qword_125F138; v5 = qword_125F130; for ( i = qword_125F130 - 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_125F128 + v8); if ( v9 ) break; --v7; v8 -= 8; if ( v7 == -1 ) goto LABEL_8; } if ( i == v7 ) { v23 = qword_125F140; v9 = *(unsigned __int64 **)(qword_125F128 + 8 * i); v28 = i; if ( (i & 0x80000000) != 0 ) goto LABEL_70; } else { v12 = v7; v13 = qword_125F148; if ( (v7 & 0x80000000) != 0 || qword_125F130 <= (int)v7 ) goto LABEL_70; if ( ((((unsigned __int64)qword_125F120 >> v7) - 1) & ((unsigned __int64)v9 - qword_125F118)) != 0 ) goto LABEL_73; v14 = ((unsigned __int64)v9 - qword_125F118) / ((unsigned __int64)qword_125F120 >> v7); for ( j = 8 * (v7 + 1); ; j += 8 ) { v26 = (1LL << v12) + v14; if ( !v26 || v26 >= qword_125F150 ) 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_DB5DC0((__int64)v9, v12, qword_125F140); v27 = *v9; if ( *v9 ) *(_QWORD *)(v27 + 8) = v9[1]; *(_QWORD *)v9[1] = v27; if ( *v9 ) { v16 = *(_QWORD *)(*v9 + 8); v17 = qword_125F128; if ( (v16 < qword_125F128 || v16 >= qword_125F128 + 8 * qword_125F130) && (v16 < qword_125F118 || v16 >= qword_125F118 + qword_125F120) ) { goto LABEL_74; } } else { v17 = qword_125F128; } 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_125F130 ) goto LABEL_70; if ( ((((unsigned __int64)qword_125F120 >> v7) - 1) & ((unsigned __int64)v9 - qword_125F118)) != 0 ) goto LABEL_73; v18 = 1LL << v7; v19 = ((unsigned __int64)v9 - qword_125F118) / ((unsigned __int64)qword_125F120 >> v7) + (1LL << v7); if ( !v19 || v19 >= qword_125F150 ) goto LABEL_71; if ( (*(unsigned __int8 *)(qword_125F148 + (v19 >> 3)) & (unsigned int)(1LL << (v19 & 7))) != 0 ) OPENSSL_die("assertion failed: !sh_testbit(temp, slist, sh.bitmalloc)", "crypto/mem_sec.c", 505); sub_DB5BE4((__int64)v9, v7, qword_125F140); sub_DB5CCC((unsigned __int64 *)(qword_125F128 + j), v9); if ( v9 != *(unsigned __int64 **)(qword_125F128 + j) ) OPENSSL_die("assertion failed: sh.freelist[slist] == temp", "crypto/mem_sec.c", 508); v20 = (unsigned __int64)qword_125F120 >> v7; v9 = (unsigned __int64 *)((char *)v9 + ((unsigned __int64)qword_125F120 >> v7)); if ( (int)v7 >= qword_125F130 ) goto LABEL_70; if ( (((unsigned __int64)v9 - qword_125F118) & (v20 - 1)) != 0 ) goto LABEL_73; v21 = ((unsigned __int64)v9 - qword_125F118) / v20 + v18; if ( !v21 || v21 >= qword_125F150 ) goto LABEL_71; if ( (*(unsigned __int8 *)(qword_125F148 + (v21 >> 3)) & (unsigned int)(1LL << (v21 & 7))) != 0 ) OPENSSL_die("assertion failed: !sh_testbit(temp, slist, sh.bitmalloc)", "crypto/mem_sec.c", 512); sub_DB5BE4((__int64)v9, v7, qword_125F140); sub_DB5CCC((unsigned __int64 *)(qword_125F128 + j), v9); if ( v9 != *(unsigned __int64 **)(qword_125F128 + j) ) OPENSSL_die("assertion failed: sh.freelist[slist] == temp", "crypto/mem_sec.c", 515); v22 = (unsigned __int64)qword_125F120 >> v7; v23 = qword_125F140; v14 = ((unsigned __int64)v9 - qword_125F118) / ((unsigned __int64)qword_125F120 >> v7); v24 = (v14 + v18) ^ 1; if ( ((*(unsigned __int8 *)(qword_125F140 + (v24 >> 3)) >> (v24 & 7)) & 1) != 0 ) { if ( ((*(unsigned __int8 *)(qword_125F148 + (v24 >> 3)) >> (v24 & 7)) & 1) != 0 ) v25 = 0; else v25 = qword_125F118 + (v24 & (v18 - 1)) * v22; } else { v25 = (*(unsigned __int8 *)(qword_125F140 + (v24 >> 3)) >> (v24 & 7)) & 1LL; } if ( (unsigned __int64 *)((char *)v9 - ((unsigned __int64)qword_125F120 >> 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_125F148; if ( qword_125F130 <= (int)v7 ) goto LABEL_70; v8 = j; if ( ((v22 - 1) & ((unsigned __int64)v9 - qword_125F118)) != 0 ) goto LABEL_73; } v5 = qword_125F130; v9 = *(unsigned __int64 **)(qword_125F128 + 8 * i); v28 = i; } if ( v5 > v28 ) { if ( (((unsigned __int64)v9 - qword_125F118) & (((unsigned __int64)qword_125F120 >> v28) - 1)) == 0 ) { v29 = ((unsigned __int64)v9 - qword_125F118) / ((unsigned __int64)qword_125F120 >> v28) + (1LL << v28); if ( !v29 || v29 >= qword_125F150 ) 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_DB5BE4((__int64)v9, v28, qword_125F148); v30 = *v9; if ( *v9 ) *(_QWORD *)(v30 + 8) = v9[1]; *(_QWORD *)v9[1] = v30; if ( *v9 && ((v31 = *(_QWORD *)(*v9 + 8), v31 < qword_125F128) || v31 >= qword_125F128 + 8 * qword_125F130) ) { v32 = qword_125F118; if ( v31 < qword_125F118 || v31 >= qword_125F118 + qword_125F120 ) LABEL_74: sub_4DEF0C(); } else { v32 = qword_125F118; } if ( (unsigned __int64)v9 < v32 || (unsigned __int64)v9 >= v32 + qword_125F120 ) OPENSSL_die("assertion failed: WITHIN_ARENA(chunk)", "crypto/mem_sec.c", 526); if ( v9 ) { v10 = sub_DB5EA8((unsigned __int64)v9); goto LABEL_9; } LABEL_8: v10 = (unsigned __int64)v9; LABEL_9: qword_125F168 += v10; CRYPTO_THREAD_unlock(qword_125F160); return v9; } LABEL_73: sub_4DEEEC(); } 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