{"type": "func", "start": 8834024, "end": 8834420, "name": "BN_exp", "pseudocode": "// \n// BN_exp from 0x86cbe8 to 0x86cd74 (396 bytes)\n// \n// 1 xrefs:\n// > <???> @ 0x69cfc\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nint __fastcall BN_exp(int a1, int a2, _DWORD *a3, int ***a4)\n{\n  bool v8; // zf\n  int **v9; // r9\n  int **v10; // r0\n  bool v11; // zf\n  int **v12; // r7\n  int v13; // r4\n  int v15; // r10\n  int v16; // r4\n  int v17; // r0\n  int v18; // r1\n\n  if ( !BN_get_flags((int)a3, 4) )\n  {\n    BN_CTX_start((int)a4);\n    v8 = a1 == a2;\n    if ( a1 != a2 )\n      v8 = a1 == (_DWORD)a3;\n    if ( v8 )\n      v9 = BN_CTX_get(a4);\n    else\n      v9 = (int **)a1;\n    v10 = BN_CTX_get(a4);\n    v11 = v9 == nullptr;\n    if ( v9 )\n      v11 = v10 == nullptr;\n    v12 = v10;\n    if ( v11 || !BN_copy((int)v10, a2) )\n      goto LABEL_11;\n    v15 = BN_num_bits(a3);\n    if ( BN_is_odd((int)a3) )\n    {\n      if ( !BN_copy((int)v9, a2) )\n        goto LABEL_11;\n    }\n    else if ( !BN_set_word(v9, 1) )\n    {\n      goto LABEL_11;\n    }\n    if ( v15 <= 1 )\n    {\nLABEL_27:\n      if ( (int **)a1 != v9 )\n        BN_copy(a1, (int)v9);\n      v13 = 1;\n      goto LABEL_12;\n    }\n    v16 = 1;\n    while ( 1 )\n    {\n      v17 = BN_sqr((int)v12, v12, (int)a4);\n      v18 = v16++;\n      if ( !v17 || BN_is_bit_set(a3, v18) && !BN_mul(v9, v9, v12, (int)a4) )\n        break;\n      if ( v16 == v15 )\n        goto LABEL_27;\n    }\nLABEL_11:\n    v13 = 0;\nLABEL_12:\n    BN_CTX_end(a4);\n    return v13;\n  }\n  ERR_put_error(3, 123, 66, (int)\"crypto/bn/bn_exp.c\", 48);\n  return 0;\n}", "assembly": "; \n; BN_exp from 0x86cbe8 to 0x86cd74 (396 bytes)\n; \n; 1 xrefs:\n; > <???> @ 0x69cfc\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nPUSH            {R4-R10,LR}                                            ; +0x0, 0x86cbe8\nMOV             R8, R0                                                 ; +0x4, 0x86cbec\nSUB             SP, SP, #8                                             ; +0x8, 0x86cbf0\nMOV             R4, R1                                                 ; +0xc, 0x86cbf4\nMOV             R0, R2                                                 ; +0x10, 0x86cbf8\nMOV             R1, #4                                                 ; +0x14, 0x86cbfc\nMOV             R6, R2                                                 ; +0x18, 0x86cc00\nMOV             R5, R3                                                 ; +0x1c, 0x86cc04\nBL              BN_get_flags                                           ; +0x20, 0x86cc08\nCMP             R0, #0                                                 ; +0x24, 0x86cc0c\nBNE             loc_86CC5C                                             ; +0x28, 0x86cc10\nMOV             R0, R5                                                 ; +0x2c, 0x86cc14\nBL              BN_CTX_start                                           ; +0x30, 0x86cc18\nCMP             R8, R4                                                 ; +0x34, 0x86cc1c\nCMPNE           R8, R6                                                 ; +0x38, 0x86cc20\nMOVNE           R9, R8                                                 ; +0x3c, 0x86cc24\nBEQ             loc_86CD30                                             ; +0x40, 0x86cc28\nMOV             R0, R5                                                 ; +0x44, 0x86cc2c\nBL              BN_CTX_get                                             ; +0x48, 0x86cc30\nCMP             R9, #0                                                 ; +0x4c, 0x86cc34\nCMPNE           R0, #0                                                 ; +0x50, 0x86cc38\nMOV             R7, R0                                                 ; +0x54, 0x86cc3c\nBNE             loc_86CC88                                             ; +0x58, 0x86cc40\nMOV             R4, #0                                                 ; +0x5c, 0x86cc44\nMOV             R0, R5                                                 ; +0x60, 0x86cc48\nBL              BN_CTX_end                                             ; +0x64, 0x86cc4c\nMOV             R0, R4                                                 ; +0x68, 0x86cc50\nADD             SP, SP, #8                                             ; +0x6c, 0x86cc54\nPOP             {R4-R10,PC}                                            ; +0x70, 0x86cc58\nMOV             R3, #0x30 ; '0'                                        ; +0x74, 0x86cc5c\nSTR             R3, [SP,#8+var_8]                                      ; +0x78, 0x86cc60\nLDR             R3, =(aCryptoBnBnExpC - 0x86CC7C); \"crypto/bn/bn_exp.c\" ; +0x7c, 0x86cc64\nMOV             R0, #3                                                 ; +0x80, 0x86cc68\nMOV             R1, #0x7B ; '{'                                        ; +0x84, 0x86cc6c\nMOV             R2, #0x42 ; 'B'                                        ; +0x88, 0x86cc70\nADD             R3, PC, R3; \"crypto/bn/bn_exp.c\"                       ; +0x8c, 0x86cc74\nBL              ERR_put_error                                          ; +0x90, 0x86cc78\nMOV             R0, #0                                                 ; +0x94, 0x86cc7c\nADD             SP, SP, #8                                             ; +0x98, 0x86cc80\nPOP             {R4-R10,PC}                                            ; +0x9c, 0x86cc84\nMOV             R1, R4                                                 ; +0xa0, 0x86cc88\nBL              BN_copy                                                ; +0xa4, 0x86cc8c\nCMP             R0, #0                                                 ; +0xa8, 0x86cc90\nBEQ             loc_86CC44                                             ; +0xac, 0x86cc94\nMOV             R0, R6                                                 ; +0xb0, 0x86cc98\nBL              BN_num_bits                                            ; +0xb4, 0x86cc9c\nMOV             R10, R0                                                ; +0xb8, 0x86cca0\nMOV             R0, R6                                                 ; +0xbc, 0x86cca4\nBL              BN_is_odd                                              ; +0xc0, 0x86cca8\nCMP             R0, #0                                                 ; +0xc4, 0x86ccac\nBEQ             loc_86CD40                                             ; +0xc8, 0x86ccb0\nMOV             R1, R4                                                 ; +0xcc, 0x86ccb4\nMOV             R0, R9                                                 ; +0xd0, 0x86ccb8\nBL              BN_copy                                                ; +0xd4, 0x86ccbc\nCMP             R0, #0                                                 ; +0xd8, 0x86ccc0\nBEQ             loc_86CC44                                             ; +0xdc, 0x86ccc4\nCMP             R10, #1                                                ; +0xe0, 0x86ccc8\nMOVGT           R4, #1                                                 ; +0xe4, 0x86cccc\nBGT             loc_86CCE0                                             ; +0xe8, 0x86ccd0\nB               loc_86CD58                                             ; +0xec, 0x86ccd4\nCMP             R4, R10                                                ; +0xf0, 0x86ccd8\nBEQ             loc_86CD58                                             ; +0xf4, 0x86ccdc\nMOV             R1, R7                                                 ; +0xf8, 0x86cce0\nMOV             R0, R7                                                 ; +0xfc, 0x86cce4\nMOV             R2, R5                                                 ; +0x100, 0x86cce8\nBL              BN_sqr                                                 ; +0x104, 0x86ccec\nMOV             R1, R4                                                 ; +0x108, 0x86ccf0\nADD             R4, R4, #1                                             ; +0x10c, 0x86ccf4\nCMP             R0, #0                                                 ; +0x110, 0x86ccf8\nMOV             R0, R6                                                 ; +0x114, 0x86ccfc\nBEQ             loc_86CC44                                             ; +0x118, 0x86cd00\nBL              BN_is_bit_set                                          ; +0x11c, 0x86cd04\nCMP             R0, #0                                                 ; +0x120, 0x86cd08\nBEQ             loc_86CCD8                                             ; +0x124, 0x86cd0c\nMOV             R0, R9                                                 ; +0x128, 0x86cd10\nMOV             R1, R9                                                 ; +0x12c, 0x86cd14\nMOV             R2, R7                                                 ; +0x130, 0x86cd18\nMOV             R3, R5                                                 ; +0x134, 0x86cd1c\nBL              BN_mul                                                 ; +0x138, 0x86cd20\nCMP             R0, #0                                                 ; +0x13c, 0x86cd24\nBNE             loc_86CCD8                                             ; +0x140, 0x86cd28\nB               loc_86CC44                                             ; +0x144, 0x86cd2c\nMOV             R0, R5                                                 ; +0x148, 0x86cd30\nBL              BN_CTX_get                                             ; +0x14c, 0x86cd34\nMOV             R9, R0                                                 ; +0x150, 0x86cd38\nB               loc_86CC2C                                             ; +0x154, 0x86cd3c\nMOV             R0, R9                                                 ; +0x158, 0x86cd40\nMOV             R1, #1                                                 ; +0x15c, 0x86cd44\nBL              BN_set_word                                            ; +0x160, 0x86cd48\nCMP             R0, #0                                                 ; +0x164, 0x86cd4c\nBEQ             loc_86CC44                                             ; +0x168, 0x86cd50\nB               loc_86CCC8                                             ; +0x16c, 0x86cd54\nCMP             R8, R9                                                 ; +0x170, 0x86cd58\nBEQ             loc_86CD6C                                             ; +0x174, 0x86cd5c\nMOV             R0, R8                                                 ; +0x178, 0x86cd60\nMOV             R1, R9                                                 ; +0x17c, 0x86cd64\nBL              BN_copy                                                ; +0x180, 0x86cd68\nMOV             R4, #1                                                 ; +0x184, 0x86cd6c\nB               loc_86CC48                                             ; +0x188, 0x86cd70", "xrefs": ["<???> @ 0x69cfc"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}