{"type": "func", "start": 4297683200, "end": 4297683600, "name": "-[NSData makeCryptedVersionWithKeyData:ofLength:decrypt:]", "pseudocode": "// \n// -[NSData makeCryptedVersionWithKeyData:ofLength:decrypt:] from 0x100297100 to 0x100297290 (400 bytes)\n// \n// 1 xrefs:\n// > <???> @ 0x10099a1a8\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\nid __cdecl -[NSData makeCryptedVersionWithKeyData:ofLength:decrypt:](\n        NSData *self,\n        SEL a2,\n        const void *a3,\n        int a4,\n        bool a5)\n{\n  int v5; // eax\n  char *v6; // r13\n  void *v7; // r14\n  id v8; // r15\n  char v9; // r12\n  id v10; // rax\n  CCCryptorStatus v11; // eax\n  __int64 v12; // rdx\n  __CFString *v13; // rdi\n  void *v14; // rbx\n  const char *v15; // rsi\n  size_t dataOutMoved; // [rsp+0h] [rbp-60h] BYREF\n  CCOperation op; // [rsp+Ch] [rbp-54h]\n  _OWORD key[2]; // [rsp+10h] [rbp-50h] BYREF\n\n  op = a5;\n  memset(key, 0, sizeof(key));\n  v5 = 32;\n  if ( a4 < 32 )\n    v5 = a4;\n  __memcpy_chk(key, a3, v5, 32);\n  v6 = (char *)-[NSData length](self, \"length\") + 16;\n  v7 = malloc((size_t)v6);\n  v8 = -[NSData bytes](self, \"bytes\");\n  v9 = op;\n  v10 = -[NSData length](self, \"length\");\n  v11 = CCCrypt(op, 0, 3u, key, 0x20u, nullptr, v8, (size_t)v10, v7, (size_t)v6, &dataOutMoved);\n  switch ( v11 )\n  {\n    case -4305:\n      v13 = CFSTR(\"Error: NSData: Could not %s data: Unimplemented\");\n      goto LABEL_13;\n    case -4304:\n      v13 = CFSTR(\"Error: NSData: Could not %s data: Decode error\");\n      goto LABEL_13;\n    case -4303:\n      v13 = CFSTR(\"Error: NSData: Could not %s data: Alignment error\");\n      goto LABEL_13;\n    case -4302:\n      v13 = CFSTR(\"Error: NSData: Could not %s data: Memory failure\");\n      goto LABEL_13;\n    case -4301:\n      v13 = CFSTR(\"Error: NSData: Could not %s data: Buffer too small\");\n      goto LABEL_13;\n    case -4300:\n      v13 = (__CFString *)CFSTR(\"Error: NSData: Could not %s data: Param error\");\n      goto LABEL_13;\n    default:\n      if ( !v11 )\n        return +[NSData dataWithBytesNoCopy:length:](\n                 &OBJC_CLASS___NSData,\n                 \"dataWithBytesNoCopy:length:\",\n                 v7,\n                 dataOutMoved);\n      v13 = CFSTR(\"Error: NSData: Could not %s data: Unknown error\");\nLABEL_13:\n      v15 = \"encrypt\";\n      if ( v9 )\n        v15 = \"decrypt\";\n      v14 = nullptr;\n      NSLog(&v13->isa, v15, v12, (unsigned int)(v11 + 4305));\n      free(v7);\n      return v14;\n  }\n}", "assembly": "; \n; -[NSData makeCryptedVersionWithKeyData:ofLength:decrypt:] from 0x100297100 to 0x100297290 (400 bytes)\n; \n; 1 xrefs:\n; > <???> @ 0x10099a1a8\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    rbp                                                            ; +0x0, 0x100297100\nmov     rbp, rsp                                                       ; +0x1, 0x100297101\npush    r15                                                            ; +0x4, 0x100297104\npush    r14                                                            ; +0x6, 0x100297106\npush    r13                                                            ; +0x8, 0x100297108\npush    r12                                                            ; +0xa, 0x10029710a\npush    rbx                                                            ; +0xc, 0x10029710c\nsub     rsp, 38h                                                       ; +0xd, 0x10029710d\nmov     [rbp+op], r8d                                                  ; +0x11, 0x100297111\nmov     r12, rdi                                                       ; +0x15, 0x100297115\nmov     rax, cs:___stack_chk_guard_ptr                                 ; +0x18, 0x100297118\nmov     rax, [rax]                                                     ; +0x1f, 0x10029711f\nmov     [rbp+var_30], rax                                              ; +0x22, 0x100297122\nxorps   xmm0, xmm0                                                     ; +0x26, 0x100297126\nmovaps  [rbp+var_40], xmm0                                             ; +0x29, 0x100297129\nmovaps  [rbp+key], xmm0                                                ; +0x2d, 0x10029712d\ncmp     ecx, 20h ; ' '                                                 ; +0x31, 0x100297131\nmov     eax, 20h ; ' '                                                 ; +0x34, 0x100297134\ncmovl   eax, ecx                                                       ; +0x39, 0x100297139\ncdqe                                                                   ; +0x3c, 0x10029713c\nlea     rdi, [rbp+key]                                                 ; +0x3e, 0x10029713e\nmov     ecx, 20h ; ' '                                                 ; +0x42, 0x100297142\nmov     rsi, rdx                                                       ; +0x47, 0x100297147\nmov     rdx, rax                                                       ; +0x4a, 0x10029714a\ncall    ___memcpy_chk                                                  ; +0x4d, 0x10029714d\nmov     rsi, cs:selRef_length; SEL                                     ; +0x52, 0x100297152\nmov     rbx, cs:_objc_msgSend_ptr                                      ; +0x59, 0x100297159\nmov     rdi, r12; id                                                   ; +0x60, 0x100297160\ncall    rbx ; _objc_msgSend; -[NSData length] ...                      ; +0x63, 0x100297163\nmov     r13, rax                                                       ; +0x65, 0x100297165\nadd     r13, 10h                                                       ; +0x68, 0x100297168\nmov     rdi, r13; __size                                               ; +0x6c, 0x10029716c\ncall    _malloc                                                        ; +0x6f, 0x10029716f\nmov     r14, rax                                                       ; +0x74, 0x100297174\nmov     rsi, cs:selRef_bytes; SEL                                      ; +0x77, 0x100297177\nmov     rdi, r12; id                                                   ; +0x7e, 0x10029717e\ncall    rbx ; _objc_msgSend; -[NSData bytes] ...                       ; +0x81, 0x100297181\nmov     r15, rax                                                       ; +0x83, 0x100297183\nmov     rdi, r12; id                                                   ; +0x86, 0x100297186\nmov     rsi, cs:selRef_length; SEL                                     ; +0x89, 0x100297189\nmov     r12d, [rbp+op]                                                 ; +0x90, 0x100297190\ncall    rbx ; _objc_msgSend; -[NSData length] ...                      ; +0x94, 0x100297194\nsub     rsp, 8                                                         ; +0x96, 0x100297196\nlea     r10, [rbp+dataOutMoved]                                        ; +0x9a, 0x10029719a\nmov     r8d, 20h ; ' '; keyLength                                      ; +0x9e, 0x10029719e\nmov     edi, r12d; op                                                  ; +0xa4, 0x1002971a4\nxor     esi, esi; alg                                                  ; +0xa7, 0x1002971a7\nmov     edx, 3; options                                                ; +0xa9, 0x1002971a9\nlea     rcx, [rbp+key]; key                                            ; +0xae, 0x1002971ae\nxor     r9d, r9d; iv                                                   ; +0xb2, 0x1002971b2\npush    r10; dataOutMoved                                              ; +0xb5, 0x1002971b5\npush    r13; dataOutAvailable                                          ; +0xb7, 0x1002971b7\npush    r14; dataOut                                                   ; +0xb9, 0x1002971b9\npush    rax; dataInLength                                              ; +0xbb, 0x1002971bb\npush    r15; dataIn                                                    ; +0xbc, 0x1002971bc\ncall    _CCCrypt                                                       ; +0xbe, 0x1002971be\nadd     rsp, 30h                                                       ; +0xc3, 0x1002971c3\nlea     ecx, [rax+10D1h]; switch 6 cases                               ; +0xc7, 0x1002971c7\ncmp     ecx, 5                                                         ; +0xcd, 0x1002971cd\nja      short def_1002971E0; jumptable 00000001002971E0 default case   ; +0xd0, 0x1002971d0\nlea     rax, jpt_1002971E0                                             ; +0xd2, 0x1002971d2\nmovsxd  rcx, (jpt_1002971E0 - 100297290h)[rax+rcx*4]                   ; +0xd9, 0x1002971d9\nadd     rcx, rax                                                       ; +0xdd, 0x1002971dd\njmp     rcx; switch jump                                               ; +0xe0, 0x1002971e0\nlea     rdi, cfstr_ErrorNsdataCou_4; jumptable 00000001002971E0 case -4305 ; +0xe2, 0x1002971e2\njmp     short loc_100297243                                            ; +0xe9, 0x1002971e9\ntest    eax, eax; jumptable 00000001002971E0 default case              ; +0xeb, 0x1002971eb\njnz     short loc_100297221                                            ; +0xed, 0x1002971ed\nmov     rdi, cs:classRef_NSData; id                                    ; +0xef, 0x1002971ef\nmov     rcx, [rbp+dataOutMoved]                                        ; +0xf6, 0x1002971f6\nmov     rsi, cs:selRef_dataWithBytesNoCopy_length_; SEL                ; +0xfa, 0x1002971fa\nmov     rdx, r14                                                       ; +0x101, 0x100297201\ncall    cs:_objc_msgSend_ptr; +[NSData dataWithBytesNoCopy:length:] ... ; +0x104, 0x100297204\nmov     rbx, rax                                                       ; +0x10a, 0x10029720a\njmp     short loc_100297269                                            ; +0x10d, 0x10029720d\nlea     rdi, cfstr_ErrorNsdataCou_0; jumptable 00000001002971E0 case -4301 ; +0x10f, 0x10029720f\njmp     short loc_100297243                                            ; +0x116, 0x100297216\nlea     rdi, cfstr_ErrorNsdataCou_2; jumptable 00000001002971E0 case -4303 ; +0x118, 0x100297218\njmp     short loc_100297243                                            ; +0x11f, 0x10029721f\nlea     rdi, cfstr_ErrorNsdataCou_5; \"Error: NSData: Could not %s data: Unknown error\" ; +0x121, 0x100297221\njmp     short loc_100297243                                            ; +0x128, 0x100297228\nlea     rdi, cfstr_ErrorNsdataCou_1; jumptable 00000001002971E0 case -4302 ; +0x12a, 0x10029722a\njmp     short loc_100297243                                            ; +0x131, 0x100297231\nlea     rdi, cfstr_ErrorNsdataCou_3; jumptable 00000001002971E0 case -4304 ; +0x133, 0x100297233\njmp     short loc_100297243                                            ; +0x13a, 0x10029723a\nlea     rdi, cfstr_ErrorNsdataCou; jumptable 00000001002971E0 case -4300 ; +0x13c, 0x10029723c\nlea     rax, aDecrypt; \"decrypt\"                                       ; +0x143, 0x100297243\nlea     rsi, aEncrypt; \"encrypt\"                                       ; +0x14a, 0x10029724a\ntest    r12b, r12b                                                     ; +0x151, 0x100297251\ncmovnz  rsi, rax                                                       ; +0x154, 0x100297254\nxor     ebx, ebx                                                       ; +0x158, 0x100297258\nxor     eax, eax                                                       ; +0x15a, 0x10029725a\ncall    _NSLog                                                         ; +0x15c, 0x10029725c\nmov     rdi, r14; void *                                               ; +0x161, 0x100297261\ncall    _free                                                          ; +0x164, 0x100297264\nmov     rax, cs:___stack_chk_guard_ptr                                 ; +0x169, 0x100297269\nmov     rax, [rax]                                                     ; +0x170, 0x100297270\ncmp     rax, [rbp+var_30]                                              ; +0x173, 0x100297273\njnz     short loc_10029728B                                            ; +0x177, 0x100297277\nmov     rax, rbx                                                       ; +0x179, 0x100297279\nadd     rsp, 38h                                                       ; +0x17c, 0x10029727c\npop     rbx                                                            ; +0x180, 0x100297280\npop     r12                                                            ; +0x181, 0x100297281\npop     r13                                                            ; +0x183, 0x100297283\npop     r14                                                            ; +0x185, 0x100297285\npop     r15                                                            ; +0x187, 0x100297287\npop     rbp                                                            ; +0x189, 0x100297289\nretn                                                                   ; +0x18a, 0x10029728a\ncall    ___stack_chk_fail                                              ; +0x18b, 0x10029728b", "xrefs": ["<???> @ 0x10099a1a8"], "is_objc": true, "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"}