{"type": "func", "start": 8213796, "end": 8214072, "name": "BN_mod_mul_montgomery", "pseudocode": "// \n// BN_mod_mul_montgomery from 0x7d5524 to 0x7d5638 (276 bytes)\n// \n// 21 xrefs:\n// > BN_to_montgomery @ 0x7d48d8\n// > ec_GFp_mont_field_mul @ 0x7efda8\n// > ec_GFp_mont_field_sqr @ 0x7efe00\n// > BN_mod_exp_mont_consttime @ 0x86d524\n// > BN_mod_exp_mont_consttime @ 0x86d5a0\n// > BN_mod_exp_mont_consttime @ 0x86d6c8\n// > BN_mod_exp_mont_consttime @ 0x86d734\n// > BN_mod_exp_mont @ 0x86da94\n// > BN_mod_exp_mont @ 0x86daf4\n// > BN_mod_exp_mont @ 0x86dc14\n// > BN_mod_exp_mont @ 0x86dc4c\n// > BN_mod_exp_mont @ 0x86ddd4\n// > BN_mod_exp_mont_word @ 0x86df38\n// > BN_mod_exp2_mont @ 0x86ea00\n// > BN_mod_exp2_mont @ 0x86ea38\n// > BN_mod_exp2_mont @ 0x86eb68\n// > BN_mod_exp2_mont @ 0x86ebb0\n// > BN_mod_exp2_mont @ 0x86edc4\n// > BN_mod_exp2_mont @ 0x86edf4\n// > BN_mod_exp2_mont @ 0x86ee30\n// > <???> @ 0x5fbcc\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_mod_mul_montgomery(int *a1, _DWORD *a2, _DWORD *a3, _DWORD *a4, int a5)\n{\n  int v5; // r12\n  int v10; // r7\n  _DWORD *v11; // r7\n  _BOOL4 v12; // r4\n  int result; // r0\n\n  v5 = a4[7];\n  if ( v5 <= 1 )\n    goto LABEL_3;\n  v10 = a2[1];\n  if ( v10 != v5 || v10 != a3[1] )\n    goto LABEL_3;\n  result = bn_wexpand((int)a1, a2[1]);\n  if ( result )\n  {\n    if ( bn_mul_mont(*a1, *a2, *a3, a4[6], a4 + 16, v10) )\n    {\n      a1[3] = a2[3] ^ a3[3];\n      a1[1] = v10;\n      bn_correct_top(a1);\n      return 1;\n    }\nLABEL_3:\n    BN_CTX_start(a5);\n    v11 = (_DWORD *)BN_CTX_get(a5);\n    if ( v11 )\n    {\n      if ( a2 == a3 )\n      {\n        if ( !BN_sqr() )\n          goto LABEL_6;\n      }\n      else if ( !BN_mul() )\n      {\n        goto LABEL_6;\n      }\n      v12 = sub_7D52C4(a1, v11, a4) != 0;\n      goto LABEL_7;\n    }\nLABEL_6:\n    v12 = 0;\nLABEL_7:\n    BN_CTX_end(a5);\n    return v12;\n  }\n  return result;\n}", "assembly": "; \n; BN_mod_mul_montgomery from 0x7d5524 to 0x7d5638 (276 bytes)\n; \n; 21 xrefs:\n; > BN_to_montgomery @ 0x7d48d8\n; > ec_GFp_mont_field_mul @ 0x7efda8\n; > ec_GFp_mont_field_sqr @ 0x7efe00\n; > BN_mod_exp_mont_consttime @ 0x86d524\n; > BN_mod_exp_mont_consttime @ 0x86d5a0\n; > BN_mod_exp_mont_consttime @ 0x86d6c8\n; > BN_mod_exp_mont_consttime @ 0x86d734\n; > BN_mod_exp_mont @ 0x86da94\n; > BN_mod_exp_mont @ 0x86daf4\n; > BN_mod_exp_mont @ 0x86dc14\n; > BN_mod_exp_mont @ 0x86dc4c\n; > BN_mod_exp_mont @ 0x86ddd4\n; > BN_mod_exp_mont_word @ 0x86df38\n; > BN_mod_exp2_mont @ 0x86ea00\n; > BN_mod_exp2_mont @ 0x86ea38\n; > BN_mod_exp2_mont @ 0x86eb68\n; > BN_mod_exp2_mont @ 0x86ebb0\n; > BN_mod_exp2_mont @ 0x86edc4\n; > BN_mod_exp2_mont @ 0x86edf4\n; > BN_mod_exp2_mont @ 0x86ee30\n; > <???> @ 0x5fbcc\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\nLDR             R12, [R3,#0x1C]                                        ; +0x0, 0x7d5524\nPUSH            {R4-R8,LR}                                             ; +0x4, 0x7d5528\nCMP             R12, #1                                                ; +0x8, 0x7d552c\nSUB             SP, SP, #8                                             ; +0xc, 0x7d5530\nMOV             R6, R3                                                 ; +0x10, 0x7d5534\nMOV             R4, R1                                                 ; +0x14, 0x7d5538\nMOV             R5, R2                                                 ; +0x18, 0x7d553c\nMOV             R8, R0                                                 ; +0x1c, 0x7d5540\nBLE             loc_7D5554                                             ; +0x20, 0x7d5544\nLDR             R7, [R1,#4]                                            ; +0x24, 0x7d5548\nCMP             R7, R12                                                ; +0x28, 0x7d554c\nBEQ             loc_7D55D0                                             ; +0x2c, 0x7d5550\nLDR             R0, [SP,#8+arg_0]                                      ; +0x30, 0x7d5554\nBL              BN_CTX_start                                           ; +0x34, 0x7d5558\nLDR             R0, [SP,#8+arg_0]                                      ; +0x38, 0x7d555c\nBL              BN_CTX_get                                             ; +0x3c, 0x7d5560\nSUBS            R7, R0, #0                                             ; +0x40, 0x7d5564\nBEQ             loc_7D558C                                             ; +0x44, 0x7d5568\nCMP             R4, R5                                                 ; +0x48, 0x7d556c\nMOV             R1, R4                                                 ; +0x4c, 0x7d5570\nBEQ             loc_7D55A4                                             ; +0x50, 0x7d5574\nMOV             R2, R5                                                 ; +0x54, 0x7d5578\nLDR             R3, [SP,#8+arg_0]                                      ; +0x58, 0x7d557c\nBL              BN_mul                                                 ; +0x5c, 0x7d5580\nCMP             R0, #0                                                 ; +0x60, 0x7d5584\nBNE             loc_7D55B4                                             ; +0x64, 0x7d5588\nMOV             R4, #0                                                 ; +0x68, 0x7d558c\nLDR             R0, [SP,#8+arg_0]                                      ; +0x6c, 0x7d5590\nBL              BN_CTX_end                                             ; +0x70, 0x7d5594\nMOV             R0, R4                                                 ; +0x74, 0x7d5598\nADD             SP, SP, #8                                             ; +0x78, 0x7d559c\nPOP             {R4-R8,PC}                                             ; +0x7c, 0x7d55a0\nLDR             R2, [SP,#8+arg_0]                                      ; +0x80, 0x7d55a4\nBL              BN_sqr                                                 ; +0x84, 0x7d55a8\nCMP             R0, #0                                                 ; +0x88, 0x7d55ac\nBEQ             loc_7D558C                                             ; +0x8c, 0x7d55b0\nMOV             R0, R8                                                 ; +0x90, 0x7d55b4\nMOV             R1, R7                                                 ; +0x94, 0x7d55b8\nMOV             R2, R6                                                 ; +0x98, 0x7d55bc\nBL              sub_7D52C4                                             ; +0x9c, 0x7d55c0\nMOVS            R4, R0                                                 ; +0xa0, 0x7d55c4\nMOVNE           R4, #1                                                 ; +0xa4, 0x7d55c8\nB               loc_7D5590                                             ; +0xa8, 0x7d55cc\nLDR             R3, [R2,#4]                                            ; +0xac, 0x7d55d0\nCMP             R7, R3                                                 ; +0xb0, 0x7d55d4\nBNE             loc_7D5554                                             ; +0xb4, 0x7d55d8\nMOV             R1, R7                                                 ; +0xb8, 0x7d55dc\nBL              bn_wexpand                                             ; +0xbc, 0x7d55e0\nCMP             R0, #0                                                 ; +0xc0, 0x7d55e4\nBEQ             loc_7D559C                                             ; +0xc4, 0x7d55e8\nADD             R12, R6, #0x40 ; '@'                                   ; +0xc8, 0x7d55ec\nLDR             R0, [R8]                                               ; +0xcc, 0x7d55f0\nLDR             R1, [R4]                                               ; +0xd0, 0x7d55f4\nLDR             R2, [R5]                                               ; +0xd4, 0x7d55f8\nLDR             R3, [R6,#0x18]                                         ; +0xd8, 0x7d55fc\nSTR             R7, [SP,#8+var_4]                                      ; +0xdc, 0x7d5600\nSTR             R12, [SP,#8+var_8]                                     ; +0xe0, 0x7d5604\nBL              bn_mul_mont                                            ; +0xe4, 0x7d5608\nCMP             R0, #0                                                 ; +0xe8, 0x7d560c\nBEQ             loc_7D5554                                             ; +0xec, 0x7d5610\nLDR             R2, [R5,#0xC]                                          ; +0xf0, 0x7d5614\nLDR             R3, [R4,#0xC]                                          ; +0xf4, 0x7d5618\nMOV             R0, R8                                                 ; +0xf8, 0x7d561c\nEOR             R3, R3, R2                                             ; +0xfc, 0x7d5620\nSTR             R3, [R8,#0xC]                                          ; +0x100, 0x7d5624\nSTR             R7, [R8,#4]                                            ; +0x104, 0x7d5628\nBL              bn_correct_top                                         ; +0x108, 0x7d562c\nMOV             R0, #1                                                 ; +0x10c, 0x7d5630\nB               loc_7D559C                                             ; +0x110, 0x7d5634", "xrefs": ["BN_to_montgomery @ 0x7d48d8", "ec_GFp_mont_field_mul @ 0x7efda8", "ec_GFp_mont_field_sqr @ 0x7efe00", "BN_mod_exp_mont_consttime @ 0x86d524", "BN_mod_exp_mont_consttime @ 0x86d5a0", "BN_mod_exp_mont_consttime @ 0x86d6c8", "BN_mod_exp_mont_consttime @ 0x86d734", "BN_mod_exp_mont @ 0x86da94", "BN_mod_exp_mont @ 0x86daf4", "BN_mod_exp_mont @ 0x86dc14", "BN_mod_exp_mont @ 0x86dc4c", "BN_mod_exp_mont @ 0x86ddd4", "BN_mod_exp_mont_word @ 0x86df38", "BN_mod_exp2_mont @ 0x86ea00", "BN_mod_exp2_mont @ 0x86ea38", "BN_mod_exp2_mont @ 0x86eb68", "BN_mod_exp2_mont @ 0x86ebb0", "BN_mod_exp2_mont @ 0x86edc4", "BN_mod_exp2_mont @ 0x86edf4", "BN_mod_exp2_mont @ 0x86ee30", "<???> @ 0x5fbcc"], "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"}