## 4 Proposed Method
### Hybrid Information Integrity Monitoring Architecture  
By monitoring DI and CFI, the HIIMA proposed in this paper combines the DI protection mechanism with the CFI protection mechanism, and can protect the embedded systems' key data from being tampered with or their control flow hijacked by any attackers when executing programs. The OR1200 processor is selected as the CPU Core, which has an in-order five-stage pipeline consisting of the instruction fetch (IF) stage, the instruction decode (ID) stage, the execution (EX) stage, the memory access (MA) stage, and the write-back (WB) stage. To protect the CPU Core, the HMM will monitor OR1200 pipeline signals, especially the signals of the program counter (PC) and the instruction register (IR). In Figure 3, when the program is offline, through the BB extraction process shown in Figure 1, the detailed information about each BB is generated, including the start address, the end address, the binary code of all internal instructions, and the only jump instruction. By processing this information, we obtain the 64-bit hybrid integrity reference information (HIREF) of each BB, the function entry address bitmap (FE\({}_{\text{Address}}\) Bitmap), and the BB start address bitmap (BB\({}_{\text{Address}}\) Bitmap). The HI\({}_{\text{REF}}\) includes the 16-bit start address of the BB (BB\({}_{\text{Start}}\)), the 16-bit integrity digest calculated by an LHash algorithm (LHash\({}_{\text{Static}}\)), the 16-bit control flow integrity label (CFI\({}_{\text{label}}\)), and the 16-bit special Hamming distance (HD\({}_{\text{special}}\)). Figure 3: The structure of the Hybrid Information Integrity Monitoring Architecture. If all the values of PC are included in the HIREF, it will cause a large storage overhead. Therefore, HIIMA only monitors the lower 16 bits of PC, which means BBstart has only 16 bits. Since the actual useful value of the start address is PC [31:2], the address extracted by the HMM at runtime is PC [17:2]. This will provide programmers with up to 256 KB of addressable space. For applications with a larger amount of code, it is necessary to increase the width of BBstart. The binary code of all instructions in the BB is processed through the hash function (LHash) [33] to obtain an integrity digest (LHashstatic). Once an attacker tampered with key data, such as instructions or static variables, the binary code of the BB will be changed. LHash guarantees that in this case, the digest must also change. Therefore, HMM can determine whether the data has been tampered with by checking whether the integrity digest has changed. Figure 1 and Table 1 illustrate that the target address of the direct jump instruction can be put forward through static analysis. These target addresses correspond to the start address of BBs. Linking these BBs according to the target address can construct the control flow graph (CFG). After algorithm processing, each BB in the CFG can be assigned a CFI label (CFIlabel). By calculating the Hamming distance (HD) between each CFIlabel, the execution order of BBs can be known. In addition, the Hamming distance information, in some special cases (HDspecial), should also be recorded. Since the target address of the indirect jump instruction cannot be obtained through static analysis, these instructions are protected by limiting the target address range. In this paper, we restrict the target address of an indirect jump instruction to only be the start address of a BB, and the target address of an indirect function call instruction can only be the entry address of a function. Through the bitmap algorithm, we map the legal target address into the FEAddress Bitmap and the BBAddress Bitmap. When the binary file of the source program is loaded onto the Flash, all HIREF will be stored in the Integrity Parameter Memory of the HMM in ascending order in a secure loading manner. In addition, the FEAddress Bitmap and BBAddress Bitmap will also be stored in the Bitmap Memory in a secure loading manner.