// // BN_rand from 0xa85228 to 0xa853e4 (444 bytes) // // 10 xrefs: // > sub_9F4DE0 @ 0x9f4e50 // > BN_rand_range @ 0xa858c0 // > BN_rand_range @ 0xa8591c // > BN_GF2m_mod_solve_quad_arr @ 0xadeaa4 // > bn_probable_prime_dh_retry @ 0xadfdb0 // > bn_probable_prime_dh_coprime @ 0xadfe9c // > bn_probable_prime_dh @ 0xadffb8 // > BN_generate_prime_ex @ 0xae0484 // > BN_generate_prime_ex @ 0xae05b4 // > @ 0x7a50c // // 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:51 +0000 // int __fastcall BN_rand(int *a1, int a2, int a3, int a4) { bool v7; // zf _BOOL4 v9; // r4 int v10; // r8 unsigned __int8 *v12; // r9 int v13; // r5 int v14; // r3 unsigned int v15; // r2 int v16; // r2 int v17; // r5 time_t timer[2]; // [sp+Ch] [bp-8h] BYREF if ( a2 ) { if ( a2 < 0 ) goto LABEL_5; v9 = a2 == 1; if ( a3 <= 0 ) v9 = 0; if ( v9 ) goto LABEL_5; v10 = (a2 + 7) >> 3; v12 = (unsigned __int8 *)CRYPTO_malloc((void *)v10, (int)"crypto/bn/bn_rand.c", 36); if ( v12 ) { time(timer); RAND_add((int)timer, 4, 0, 0); if ( RAND_bytes((int)v12, (a2 + 7) >> 3) > 0 ) { v13 = ((_BYTE)a2 - 1) & 7; if ( a3 >= 0 ) { if ( a3 ) { if ( v13 ) v15 = *v12; else v15 = v12[1]; if ( v13 ) { v14 = v15 | (3 << (v13 - 1)); } else { v15 = ~(~(v15 << 25) >> 25); v14 = 1; } if ( v13 ) v14 = (unsigned __int8)v14; else v12[1] = v15; } else { v14 = (unsigned __int8)(*v12 | (1 << v13)); } } else { v14 = *v12; } v16 = 255; v17 = v14 & ~(255 << (v13 + 1)); if ( a4 ) v16 = v10 - 1; *v12 = v17; if ( a4 ) v12[v16] |= 1u; v9 = BN_bin2bn(v12, v10, a1) != nullptr; } } else { ERR_put_error(3, 127, 65, (int)"crypto/bn/bn_rand.c", 38); v9 = 0; } CRYPTO_clear_free(v12, v10, (int)"crypto/bn/bn_rand.c", 87); return v9; } else { v7 = a3 == -1; if ( a3 == -1 ) v7 = a4 == 0; if ( !v7 ) { LABEL_5: ERR_put_error(3, 127, 118, (int)"crypto/bn/bn_rand.c", 92); return 0; } BN_set_word((int **)a1, 0); return 1; } }