{"type": "func", "start": 14850532, "end": 14850852, "name": "DH_check_pub_key", "pseudocode": "// \n// DH_check_pub_key from 0xe299e4 to 0xe29b24 (320 bytes)\n// \n// 2 xrefs:\n// > sub_D877EC @ 0xd8785c\n// > <???> @ 0xaf920\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\n__int64 __fastcall DH_check_pub_key(__int64 a1, __int64 *a2, _DWORD *a3)\n{\n  int32x2_t *v6; // x0\n  int32x2_t *v7; // x19\n  __int64 v8; // x0\n  __int64 *v9; // x21\n  unsigned int v10; // w21\n  __int64 v12; // x2\n\n  *a3 = 0;\n  v6 = (int32x2_t *)BN_CTX_new();\n  v7 = v6;\n  if ( v6 )\n  {\n    BN_CTX_start((unsigned __int64)v6);\n    v8 = BN_CTX_get(v7);\n    v9 = (__int64 *)v8;\n    if ( v8 && (unsigned int)BN_set_word(v8, 1) )\n    {\n      if ( (int)BN_cmp(a2, v9) <= 0 )\n        *a3 |= 1u;\n      if ( BN_copy((unsigned __int64 *)v9, *(_QWORD *)(a1 + 8)) && (unsigned int)BN_sub_word((__int64)v9, 1u) )\n      {\n        if ( (BN_cmp(a2, v9) & 0x80000000) == 0 )\n          *a3 |= 2u;\n        v12 = *(_QWORD *)(a1 + 64);\n        if ( !v12 )\n          goto LABEL_17;\n        if ( (unsigned int)BN_mod_exp((__int64)v9, (__int64)a2, v12, *(_QWORD *)(a1 + 8), v7) )\n        {\n          if ( !(unsigned int)BN_is_one((__int64)v9) )\n          {\n            v10 = 1;\n            *a3 |= 4u;\n            goto LABEL_5;\n          }\nLABEL_17:\n          v10 = 1;\n          goto LABEL_5;\n        }\n      }\n    }\n    v10 = 0;\nLABEL_5:\n    BN_CTX_end((__int64)v7);\n    BN_CTX_free((void **)v7);\n    return v10;\n  }\n  return 0;\n}", "assembly": "; \n; DH_check_pub_key from 0xe299e4 to 0xe29b24 (320 bytes)\n; \n; 2 xrefs:\n; > sub_D877EC @ 0xd8785c\n; > <???> @ 0xaf920\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\nSTP             X29, X30, [SP,#var_40]!                                ; +0x0, 0xe299e4\nMOV             X29, SP                                                ; +0x4, 0xe299e8\nSTP             X19, X20, [SP,#0x40+var_30]                            ; +0x8, 0xe299ec\nSTP             X21, X22, [SP,#0x40+var_20]                            ; +0xc, 0xe299f0\nSTR             X23, [SP,#0x40+var_10]                                 ; +0x10, 0xe299f4\nMOV             X20, X2                                                ; +0x14, 0xe299f8\nSTR             WZR, [X2]                                              ; +0x18, 0xe299fc\nMOV             X23, X0                                                ; +0x1c, 0xe29a00\nMOV             X22, X1                                                ; +0x20, 0xe29a04\nBL              BN_CTX_new                                             ; +0x24, 0xe29a08\nMOV             X19, X0                                                ; +0x28, 0xe29a0c\nCBZ             X0, loc_E29A60                                         ; +0x2c, 0xe29a10\nBL              BN_CTX_start                                           ; +0x30, 0xe29a14\nMOV             X0, X19                                                ; +0x34, 0xe29a18\nBL              BN_CTX_get                                             ; +0x38, 0xe29a1c\nMOV             X21, X0                                                ; +0x3c, 0xe29a20\nCBZ             X0, loc_E29A34                                         ; +0x40, 0xe29a24\nMOV             X1, #1                                                 ; +0x44, 0xe29a28\nBL              BN_set_word                                            ; +0x48, 0xe29a2c\nCBNZ            W0, loc_E29A7C                                         ; +0x4c, 0xe29a30\nMOV             W21, #0                                                ; +0x50, 0xe29a34\nMOV             X0, X19                                                ; +0x54, 0xe29a38\nBL              BN_CTX_end                                             ; +0x58, 0xe29a3c\nMOV             X0, X19                                                ; +0x5c, 0xe29a40\nBL              BN_CTX_free                                            ; +0x60, 0xe29a44\nLDR             X23, [SP,#0x40+var_10]                                 ; +0x64, 0xe29a48\nMOV             W0, W21                                                ; +0x68, 0xe29a4c\nLDP             X19, X20, [SP,#0x40+var_30]                            ; +0x6c, 0xe29a50\nLDP             X21, X22, [SP,#0x40+var_20]                            ; +0x70, 0xe29a54\nLDP             X29, X30, [SP+0x40+var_40],#0x40                       ; +0x74, 0xe29a58\nRET                                                                    ; +0x78, 0xe29a5c\nMOV             W21, W0                                                ; +0x7c, 0xe29a60\nLDR             X23, [SP,#0x40+var_10]                                 ; +0x80, 0xe29a64\nMOV             W0, W21                                                ; +0x84, 0xe29a68\nLDP             X19, X20, [SP,#0x40+var_30]                            ; +0x88, 0xe29a6c\nLDP             X21, X22, [SP,#0x40+var_20]                            ; +0x8c, 0xe29a70\nLDP             X29, X30, [SP+0x40+var_40],#0x40                       ; +0x90, 0xe29a74\nRET                                                                    ; +0x94, 0xe29a78\nMOV             X0, X22                                                ; +0x98, 0xe29a7c\nMOV             X1, X21                                                ; +0x9c, 0xe29a80\nBL              BN_cmp                                                 ; +0xa0, 0xe29a84\nCMP             W0, WZR                                                ; +0xa4, 0xe29a88\nB.LE            loc_E29B0C                                             ; +0xa8, 0xe29a8c\nLDR             X1, [X23,#8]                                           ; +0xac, 0xe29a90\nMOV             X0, X21                                                ; +0xb0, 0xe29a94\nBL              BN_copy                                                ; +0xb4, 0xe29a98\nCBZ             X0, loc_E29A34                                         ; +0xb8, 0xe29a9c\nMOV             X0, X21                                                ; +0xbc, 0xe29aa0\nMOV             X1, #1                                                 ; +0xc0, 0xe29aa4\nBL              BN_sub_word                                            ; +0xc4, 0xe29aa8\nCBZ             W0, loc_E29A34                                         ; +0xc8, 0xe29aac\nMOV             X0, X22                                                ; +0xcc, 0xe29ab0\nMOV             X1, X21                                                ; +0xd0, 0xe29ab4\nBL              BN_cmp                                                 ; +0xd4, 0xe29ab8\nTBNZ            W0, #0x1F, loc_E29ACC                                  ; +0xd8, 0xe29abc\nLDR             W0, [X20]                                              ; +0xdc, 0xe29ac0\nORR             W0, W0, #2                                             ; +0xe0, 0xe29ac4\nSTR             W0, [X20]                                              ; +0xe4, 0xe29ac8\nLDR             X2, [X23,#0x40]                                        ; +0xe8, 0xe29acc\nCBZ             X2, loc_E29B1C                                         ; +0xec, 0xe29ad0\nLDR             X3, [X23,#8]                                           ; +0xf0, 0xe29ad4\nMOV             X0, X21                                                ; +0xf4, 0xe29ad8\nMOV             X1, X22                                                ; +0xf8, 0xe29adc\nMOV             X4, X19                                                ; +0xfc, 0xe29ae0\nBL              BN_mod_exp                                             ; +0x100, 0xe29ae4\nCBZ             W0, loc_E29A34                                         ; +0x104, 0xe29ae8\nMOV             X0, X21                                                ; +0x108, 0xe29aec\nBL              BN_is_one                                              ; +0x10c, 0xe29af0\nCBNZ            W0, loc_E29B1C                                         ; +0x110, 0xe29af4\nLDR             W0, [X20]                                              ; +0x114, 0xe29af8\nMOV             W21, #1                                                ; +0x118, 0xe29afc\nORR             W0, W0, #4                                             ; +0x11c, 0xe29b00\nSTR             W0, [X20]                                              ; +0x120, 0xe29b04\nB               loc_E29A38                                             ; +0x124, 0xe29b08\nLDR             W0, [X20]                                              ; +0x128, 0xe29b0c\nORR             W0, W0, #1                                             ; +0x12c, 0xe29b10\nSTR             W0, [X20]                                              ; +0x130, 0xe29b14\nB               loc_E29A90                                             ; +0x134, 0xe29b18\nMOV             W21, #1                                                ; +0x138, 0xe29b1c\nB               loc_E29A38                                             ; +0x13c, 0xe29b20", "xrefs": ["sub_D877EC @ 0xd8785c", "<???> @ 0xaf920"], "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"}