; ; BN_pseudo_rand from 0x8707f0 to 0x8709ac (444 bytes) ; ; 4 xrefs: ; > BN_pseudo_rand_range @ 0x870ea4 ; > BN_pseudo_rand_range @ 0x870f00 ; > BN_mod_sqrt @ 0x871b94 ; > @ 0x69dec ; ; 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 ; PUSH {R4-R11,LR} ; +0x0, 0x8707f0 SUBS R5, R1, #0 ; +0x4, 0x8707f4 SUB SP, SP, #0x14 ; +0x8, 0x8707f8 MOV R6, R2 ; +0xc, 0x8707fc MOV R7, R3 ; +0x10, 0x870800 BNE loc_870840 ; +0x14, 0x870804 CMN R2, #1 ; +0x18, 0x870808 CMPEQ R3, #0 ; +0x1c, 0x87080c BEQ loc_870964 ; +0x20, 0x870810 MOV R3, #0x5C ; '\' ; +0x24, 0x870814 STR R3, [SP,#0x14+var_14] ; +0x28, 0x870818 LDR R3, =(aCryptoBnBnRand - 0x870834); "crypto/bn/bn_rand.c" ; +0x2c, 0x87081c MOV R0, #3 ; +0x30, 0x870820 MOV R1, #0x7F ; +0x34, 0x870824 MOV R2, #0x76 ; 'v' ; +0x38, 0x870828 ADD R3, PC, R3; "crypto/bn/bn_rand.c" ; +0x3c, 0x87082c BL ERR_put_error ; +0x40, 0x870830 MOV R0, #0 ; +0x44, 0x870834 ADD SP, SP, #0x14 ; +0x48, 0x870838 POP {R4-R11,PC} ; +0x4c, 0x87083c BLT loc_870814 ; +0x50, 0x870840 CMP R2, #0 ; +0x54, 0x870844 SUB R4, R5, #1 ; +0x58, 0x870848 CLZ R4, R4 ; +0x5c, 0x87084c MOV R4, R4,LSR#5 ; +0x60, 0x870850 MOVLE R4, #0 ; +0x64, 0x870854 CMP R4, #0 ; +0x68, 0x870858 BNE loc_870814 ; +0x6c, 0x87085c LDR R11, =(aCryptoBnBnRand - 0x870870); "crypto/bn/bn_rand.c" ; +0x70, 0x870860 ADD R8, R5, #7 ; +0x74, 0x870864 ADD R11, PC, R11; "crypto/bn/bn_rand.c" ; +0x78, 0x870868 MOV R8, R8,ASR#3 ; +0x7c, 0x87086c MOV R10, R0 ; +0x80, 0x870870 MOV R1, R11 ; +0x84, 0x870874 MOV R0, R8 ; +0x88, 0x870878 MOV R2, #0x24 ; '$' ; +0x8c, 0x87087c BL CRYPTO_malloc ; +0x90, 0x870880 SUBS R9, R0, #0 ; +0x94, 0x870884 BEQ loc_870988 ; +0x98, 0x870888 ADD R11, SP, #0x14+timer ; +0x9c, 0x87088c MOV R0, R11; timer ; +0xa0, 0x870890 BL time ; +0xa4, 0x870894 MOV R0, R11 ; +0xa8, 0x870898 MOV R1, #4 ; +0xac, 0x87089c MOV R2, #0 ; +0xb0, 0x8708a0 MOV R3, #0 ; +0xb4, 0x8708a4 BL RAND_add ; +0xb8, 0x8708a8 MOV R0, R9 ; +0xbc, 0x8708ac MOV R1, R8 ; +0xc0, 0x8708b0 BL RAND_bytes ; +0xc4, 0x8708b4 CMP R0, #0 ; +0xc8, 0x8708b8 BLE loc_870940 ; +0xcc, 0x8708bc SUB R5, R5, #1 ; +0xd0, 0x8708c0 CMP R6, #0 ; +0xd4, 0x8708c4 AND R5, R5, #7 ; +0xd8, 0x8708c8 LDRBLT R3, [R9] ; +0xdc, 0x8708cc BLT loc_870904 ; +0xe0, 0x8708d0 BEQ loc_870974 ; +0xe4, 0x8708d4 CMP R5, #0 ; +0xe8, 0x8708d8 LDRBNE R2, [R9] ; +0xec, 0x8708dc LDRBEQ R2, [R9,#1] ; +0xf0, 0x8708e0 SUBNE R3, R5, #1 ; +0xf4, 0x8708e4 MOVNE R1, #3 ; +0xf8, 0x8708e8 ORRNE R3, R2, R1,LSL R3 ; +0xfc, 0x8708ec MVNEQ R2, R2,LSL#25 ; +0x100, 0x8708f0 MVNEQ R2, R2,LSR#25 ; +0x104, 0x8708f4 MOVEQ R3, #1 ; +0x108, 0x8708f8 ANDNE R3, R3, #0xFF ; +0x10c, 0x8708fc STRBEQ R2, [R9,#1] ; +0x110, 0x870900 MOV R2, #0xFF ; +0x114, 0x870904 ADD R5, R5, #1 ; +0x118, 0x870908 BIC R5, R3, R2,LSL R5 ; +0x11c, 0x87090c CMP R7, #0 ; +0x120, 0x870910 SUBNE R2, R8, #1 ; +0x124, 0x870914 STRB R5, [R9] ; +0x128, 0x870918 LDRBNE R3, [R9,R2] ; +0x12c, 0x87091c MOV R0, R9 ; +0x130, 0x870920 ORRNE R3, R3, #1 ; +0x134, 0x870924 STRBNE R3, [R9,R2] ; +0x138, 0x870928 MOV R1, R8 ; +0x13c, 0x87092c MOV R2, R10 ; +0x140, 0x870930 BL BN_bin2bn ; +0x144, 0x870934 MOVS R4, R0 ; +0x148, 0x870938 MOVNE R4, #1 ; +0x14c, 0x87093c LDR R2, =(aCryptoBnBnRand - 0x870954); "crypto/bn/bn_rand.c" ; +0x150, 0x870940 MOV R0, R9 ; +0x154, 0x870944 MOV R1, R8 ; +0x158, 0x870948 ADD R2, PC, R2; "crypto/bn/bn_rand.c" ; +0x15c, 0x87094c MOV R3, #0x57 ; 'W' ; +0x160, 0x870950 BL CRYPTO_clear_free ; +0x164, 0x870954 MOV R0, R4 ; +0x168, 0x870958 ADD SP, SP, #0x14 ; +0x16c, 0x87095c POP {R4-R11,PC} ; +0x170, 0x870960 BL BN_set_word ; +0x174, 0x870964 MOV R0, #1 ; +0x178, 0x870968 ADD SP, SP, #0x14 ; +0x17c, 0x87096c POP {R4-R11,PC} ; +0x180, 0x870970 LDRB R3, [R9] ; +0x184, 0x870974 MOV R2, #1 ; +0x188, 0x870978 ORR R3, R3, R2,LSL R5 ; +0x18c, 0x87097c AND R3, R3, #0xFF ; +0x190, 0x870980 B loc_870904 ; +0x194, 0x870984 MOV R2, #0x26 ; '&' ; +0x198, 0x870988 STR R2, [SP,#0x14+var_14] ; +0x19c, 0x87098c MOV R3, R11 ; +0x1a0, 0x870990 MOV R0, #3 ; +0x1a4, 0x870994 MOV R1, #0x7F ; +0x1a8, 0x870998 MOV R2, #0x41 ; 'A' ; +0x1ac, 0x87099c BL ERR_put_error ; +0x1b0, 0x8709a0 MOV R4, R9 ; +0x1b4, 0x8709a4 B loc_870940 ; +0x1b8, 0x8709a8