{"type": "func", "start": 10409984, "end": 10410344, "name": "BUF_MEM_grow", "pseudocode": "// \n// BUF_MEM_grow from 0x9ed800 to 0x9ed968 (360 bytes)\n// \n// 18 xrefs:\n// > sub_9B3990 @ 0x9b42bc\n// > tls_construct_new_session_ticket @ 0x9c14e8\n// > tls_construct_cert_status @ 0x9c1904\n// > DTLSv1_listen @ 0x9cb8a8\n// > PEM_read_bio @ 0xa372ec\n// > PEM_read_bio @ 0xa37378\n// > PEM_read_bio @ 0xa37410\n// > PEM_read_bio @ 0xa374dc\n// > PEM_read_bio @ 0xa376dc\n// > TXT_DB_read @ 0xa4db54\n// > sub_A50C74 @ 0xa50d98\n// > X509_NAME_oneline @ 0xa551f8\n// > X509_NAME_oneline @ 0xa554ac\n// > sub_A5E8C8 @ 0xa5e9e0\n// > sub_A5EB20 @ 0xa5ec28\n// > sub_A8D7E4 @ 0xa8d818\n// > sub_A8DDC0 @ 0xa8df54\n// > <???> @ 0x7687c\n// \n// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 12:07:27 +0000\n// \n\nunsigned int __fastcall BUF_MEM_grow(size_t *a1, unsigned int a2)\n{\n  size_t v2; // r2\n  size_t v5; // r0\n  unsigned int v7; // r7\n  void *v8; // r0\n  const void *v9; // r1\n  int v10; // r6\n  size_t v11; // r2\n\n  v2 = *a1;\n  if ( *a1 >= a2 )\n    goto LABEL_5;\n  if ( a2 <= a1[2] )\n  {\n    v5 = a1[1];\n    if ( v5 )\n      memset((void *)(v5 + v2), 0, a2 - v2);\nLABEL_5:\n    *a1 = a2;\n    return a2;\n  }\n  if ( a2 > 0x5FFFFFFC )\n  {\n    ERR_put_error(7, 100, 65, \"crypto/buffer/buffer.c\", 89);\n    return 0;\n  }\n  else\n  {\n    v7 = 4 * ((a2 + 3) / 3);\n    if ( (a1[3] & 1) != 0 )\n    {\n      v8 = (void *)CRYPTO_secure_malloc(4 * ((a2 + 3) / 3), \"crypto/buffer/buffer.c\", 63);\n      v9 = (const void *)a1[1];\n      v10 = (int)v8;\n      if ( v9 )\n      {\n        if ( v8 )\n        {\n          memcpy(v8, v9, *a1);\n          v9 = (const void *)a1[1];\n        }\n        CRYPTO_secure_free(v9, \"crypto/buffer/buffer.c\", 67);\n      }\n    }\n    else\n    {\n      v10 = CRYPTO_realloc(a1[1], 4 * ((a2 + 3) / 3), \"crypto/buffer/buffer.c\", 96);\n    }\n    if ( v10 )\n    {\n      v11 = *a1;\n      a1[1] = v10;\n      a1[2] = v7;\n      memset((void *)(v10 + v11), 0, a2 - v11);\n      *a1 = a2;\n      return a2;\n    }\n    else\n    {\n      ERR_put_error(7, 100, 65, \"crypto/buffer/buffer.c\", 98);\n      return 0;\n    }\n  }\n}", "assembly": "; \n; BUF_MEM_grow from 0x9ed800 to 0x9ed968 (360 bytes)\n; \n; 18 xrefs:\n; > sub_9B3990 @ 0x9b42bc\n; > tls_construct_new_session_ticket @ 0x9c14e8\n; > tls_construct_cert_status @ 0x9c1904\n; > DTLSv1_listen @ 0x9cb8a8\n; > PEM_read_bio @ 0xa372ec\n; > PEM_read_bio @ 0xa37378\n; > PEM_read_bio @ 0xa37410\n; > PEM_read_bio @ 0xa374dc\n; > PEM_read_bio @ 0xa376dc\n; > TXT_DB_read @ 0xa4db54\n; > sub_A50C74 @ 0xa50d98\n; > X509_NAME_oneline @ 0xa551f8\n; > X509_NAME_oneline @ 0xa554ac\n; > sub_A5E8C8 @ 0xa5e9e0\n; > sub_A5EB20 @ 0xa5ec28\n; > sub_A8D7E4 @ 0xa8d818\n; > sub_A8DDC0 @ 0xa8df54\n; > <???> @ 0x7687c\n; \n; This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 12:07:27 +0000\n; \nLDR             R2, [R0]                                               ; +0x0, 0x9ed800\nPUSH            {R4-R7,LR}                                             ; +0x4, 0x9ed804\nCMP             R2, R1                                                 ; +0x8, 0x9ed808\nSUB             SP, SP, #0xC                                           ; +0xc, 0x9ed80c\nMOV             R5, R0                                                 ; +0x10, 0x9ed810\nMOV             R4, R1                                                 ; +0x14, 0x9ed814\nBCS             loc_9ED844                                             ; +0x18, 0x9ed818\nLDR             R3, [R0,#8]                                            ; +0x1c, 0x9ed81c\nCMP             R1, R3                                                 ; +0x20, 0x9ed820\nBHI             loc_9ED854                                             ; +0x24, 0x9ed824\nLDR             R0, [R0,#4]                                            ; +0x28, 0x9ed828\nCMP             R0, #0                                                 ; +0x2c, 0x9ed82c\nBEQ             loc_9ED844                                             ; +0x30, 0x9ed830\nADD             R0, R0, R2; void *                                     ; +0x34, 0x9ed834\nRSB             R2, R2, R1; size_t                                     ; +0x38, 0x9ed838\nMOV             R1, #0; int                                            ; +0x3c, 0x9ed83c\nBL              memset                                                 ; +0x40, 0x9ed840\nMOV             R0, R4                                                 ; +0x44, 0x9ed844\nSTR             R4, [R5]                                               ; +0x48, 0x9ed848\nADD             SP, SP, #0xC                                           ; +0x4c, 0x9ed84c\nPOP             {R4-R7,PC}                                             ; +0x50, 0x9ed850\nCMN             R1, #0xA0000004                                        ; +0x54, 0x9ed854\nBHI             loc_9ED918                                             ; +0x58, 0x9ed858\nLDR             R3, =0xAAAAAAAB                                        ; +0x5c, 0x9ed85c\nADD             R7, R1, #3                                             ; +0x60, 0x9ed860\nUMULL           R2, R7, R3, R7                                         ; +0x64, 0x9ed864\nLDR             R3, [R0,#0xC]                                          ; +0x68, 0x9ed868\nMOV             R7, R7,LSR#1                                           ; +0x6c, 0x9ed86c\nTST             R3, #1                                                 ; +0x70, 0x9ed870\nMOV             R7, R7,LSL#2                                           ; +0x74, 0x9ed874\nBEQ             loc_9ED8CC                                             ; +0x78, 0x9ed878\nLDR             R1, =(aCryptoBufferBu - 0x9ED88C); \"crypto/buffer/buffer.c\" ; +0x7c, 0x9ed87c\nMOV             R0, R7                                                 ; +0x80, 0x9ed880\nADD             R1, PC, R1; \"crypto/buffer/buffer.c\"                   ; +0x84, 0x9ed884\nMOV             R2, #0x3F ; '?'                                        ; +0x88, 0x9ed888\nBL              CRYPTO_secure_malloc                                   ; +0x8c, 0x9ed88c\nLDR             R1, [R5,#4]; void *                                    ; +0x90, 0x9ed890\nCMP             R1, #0                                                 ; +0x94, 0x9ed894\nMOV             R6, R0                                                 ; +0x98, 0x9ed898\nBEQ             loc_9ED8E8                                             ; +0x9c, 0x9ed89c\nCMP             R0, #0                                                 ; +0xa0, 0x9ed8a0\nBEQ             loc_9ED8B4                                             ; +0xa4, 0x9ed8a4\nLDR             R2, [R5]; size_t                                       ; +0xa8, 0x9ed8a8\nBL              memcpy                                                 ; +0xac, 0x9ed8ac\nLDR             R1, [R5,#4]                                            ; +0xb0, 0x9ed8b0\nMOV             R0, R1                                                 ; +0xb4, 0x9ed8b4\nLDR             R1, =(aCryptoBufferBu - 0x9ED8C8); \"crypto/buffer/buffer.c\" ; +0xb8, 0x9ed8b8\nMOV             R2, #0x43 ; 'C'                                        ; +0xbc, 0x9ed8bc\nADD             R1, PC, R1; \"crypto/buffer/buffer.c\"                   ; +0xc0, 0x9ed8c0\nBL              CRYPTO_secure_free                                     ; +0xc4, 0x9ed8c4\nB               loc_9ED8E8                                             ; +0xc8, 0x9ed8c8\nLDR             R2, =(aCryptoBufferBu - 0x9ED8E0); \"crypto/buffer/buffer.c\" ; +0xcc, 0x9ed8cc\nLDR             R0, [R0,#4]                                            ; +0xd0, 0x9ed8d0\nMOV             R1, R7                                                 ; +0xd4, 0x9ed8d4\nADD             R2, PC, R2; \"crypto/buffer/buffer.c\"                   ; +0xd8, 0x9ed8d8\nMOV             R3, #0x60 ; '`'                                        ; +0xdc, 0x9ed8dc\nBL              CRYPTO_realloc                                         ; +0xe0, 0x9ed8e0\nMOV             R6, R0                                                 ; +0xe4, 0x9ed8e4\nCMP             R6, #0                                                 ; +0xe8, 0x9ed8e8\nBEQ             loc_9ED940                                             ; +0xec, 0x9ed8ec\nLDR             R2, [R5]                                               ; +0xf0, 0x9ed8f0\nSTMIB           R5, {R6,R7}                                            ; +0xf4, 0x9ed8f4\nADD             R0, R6, R2; void *                                     ; +0xf8, 0x9ed8f8\nMOV             R1, #0; int                                            ; +0xfc, 0x9ed8fc\nRSB             R2, R2, R4; size_t                                     ; +0x100, 0x9ed900\nBL              memset                                                 ; +0x104, 0x9ed904\nMOV             R0, R4                                                 ; +0x108, 0x9ed908\nSTR             R4, [R5]                                               ; +0x10c, 0x9ed90c\nADD             SP, SP, #0xC                                           ; +0x110, 0x9ed910\nPOP             {R4-R7,PC}                                             ; +0x114, 0x9ed914\nMOV             R3, #0x59 ; 'Y'                                        ; +0x118, 0x9ed918\nSTR             R3, [SP,#0xC+var_C]                                    ; +0x11c, 0x9ed91c\nLDR             R3, =(aCryptoBufferBu - 0x9ED938); \"crypto/buffer/buffer.c\" ; +0x120, 0x9ed920\nMOV             R0, #7                                                 ; +0x124, 0x9ed924\nMOV             R1, #0x64 ; 'd'                                        ; +0x128, 0x9ed928\nMOV             R2, #0x41 ; 'A'                                        ; +0x12c, 0x9ed92c\nADD             R3, PC, R3; \"crypto/buffer/buffer.c\"                   ; +0x130, 0x9ed930\nBL              ERR_put_error                                          ; +0x134, 0x9ed934\nMOV             R0, #0                                                 ; +0x138, 0x9ed938\nB               loc_9ED84C                                             ; +0x13c, 0x9ed93c\nMOV             R3, #0x62 ; 'b'                                        ; +0x140, 0x9ed940\nSTR             R3, [SP,#0xC+var_C]                                    ; +0x144, 0x9ed944\nLDR             R3, =(aCryptoBufferBu - 0x9ED960); \"crypto/buffer/buffer.c\" ; +0x148, 0x9ed948\nMOV             R0, #7                                                 ; +0x14c, 0x9ed94c\nMOV             R1, #0x64 ; 'd'                                        ; +0x150, 0x9ed950\nMOV             R2, #0x41 ; 'A'                                        ; +0x154, 0x9ed954\nADD             R3, PC, R3; \"crypto/buffer/buffer.c\"                   ; +0x158, 0x9ed958\nBL              ERR_put_error                                          ; +0x15c, 0x9ed95c\nMOV             R0, R6                                                 ; +0x160, 0x9ed960\nB               loc_9ED84C                                             ; +0x164, 0x9ed964", "xrefs": ["sub_9B3990 @ 0x9b42bc", "tls_construct_new_session_ticket @ 0x9c14e8", "tls_construct_cert_status @ 0x9c1904", "DTLSv1_listen @ 0x9cb8a8", "PEM_read_bio @ 0xa372ec", "PEM_read_bio @ 0xa37378", "PEM_read_bio @ 0xa37410", "PEM_read_bio @ 0xa374dc", "PEM_read_bio @ 0xa376dc", "TXT_DB_read @ 0xa4db54", "sub_A50C74 @ 0xa50d98", "X509_NAME_oneline @ 0xa551f8", "X509_NAME_oneline @ 0xa554ac", "sub_A5E8C8 @ 0xa5e9e0", "sub_A5EB20 @ 0xa5ec28", "sub_A8D7E4 @ 0xa8d818", "sub_A8DDC0 @ 0xa8df54", "<???> @ 0x7687c"], "is_objc": false, "is_32_bit": true, "is_64_bit": false, "idp_name": "arm", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}