A data exchange method and system based on a composite executable environment
Patent Information
- Application Number
- CN202610778987.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-02
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2046-06-02
AI Technical Summary
[0027]为此,本申请提供一种基于复合可执行环境的数据交换方法及系统,以解决现有技术存在的TEE在恶意环境下容易泄露可信计算内部资源的问题
[0087]本申请提供了一种基于复合可执行环境的数据交换方法,包括:由用户执行单元通过其内部的输入输出代理发起数据交换请求,并提交至外部数据交换单元的数据交换区,标记对应的请求标志;外部数据交换单元检测到请求标志后,对数据交换请求进行合法性判断;在数据交换过程中,外部数据交换单元分别与用户执行单元和外部主机之间进行独立的数据加解密处理;外部数据交换单元将交换后的数据通过其内部私有区域进行中转,并完成数据在不同数据区域间的安全搬移;硬件监控单元对数据交换的全过程进行监管,并根据执行状态更新对应的状态控制寄存器。该方法统通过构建一个包含监控管理、数据交换、用户代码执行各自独立运行的复合可信执行环境,通过主动对外访问与主机环境形成双向数据安全监控与双向程序交互,实现复合环境与主机环境的双向安全保证,防止了TEE在恶意环境下泄露关联信息,并实现两者的IO独立、计算资源独立、存储独立、加密独立和数据隔离。
Smart Images

Figure CN122333506B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of trusted execution environment technology, specifically to a data exchange method and system based on a composite executable environment. Background Technology
[0002] A Trusted Execution Environment (TEE) is a secure area on the main processor that runs in parallel with the device's regular operating system (i.e., a Rich Execution Environment, or REE). The core objective of a TEE is to ensure the confidentiality and integrity of code and data. Therefore, code running and data processed within a TEE cannot be accessed by the external operating system (REE) or any malware. Furthermore, a TEE ensures that its internal code is not tampered with and runs as intended.
[0003] Currently, TEE solutions are mainly divided into three types: In the mobile terminal field, ARM TrustZone has become the most mainstream architecture due to its hardware isolation mechanism, and almost all ARM architecture mobile SoCs are based on it to build a secure world; In the data center and PC field, Intel SGX focuses on application layer protection, allowing programs to create independent "enclaves" in memory to prevent data leakage; while AMD SEV focuses on virtualization environments, ensuring that cloud data remains secure when the underlying infrastructure is threatened by providing memory encryption for virtual machines.
[0004] However, existing TEE solutions have the following drawbacks:
[0005] 1. Side-channel vulnerability: Leaking confidential information by exploiting hardware resource sharing.
[0006] Intel SGX's Enclave shares hardware resources such as CPU cache, memory bus, and power supply with untrusted components (OS, Hypervisor). Attackers can reverse engineer sensitive information within the Enclave by observing resource usage patterns. This is the most frequent and widespread type of vulnerability in SGX, for example:
[0007] (1) SgxPectre (Spectre derivative vulnerability): This vulnerability utilizes the CPU speculative execution mechanism to induce the Enclave to execute out-of-bounds instructions by constructing a special memory access sequence, thereby leaking sensitive data (such as keys) to the cache side channel. This allows all Intel processors that support SGX (such as Skylake and Cascade Lake) to steal AES keys, RSA private keys, etc. from the Enclave.
[0008] (2) Edger8r tool side channel (CVE-2018-3626): In this vulnerability, the Edger8r tool of the SGX SDK (which generates Enclave interface code) generates C code with secret-dependent memory access when processing the string / size func attribute. Attackers can extract sensitive data (such as user passwords) through cache timing differences. Enclaves developed using older SDK versions (Linux < 2.1.2, Windows < 1.9.6) affect financial payment and password management applications.
[0009] (3) TEE.fail memory bus side channel (Wiretap / Battering RAM): In this vulnerability, SGX uses deterministic AES-XTS encryption (the same plaintext corresponds to a fixed ciphertext). Attackers can capture the encrypted ciphertext of the Enclave by physically intervening in the DDR4 memory bus (inserting a low-cost probe), build a "ciphertext-plaintext" mapping table, and reverse recover sensitive data. The 3rd / 4th Gen Xeon processor (DDR4 platform) can steal AI model parameters, database plaintext and remote proof key (PCK) in the Enclave.
[0010] 2. Hardware design flaws: Privilege escalation and memory overflow
[0011] Hardware implementation flaws in Intel SGX (such as memory controller configuration and permission verification logic) can allow attackers to directly breach the Enclave isolation boundary, achieving local privilege escalation or unauthorized access to Enclave memory. For example:
[0012] (1) Memory controller privilege lapse (CVE-2024-23918): In this vulnerability, the SGX memory controller of some Xeon processors (3rd / 4th / 5th Gen) has a "missing condition check". Privileged users (such as root) can bypass physical memory protection (PMP) by constructing special memory requests and access the private memory area of the Enclave. Xeon processors that support SGX (CPU ID: 606a6, 806f7, etc.) can achieve privilege escalation, execute code within the Enclave, or steal data.
[0013] (2) Incorrect Default Permission Configuration (CVE-2024-21820): The default permission settings for the SGX memory controller are incorrect. High-privilege users (PR:H) can modify the memory access attributes of the Enclave (such as changing "read-only" to "writable") and inject malicious code into the Enclave. In this vulnerability, the 4th / 5th Gen Xeon processor (DDR4 / DDR5 platform) affects cloud multi-tenant scenarios, and malicious tenants can tamper with data in other Enclaves.
[0014] (3) Privilege Escalation Vulnerability (CVE-2017-5736): The SGX Platform Software Component (PSW) contains a logical flaw in its handling of Enclave lifecycle management. A local attacker can exploit this vulnerability to execute arbitrary code and gain administrator privileges (SYSTEM / root). On all SGX platforms (Windows / Linux), PSW version <1.9.105.42329 can take over the entire SGX system and control all Enclaves.
[0015] 3. Exception and signal injection vulnerabilities: compromising the integrity of Enclave execution.
[0016] SGX's exception handling mechanism (such as hardware exceptions and signal propagation) has a design flaw. Attackers can inject malicious exceptions or signals to interfere with the Enclave's execution flow or even tamper with data within the Enclave. A typical example is the Sigy attack (i.e., the Sigy signal injection vulnerability): In this vulnerability, the SGX SDK allows the Enclave to register hardware exception (such as division by zero errors) and signal (such as SIGFPE) handling functions, but the exception / signal propagation process relies on an untrusted OS and runtime (URT). Attackers can inject forged signals into the Enclave thread through the OS, triggering unexpected processing logic within the Enclave, leading to data leakage or execution flow hijacking. In this vulnerability, all platforms supporting SGX, relying on the Intel SGX SDK or third-party library OS (such as Graphene-SGX), can compromise the transaction signature integrity of the blockchain Enclave or tamper with AI inference results.
[0017] 4. Security Risk Analysis of Traditional USB Secure and Trusted Environments
[0018] A typical example of a secure and trusted USB environment is the USB dongle. As a crucial means of software protection, the security threats posed by this dongle have continuously evolved with technological advancements. Early attacks primarily focused on simple software-level debugging and memory modification. However, with the maturation of hardware reverse engineering techniques, attackers have begun employing more sophisticated physical attack methods.
[0019] From a timeline perspective, the attack techniques have gone through three main stages. The first stage (2000-2010) focused on software debugging, with attackers using debugging tools such as SoftICE to trace the decryption process. The second stage (2010-2020) saw the rise of hardware cloning techniques, particularly targeting domestically produced dongles using general-purpose chips. The third stage (2020-present) has seen the emergence of more sophisticated side-channel attacks and fault injection attacks, such as the EUCLEAK attack against YubiKey.
[0020] Modern attack techniques are becoming increasingly specialized and automated. Attack tools have evolved from simple debuggers to professional firmware extraction devices and side-channel analysis platforms, significantly increasing attack success rates. Simultaneously, the cost of attacks is decreasing, enabling more attackers to carry out complex cracking activities.
[0021] USB dongles face threats from multiple dimensions, creating a complex attack surface. From the perspective of the attack's origin, they mainly fall into three categories: host-side attacks, communication link attacks, and hardware physical attacks.
[0022] The host-side attack surface is the most extensive, encompassing various techniques such as API hooking, memory patching, and process injection. Attackers intercept API calls between the software and the dongle, redirecting these calls to a custom implementation to achieve imitation. This attack method does not require physical contact with the dongle, making it highly stealthy.
[0023] Communication link attacks primarily target the USB protocol layer, with attackers using USB packet sniffing tools to capture communication data between the dongle and the host. Due to the open nature of the USB protocol, the technical barrier to this type of attack is relatively low, but it requires a deep understanding of the specific dongle communication protocol.
[0024] Hardware physical attacks require direct contact with the target device, obtaining internal data through methods such as disassembly, chip reading, and fault injection. These attacks have the highest technical barrier, but also a relatively high success rate, especially against products with inadequate security measures.
[0025] Therefore, the main problems of a USB-based TEE environment include: the TEE on USB cannot detect host attacks; the communication protocol between the TEE environment and the host has poor security protection and is easily attacked; and the TEE environment itself has insufficient security protection measures and is vulnerable to attacks.
[0026] In summary, the key security risk of the aforementioned trusted execution environment is that hardware resource sharing prevents the insecure system from being completely isolated from the secure system, allowing external entities to obtain internal resources of trusted computing through association. Summary of the Invention
[0027] To address this issue, this application provides a data exchange method and system based on a composite executable environment, in order to solve the problem that existing TEEs are prone to leaking trusted computing internal resources in malicious environments.
[0028] To achieve the above objectives, this application provides the following technical solution:
[0029] Firstly, a data exchange method based on a composite executable environment includes:
[0030] Step 1: The user execution unit initiates a data exchange request through its internal input / output proxy;
[0031] Step 2: The input / output agent submits the data exchange request to the data exchange area of the external data exchange unit and marks the corresponding request flag;
[0032] Step 3: After detecting the request flag, the external data exchange unit performs a validity check on the data exchange request; if valid, it executes the data exchange operation; otherwise, it returns an error and notifies the hardware monitoring unit.
[0033] Step 4: During the data exchange process, the external data exchange unit performs independent data encryption and decryption processes with the user execution unit and the external host, respectively; wherein the keys used for encryption and decryption are dynamically configured by the hardware monitoring unit.
[0034] Step 5: The external data exchange unit will transfer the exchanged data through its internal private area and complete the secure transfer of data between different data areas;
[0035] Step 6: The hardware monitoring unit monitors the entire data exchange process and updates the corresponding status control register according to the execution status to realize resource management and security control of the user execution unit and the external data exchange unit.
[0036] Step 7: The hardware monitoring unit sends a detection command to the predetermined execution space of the external host through the external data exchange unit, and determines whether the external host has malicious behavior based on the response data; if malicious behavior is found, the current data exchange operation is immediately terminated and the external data access area of the external data exchange unit is locked.
[0037] Optionally, before data exchange, the process further includes: a user environment loading process, which includes:
[0038] Step A1: The external data exchange unit receives the user program and associated data, and receives the execution request;
[0039] Step A2: After performing a basic security check on the execution request, the external data exchange unit sends the execution request to the hardware monitoring unit;
[0040] Step A3: The hardware monitoring unit selects the target user execution unit based on the status control register of the user execution unit group;
[0041] Step A4: The hardware monitoring unit configures the security policies related to the external data exchange unit and the target user execution unit; the security policies include data firewall inspection policies, encryption and decryption keys, data channel I / O, storage management policies, and secure access scope;
[0042] Step A5: The external data exchange unit performs signature verification and integrity checks on the data loaded by the user. After confirming the integrity, it proceeds to the encryption / decryption process.
[0043] Step A6: The external data exchange unit decrypts the user data, obtains the plaintext data, and temporarily stores it in its internal private area;
[0044] Step A7: The hardware monitoring unit generates a random base key for the target user execution unit. The external data exchange unit uses the key to encrypt the required data and then loads it into the storage area of the target user execution unit through the input / output agent to start the execution process.
[0045] Optionally, the initiation and execution process includes:
[0046] The target user execution unit requests the data key from the hardware monitoring unit through a dedicated channel, decrypts the corresponding data and instructions locally, and then starts execution; when the target user execution unit finishes execution, it indicates the execution status through the status control register.
[0047] Optionally, when the data exchange request is a data read request, the data exchange operation includes:
[0048] Step B1: The external data exchange unit converts the requested data address into the real address for external access and performs a validity check based on the data length;
[0049] Step B2: After the legality check is passed, the external data exchange unit puts the data read request into the read queue and notifies the external host through interrupt or polling.
[0050] Step B3: The external host reads the corresponding data according to the read queue command, encrypts it according to the agreed key, places it in the external data access area of the external data exchange unit, and sets a data completion flag;
[0051] Step B4: After the external data exchange unit detects the data completion flag, it moves the encrypted data to its internal private area and clears the relevant data in the external data access area;
[0052] Step B5: The external data exchange unit obtains the decryption key through the hardware monitoring unit, decrypts the encrypted data, and then encrypts it again using the user execution unit key configured by the hardware monitoring unit to form the user execution unit ciphertext data.
[0053] Step B6: The external data exchange unit moves the encrypted data of the user execution unit to the data exchange area and notifies the hardware monitoring unit through the status control register;
[0054] Step B7: After the input / output agent detects the data reading completion flag, it moves the encrypted data of the user execution unit into the user execution unit, and obtains the data key through the hardware monitoring unit to decrypt it, and then submits the returned data to the user execution unit.
[0055] Optionally, when the data exchange request is a data write request, the data exchange operation includes:
[0056] Step C1: The input / output agent performs a legality check on the data to be written. If the check passes, it requests a security key from the hardware monitoring unit through the status control register, and uses the security key to encrypt the data to be written. The encrypted data is then submitted to the data exchange area of the external data exchange unit and marked with a write flag.
[0057] Step C2: After the external data exchange unit detects the write flag, it converts the requested data address into the real address for external access and performs a validity check based on the data length.
[0058] Step C3: After the legality check is passed, the external data exchange unit obtains the decryption key for the written data through the status control register, decrypts the contents of the data exchange area, and stores the decryption result in its internal private area.
[0059] Step C4: The external data exchange unit obtains the user key through the hardware monitoring unit, encrypts the decryption result to form external host encrypted data, and moves the external host encrypted data to the external data access area;
[0060] Step C5: The external data exchange unit notifies the external host to read data via interrupt or polling.
[0061] Step C6: After the external host reads and decrypts the encrypted data, it sets a data completion flag;
[0062] Step C7: After the external data exchange unit detects the data completion flag, it clears the relevant data in the external data access area and the internal private area, and updates the status control register to indicate that the write is complete.
[0063] Optionally, after the data exchange is completed, the hardware monitoring unit performs resource management on the user execution unit, specifically including:
[0064] Step D1: The hardware monitoring unit, according to the indication of the status control register, notifies the input / output agent to encrypt the execution result and move it to the data exchange area of the external data exchange unit;
[0065] Step D2: The external data exchange unit decrypts the execution result and converts it into data encrypted with the user key, which is then temporarily stored in its internal private area;
[0066] Step D3: The hardware monitoring unit configures the user execution unit to start the data clearing process, which includes clearing data, code, configuration keys and intermediate state data;
[0067] Step D4: After the user execution unit completes the cleanup, it notifies the hardware monitoring unit through the status control register so that the user execution unit can provide services for the next program execution.
[0068] Optionally, it further includes: the hardware monitoring unit actively performs security detection, specifically including:
[0069] Step E1: When the user execution unit needs to read or write data to the external host, the hardware monitoring unit simultaneously initiates an environment detection access to the external host.
[0070] Step E2: The hardware monitoring unit, by configuring the control unit of the external data exchange unit, detects the read and write status of the external host in the same data access mode as the user execution unit;
[0071] Step E3: The hardware monitoring unit determines whether the external host environment is safe and reliable based on the detection results;
[0072] Step E4: If the judgment result indicates that there is a security risk, the hardware monitoring unit will prevent the user from accessing the unit until the external host environment is detected as reliable.
[0073] Optionally, the hardware monitoring unit synchronously initiates environment detection access to the external host, including encrypted access mode and unencrypted access mode; when using encrypted access mode, the user execution unit is configured with a user encryption module for encrypted communication with the external host; when using unencrypted access mode, the external data exchange unit internally converts plaintext data into ciphertext.
[0074] Optionally, it also includes the result output and cleaning process of the external data exchange unit, specifically including:
[0075] Step F1: The external data exchange unit moves the execution result from the internal private area to the external data access area and notifies the user to read the execution result;
[0076] Step F2: After the user completes the result reading, notify the external data exchange unit;
[0077] Step F3: The external data exchange unit clears the data, keys, and cache associated with the current user execution unit in the external data access area and the internal private area;
[0078] Step F4: The external data exchange unit informs the hardware monitoring unit that the resource release is complete through the status control register, so that the hardware monitoring unit can determine whether the IO resources of the user execution unit have been completely released.
[0079] Secondly, a data exchange system based on a composite executable environment, the data exchange system being used in the aforementioned data exchange method based on a composite executable environment, comprising:
[0080] Hardware monitoring unit, used to perform security management and monitoring;
[0081] The external data exchange unit is used to interact with external hosts. Its exposed data access area is divided into an external data access area, a data exchange area, a hardware monitoring unit control and management area, and an internal private area.
[0082] A user execution unit group, comprising at least one user execution unit for executing user programs;
[0083] The hardware monitoring unit, the external data exchange unit, and the user execution unit group operate independently of each other, and form a composite trusted execution environment through secure sharing.
[0084] The external host can only access the external data access area of the external data exchange unit;
[0085] The hardware monitoring unit cannot directly access the external data access area, but it can move external host data to the data area accessible by the hardware monitoring unit by configuring the control unit of the external data exchange unit.
[0086] Compared with the prior art, this application has at least the following beneficial effects:
[0087] This application provides a data exchange method based on a composite executable environment (TEE), comprising: a user execution unit (TAU) initiating a data exchange request through its internal input / output agent and submitting it to the data exchange area of an external data exchange unit, marking the corresponding request flag; the external data exchange unit detecting the request flag and performing a validity check on the data exchange request; during the data exchange process, the external data exchange unit performs independent data encryption and decryption processing with both the user execution unit and the external host; the external data exchange unit relays the exchanged data through its internal private area and completes the secure transfer of data between different data areas; and a hardware monitoring unit monitors the entire data exchange process and updates the corresponding status control register according to the execution status. This method constructs a composite trusted execution environment (TEE) that includes independent operation of monitoring management, data exchange, and user code execution. Through proactive external access, it establishes bidirectional data security monitoring and bidirectional program interaction with the host environment, achieving bidirectional security assurance between the composite environment and the host environment. This prevents the TEE from leaking related information in a malicious environment and achieves I / O independence, computational resource independence, storage independence, encryption independence, and data isolation between the two environments. Attached Figure Description
[0088] To more intuitively illustrate the prior art and this application, exemplary drawings are provided below. It should be understood that the specific shapes and structures shown in the drawings should not generally be regarded as limiting conditions for implementing this application; for example, based on the technical concept disclosed in this application and the exemplary drawings, those skilled in the art are able to easily make conventional adjustments or further optimizations to the addition / reduction / classification, specific shapes, positional relationships, connection methods, size ratios, etc. of certain units (components).
[0089] Figure 1 A flowchart of a data exchange method based on a composite executable environment is provided in Embodiment 1 of this application;
[0090] Figure 2 This is a schematic diagram of a data exchange system based on a composite executable environment, provided in Embodiment 2 of this application. Detailed Implementation
[0091] The present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0092] In the description of this application: unless otherwise stated, "a plurality of" means two or more. The terms "first," "second," "third," etc., in this application are intended to distinguish the objects referred to and do not have any special meaning in terms of technical connotation (e.g., they should not be construed as an emphasis on importance or order). Expressions such as "including," "comprising," and "having" also mean "not limited to" (certain units, components, materials, steps, etc.).
[0093] The terms used in this application, such as "upper," "lower," "left," "right," and "middle," are generally used to indicate the general relative positional relationship for the purpose of intuitive understanding by referring to the accompanying drawings, and are not absolute limitations on the positional relationship in the actual product.
[0094] Example 1
[0095] In response to attacks such as hardware resource sharing leading to confidentiality leaks, privilege escalation and memory overflows, and disruption of Enclave execution integrity, this embodiment provides a data exchange method based on a composite executable environment. This method achieves a highly secure trusted execution environment by constructing an independent hardware monitoring environment that separates execution from external interaction and keeps the entire environment closed to users.
[0096] In light of the issues with USB TEE, the composite trusted execution environment in this embodiment can significantly enhance its environmental security awareness by adding a hardware device that can actively access and monitor the external environment, and extend the peripheral monitoring of the TEE to further enhance its security protection capabilities.
[0097] Please see Figure 1 This embodiment provides a data exchange method based on a composite executable environment, including:
[0098] Step 1: The user execution unit initiates a data exchange request through its internal input / output proxy;
[0099] Step 2: The input / output agent submits the data exchange request to the data exchange area of the external data exchange unit and marks the corresponding request flag;
[0100] Step 3: After detecting the request flag, the external data exchange unit checks the validity of the data exchange request; if valid, it executes the data exchange operation; otherwise, it returns an error and notifies the hardware monitoring unit.
[0101] Step 4: During the data exchange process, the external data exchange unit performs independent data encryption and decryption processes with the user execution unit and the external host respectively; the keys used for encryption and decryption are dynamically configured by the hardware monitoring unit.
[0102] Step 5: The external data exchange unit transfers the exchanged data through its internal private area and completes the secure transfer of data between different data areas;
[0103] Step 6: The hardware monitoring unit supervises the entire data exchange process and updates the corresponding status control register according to the execution status to achieve resource management and security control of the user execution unit and the external data exchange unit;
[0104] Step 7: The hardware monitoring unit sends a detection command to the predetermined execution space of the external host through the external data exchange unit, and determines whether the external host has malicious behavior based on the response data; if malicious behavior is found, the current data exchange operation is immediately terminated and the external data access area of the external data exchange unit is locked.
[0105] Specifically, based on USB, an external data exchange unit is integrated into the USB device, acting as an active monitoring host to perform peer monitoring of the execution space and data exchange space of the connected external host. When the external host performs additional operations or suspicious actions in this space, the external data exchange unit, under the control of the hardware monitoring unit, can detect the illegal action and promptly terminate the data exchange operation between the user execution unit and the external host. Simultaneously, it locks the external data access area of the external data exchange unit, thereby protecting internal data. In essence, the USB device becomes an independent host capable of peer monitoring of the data within the external host, ensuring a clean external host environment, preventing malicious programs from intercepting communication between the USB device and the external host, and detecting whether the external host's operation code on the USB device is normal and has not been tampered with.
[0106] Key aspects of the data exchange process include: 1. All data is relayed through the VCore IO proxy and ExIO unit, ensuring complete isolation between the external environment and the execution environment (VCore Group), as well as data transmission; 2. Data in both the execution environment and ExIO is controlled and managed by the HMU. External users and internal VCore programs cannot directly control the data transfer process. The transfer address, length, and exception handling are all managed by the HMU; 3. All data exchanges undergo a decryption and re-encryption process to ensure data security.
[0107] This embodiment provides a data exchange method based on a composite executable environment. Before data exchange, it further includes a user environment loading process. User environment loading refers to loading user instructions and associated data onto a specific user execution unit (VCore) within a user execution unit group (VCore Group) and preparing for user program execution. This process includes user program security checks, integrity checks, user data loading, and transferring VCore permissions to the user. Specifically, the user environment loading process includes:
[0108] Step A1: The external data exchange unit receives the user program and associated data, and receives the execution request;
[0109] Specifically, the user loads the user program and associated data into the external data loading area of the external data exchange unit (ExIO), and after loading is complete, sends an execution request to ExIO.
[0110] Step A2: After performing a basic security check on the execution request, the external data exchange unit sends the execution request to the hardware monitoring unit;
[0111] Specifically, after receiving an execution request, ExIO performs basic security checks and confirms that the Hardware Monitoring Unit (HMU) is idle before sending the execution request to the HMU. This method can effectively isolate DDoS attacks caused by external execution requests.
[0112] Step A3: The hardware monitoring unit selects the target user execution unit based on the status control register of the user execution unit group;
[0113] Specifically, the Hardware Monitoring Unit (HMU) selects the appropriate VCore as the execution unit to execute the user program based on the Control Status Register (CSR) of the VCore Group.
[0114] Step A4: Configure the security policies related to the external data exchange unit and the target user execution unit in the hardware monitoring unit; the security policies include data firewall inspection policies, encryption and decryption keys, data channel I / O, storage management policies, and secure access scope;
[0115] Specifically, let's assume the current goal is... The HMU will configure ExIO (VCore) related information, including: data firewall inspection policies, encryption / decryption keys, etc. Data channel IO, Storage management policies and secure access scope.
[0116] Step A5: The external data exchange unit performs signature verification and integrity checks on the data loaded by the user. After confirming the integrity, it proceeds to the encryption / decryption process.
[0117] Specifically, ExIO (VCore) performs signature verification and integrity checks on the user-loaded data based on the HMU configuration. After confirming that the data is intact, it proceeds to the encryption / decryption process.
[0118] Step A6: The external data exchange unit decrypts the user data, obtains the plaintext data, and temporarily stores it in its internal private area;
[0119] Specifically, ExIO decrypts user data using the user key to obtain plaintext data, which is then temporarily stored in ExIO's private space, inaccessible to other components.
[0120] ExIO for private spaces After the data undergoes a security check and is confirmed to contain no additional code or instructions associated with security vulnerabilities, it proceeds to the next step. Its proprietary encryption process.
[0121] Step A7: The hardware monitoring unit generates a random base key for the target user execution unit. The external data exchange unit uses the key to encrypt the required data and then loads it into the storage area of the target user execution unit through the input / output agent to start the execution process.
[0122] Specifically, HMU is Each load provides a new random base key, and ExIO, after obtaining this key, will then process it within its private space. The required data is encrypted and then the input / output (Vcore IO) agent is notified.
[0123] After receiving the data loading notification, the VCore IO agent will read the encrypted data from the Vcore multichannel IO data exchange area of ExIO and then pass it to the HMU-configured data exchange area. Storage area. A notification will be sent after the transfer is complete. The execution process is initiated.
[0124] Key points for loading the user environment include: 1. All All executed programs are relayed through the IO agent and ExIO internally, and undergo integrity verification and security review to prevent abnormal or dangerous actions from being executed; 2. All data control is placed under the supervision of the HMU, and the configuration and execution of the HMU unit are pre-configured, and external users and 3. It is impossible to access or modify any of them; similar to traditional side-channel methods, it can directly detect the HMU's actions and behaviors. Furthermore, the HMU uses an independent ExIO to prevent external users from directly attacking the HMU's execution process through abnormal data.
[0125] This embodiment provides a data exchange method based on a composite executable environment. After the user environment is loaded, the target user execution unit starts the execution process, which specifically includes:
[0126] Step A701: The target user execution unit requests the data key from the hardware monitoring unit through a dedicated channel, decrypts the corresponding data and instructions locally, and then starts execution.
[0127] Specifically, the target user execution unit ( After startup, the device requests a data key from the Hardware Monitoring Unit (HMU) via a dedicated channel. After verifying the validity of the request, the HMU provides a pre-configured random base key. . The corresponding data and instructions are decrypted in local dedicated memory using this key, and the execution process is then officially started after decryption.
[0128] Step A702: When the target user execution unit finishes execution, the execution status is indicated through the status control register.
[0129] Specifically, when Upon completion, the status control register (CSR) indicates the completion status. The HMU detects completion by checking the CSR, thereby triggering subsequent result processing and resource release procedures.
[0130] In the data exchange method based on a composite executable environment provided in this embodiment, when the data exchange request is a data read request (i.e., When reading data, the specific steps include:
[0131] Step B1: The external data exchange unit converts the requested data address into the real address for external access and performs a validity check based on the data length;
[0132] Specifically, Initiate an external data read command, sending the requested data address and length to the VCore IO agent. The VCore IO agent submits the read request to the ExIO data exchange area and marks it with the corresponding flag.
[0133] After detecting the read flag corresponding to the data exchange area, ExIO converts the requested data address into the real address for external access and performs a validity check based on the data length. If valid, the read process is started, and the real address and length to be read are placed into the read queue; otherwise, an error command is returned directly, and the HMU is notified through ExIO's CSR, and then the current read process is exited.
[0134] Step B2: After the legality check is passed, the external data exchange unit puts the data read request into the read queue and notifies the external host through interrupt or polling.
[0135] Specifically, after the validity check is passed, the ExIO internal read queue controller places the read queue contents into the ExIO external data exchange area and notifies the external user to read the corresponding queue contents. Currently, the user can be notified via an interrupt, or the user can choose to poll the queue flag.
[0136] Step B3: The external host reads the corresponding data according to the read queue command, encrypts it according to the agreed key, places it in the external data access area of the external data exchange unit, and sets a data completion flag;
[0137] Specifically, after receiving the data read queue command, the external user will read the corresponding data, forming a DataList, and then encrypt the DataList according to the agreed key to form... Then Place it in the external data access area of ExI and set the corresponding data completion flag.
[0138] Step B4: After the external data exchange unit detects the data completion flag, it moves the encrypted data to its internal private area and clears the relevant data in the external data access area;
[0139] Specifically, the ExIO internal read queue controller detects external user settings. Data read complete flag. When this flag appears, the data read will be completed. The content was then moved to ExIO's VCore private data area. After the migration is complete, directly delete the relevant data content in the ExIO external data exchange area to prevent data pollution or leakage in the external data area.
[0140] Step B5: The external data exchange unit obtains the decryption key through the hardware monitoring unit, decrypts the encrypted data, and then encrypts it again using the user execution unit key configured by the hardware monitoring unit to form the user execution unit ciphertext data.
[0141] Specifically, when After being moved to the VCore private data area, ExIO will obtain the decryption key by requesting the HMU. Decrypt into a DataList. Then request the HMU to configure the VCore data key and encrypt it, thereby forming a VCore private data area within ExIO. .
[0142] Step B6: The external data exchange unit moves the encrypted data of the user execution unit to the data exchange area and notifies the hardware monitoring unit through the status control register;
[0143] Specifically, the VCore private data within ExIO will be moved to the VCore multi-channel IO data exchange area within ExIO by the data transfer components (such as DMA or dedicated components) within ExIO, and the HMU will be notified via CSR. After the transfer is complete, the VCore private data area and the configured user keys will be cleared.
[0144] Step B7: After the input / output agent detects the data reading completion flag, it moves the encrypted data of the user execution unit into the user execution unit, obtains the data key through the hardware monitoring unit for decryption, and submits the returned data to the user execution unit.
[0145] Specifically, the VCore IO agent will detect the data read completion flag. Once the completion flag is detected, it will move the contents of the Vcore multi-channel IO data exchange area inside ExIO to the VCore and perform a security check to prevent the presence of data with incorrect format or illegal data.
[0146] After completing the validity check, the VCore IO agent requests the data key from the HMU, decrypts the valid data, obtains the correct return data, and submits it to the corresponding... The VCore IO agent clears local cached data, keys, and intermediate results, ending the current read process.
[0147] The key aspects of the aforementioned reading process include: 1. All reading processes are initiated through the VCore Group's IO agent and then submitted to ExIO for the actual reading work; 2. All data reading processes include encryption (user) decryption (ExIO) and encryption (ExIO) decryption (VCore IO agent) processes, the core purpose of which is to prevent data leakage in the intermediate stages; 3. ExIO completes the intermediate data transfer, moving data between different data areas, all with flag detection and added security detection mechanisms, and the process key is provided by HMU. This will limit automated data movement by unauthorized access users and increase security.
[0148] In the data exchange method based on a composite executable environment provided in this embodiment, when the data exchange request is a data write request (i.e. When writing data, the specific steps include:
[0149] Step C1: The input / output agent performs a validity check on the data to be written. If the check passes, it requests a security key from the hardware monitoring unit through the status control register, encrypts the data to be written using the security key, submits the encrypted data to the data exchange area of the external data exchange unit, and marks the write flag.
[0150] Specifically, Initiate an external data write command, sending the requested data address, data content, and length to the VCore IO agent. The VCore IO agent will check the data's validity. After the validity check is complete, it will request a security key from the HMU via CSR and obtain the key. The VCore IO agent will then encrypt the written data, submit it to the ExIO data exchange area, and mark it with the corresponding flag. Internally, VCore will mark this write operation as complete and continue executing subsequent procedures and actions.
[0151] Step C2: After the external data exchange unit detects the write flag, it converts the requested data address into the real address for external access and performs a validity check based on the data length.
[0152] Specifically, after ExIO detects the write flag corresponding to the data exchange area, it converts the requested data address into the real address for external access and performs a validity check based on the data length. If valid, it starts the external write process and puts the real address and length into the write queue; otherwise, it directly returns an error command and notifies the HMU through ExIO's CSR, and then exits the current write process.
[0153] Step C3: After the legality check is passed, the external data exchange unit obtains the decryption key for the written data through the status control register, decrypts the contents of the data exchange area, and stores the decryption result in its internal private area.
[0154] Specifically, after the legitimacy check is passed, the write queue controller inside ExIO will obtain the key for this write data through CSR and decrypt the contents of the data exchange area. The decryption result is stored in ExIO's internal private area.
[0155] Step C4: The external data exchange unit obtains the user key through the hardware monitoring unit, encrypts the decryption result to form external host ciphertext data, and moves the external host ciphertext data to the external data access area;
[0156] Specifically, ExIO requests the HMU's user key to unify keys with external users and exchange data. Once the key is obtained, the decryption result is encrypted to form... The data is then moved to the external data exchange area of ExIO.
[0157] Step C5: The external data exchange unit notifies the external host to read data via interrupt or polling.
[0158] Specifically, ExIO notifies external users to read the corresponding queue contents. Currently, this can be done via interrupt or by having the user poll the queue flag. Once the external user receives the command to read the queue, they will read the corresponding data. Then, the user decrypts the data, forming... And set the corresponding data completion flag.
[0159] Step C6: After the external host reads and decrypts the encrypted data, it sets a data completion flag;
[0160] Specifically, the ExIO internal read queue controller detects external user settings. Data reading complete.
[0161] Step C7: After the external data exchange unit detects the data completion flag, it clears the relevant data in the external data access area and the internal private area, and updates the status control register to indicate that the write is complete.
[0162] Specifically, when this flag appears, the relevant data content in the ExIO external data exchange area is directly cleared to prevent data contamination or leakage in the external data area. Internally, ExIO will clear the VCore private data area and the configured user key, and set the corresponding status register to facilitate HMU detection of write completion. Then, the write process ends.
[0163] The key aspects of the above writing process include: 1. All writing processes are initiated through the VCore Group's IO agent and then submitted to ExIO for the actual writing work; 2. All writing processes include encryption (VCore IO agent) decryption (ExIO) and encryption (ExIO) decryption (user) processes, the core purpose of which is to prevent data leakage in the intermediate stages; 3. ExIO completes the intermediate data transfer, moving data between different data areas, all with flag detection and added security detection mechanisms, and the process key is provided by HMU. This will limit automated data movement by unauthorized access users and increase security.
[0164] This embodiment provides a data exchange method based on a composite executable environment. After the data exchange is completed, the hardware monitoring unit performs resource management on the user execution unit, specifically including:
[0165] Step D1: The hardware monitoring unit, according to the indication of the status control register, notifies the input / output agent to encrypt the execution result and move it to the data exchange area of the external data exchange unit;
[0166] Specifically, HMU will notify according to CSR instructions. Internal IO agent. The IO agent encrypts the execution result and moves the data to ExIO's VCore multi-channel IO data exchange area.
[0167] Step D2: The external data exchange unit decrypts the execution result and converts it into data encrypted with the user key, which is then temporarily stored in its internal private area;
[0168] Specifically, ExIO decrypts the execution results in the data exchange area, converts them into data encrypted with the user key, and stores them in the ExIO private data area. After being moved to the ExIO private data area, the HMU is notified via ExIO's CSR to enable [the HMU's functionality]. This includes the cleanup process and the migration of internal ExIO data to the external data interaction area.
[0169] Step D3: The hardware monitoring unit configures the user execution unit to start the data clearing process, which includes clearing data, code, configuration keys, and intermediate state data.
[0170] Specifically, after the HMU obtains the data reading process of the ExIO completion execution result, it will configure it through CSR. Thus start This involves data and status clearing. This process is performed through... Internal dedicated data erasure unit or Completed by an internal proprietary program. When initiating internal data cleanup, the following are included: data and code, configured keys, and intermediate state data.
[0171] Step D4: After the user execution unit completes the cleanup, it notifies the hardware monitoring unit through the status control register so that the user execution unit can provide services for the next program execution.
[0172] Specifically, after all data has been cleared, through The CSR status indicator informs the HMU of the completion status; only after the clearing action is completed... Only then can it provide services for the next program to be executed.
[0173] Considering scenarios like USB dongles or PCIe cards, if the host environment is attacked, users can attack the TEE environment by sending multiple different data accesses or requests, increasing the security risk of the TEE. Therefore, it is necessary to prevent or detect such phenomena. Thus, the data exchange method based on a composite executable environment provided in this embodiment further includes: a hardware monitoring unit actively performing security detection, specifically including:
[0174] Step E1: When the user execution unit needs to read or write data to the external host, the hardware monitoring unit simultaneously initiates an environment detection access to the external host.
[0175] Specifically, the hardware monitoring unit synchronously initiates environment detection access to the external host, including encrypted access mode and unencrypted access mode. When using encrypted access mode, the user execution unit is configured with a user encryption module for encrypted communication with the external host. When using unencrypted access mode, the external data exchange unit internally converts plaintext data into ciphertext for processing.
[0176] Step E2: The hardware monitoring unit, by configuring the control unit of the external data exchange unit, detects the read and write status of the external host in the same data access mode as the user execution unit;
[0177] Step E3: The hardware monitoring unit determines whether the external host environment is safe and reliable based on the detection results;
[0178] Step E4: If the judgment result indicates that there is a security risk, the hardware monitoring unit will prevent the user from accessing the unit until the external host environment is detected as reliable.
[0179] This embodiment adds an active external data access mechanism to the HMU in the above-described scenario. Specifically, it provides an external host environment access mechanism within ExIO. When a VCore needs to write or read data externally, the HMU will also initiate an external environment detection access to verify whether the external host's read / write code is normal and whether it contains malicious access, thereby determining whether the host environment is safe and reliable. If a security risk is detected, VCore access will be stopped until the external environment is detected as reliable.
[0180] External access to the HMU is the same as that of the VCore Group. If encrypted access is used, a user encryption module needs to be added to the user environment; otherwise, plaintext access is used directly, but ExIO internally still converts it to ciphertext.
[0181] This embodiment provides a data exchange method based on a composite executable environment. After the data exchange is completed, it also includes a result output and cleanup process from an external data exchange unit. Specifically, it includes:
[0182] Step F1: The external data exchange unit moves the execution result from the internal private area to the external data access area and notifies the user to read the execution result;
[0183] Specifically, ExIO notifies the user that TEE has completed execution and begins the migration from the ExIO private data area to the ExIO external data area.
[0184] Step F2: After the user completes the result reading, notify the external data exchange unit;
[0185] Specifically, the user obtains the execution result from the ExIO external data area and notifies ExIO to complete the result reading.
[0186] Step F3: The external data exchange unit clears the data, keys, and cache associated with the current user execution unit in the external data access area and the internal private area;
[0187] Specifically, ExIO will complete The associated ExIO external data area and private data area are cleared, and any attached keys, caches, and intermediate data are eliminated.
[0188] Step F4: The external data exchange unit informs the hardware monitoring unit that the resource release is complete through the status control register, so that the hardware monitoring unit can determine whether the IO resources of the user execution unit have been completely released.
[0189] Specifically, after all... After associating the data, the HMU is informed of the completion status via the ExIO CSR status indicator; the HMU will rely on the ExIO CSR status indicator to determine... Whether the IO resources have been completely released determines whether to proceed to the next round of ExIO service. The user obtains the ExIO completion result, decrypts it locally, and thus obtains the final execution result.
[0190] The data exchange method based on a composite executable environment provided in this embodiment can effectively prevent various system-level side-channel attacks, as well as security key leakage and permission overreach issues. The user's execution state is always in a supervised environment, thereby greatly enhancing security.
[0191] This embodiment provides a data exchange method based on a composite executable environment. By constructing a composite trusted execution environment that includes monitoring and management, data exchange, and user code execution, each running independently, it achieves bidirectional data security monitoring and bidirectional program interaction with the host environment through proactive external access. This ensures bidirectional security between the composite environment and the host environment, preventing the TEE from leaking related information in a malicious environment, and achieving I / O independence, computing resource independence, storage independence, encryption independence, and data isolation between the two.
[0192] Furthermore, through two-way security verification, the drawback of traditional TEE-REE coupling, where the TEE cannot proactively detect REE security vulnerabilities, is avoided. This mechanism significantly enhances the security of the TEE system, decoupling TEE from host protection.
[0193] This method can also solve the problems that traditional portable devices, such as USB dongles, have poor protection capabilities and cannot actively protect themselves against host-side attacks, communication link attacks, and hardware physical attacks when assisting the host in performing security protection tasks.
[0194] Example 2
[0195] Please see Figure 2 This embodiment provides a data exchange system based on a composite executable environment. This data exchange system is used to execute the data exchange method based on a composite executable environment provided in Embodiment 1, including:
[0196] It consists of an independent Hardware Monitoring Unit (HMU), an External Data Exchange Unit (ExIO), and a User Execution Unit Group (VCore Group). The HMU, ExIO, and VCore Group operate independently and form a Composite Trusted Execution Environment (CTEE) through secure sharing. The three units will complete data interaction according to certain rules. The data access area of the ExIO is divided into: an external data access area, a user code execution unit data access area, a hardware monitoring unit control and management area, and an internal private area.
[0197] Specifically, the hardware monitoring unit is used to perform security management and monitoring;
[0198] The external data exchange unit is used to interact with external hosts. Its exposed data access area is divided into an external data access area, a data exchange area, a hardware monitoring unit control and management area, and an internal private area.
[0199] A user execution unit group, comprising at least one user execution unit for executing user programs;
[0200] The hardware monitoring unit, external data exchange unit, and user execution unit group operate independently and form a composite trusted execution environment through secure sharing. External hosts can only access the external data access area of the external data exchange unit. The hardware monitoring unit cannot directly access the external data access area, but it can move external host data to the data area accessible by the hardware monitoring unit by configuring the control unit of the external data exchange unit.
[0201] In summary, in this embodiment, the composite trusted execution environment interacts with the external host through an external data exchange unit. The external host can only access the external access area of the external data exchange unit. The hardware monitoring unit can access the control unit and key data area of the external data exchange unit, but cannot directly access the external access area of the external data exchange unit. When the hardware monitoring unit needs to read host or external data, it configures the control unit of the external data exchange unit, and then the control unit moves the host or external data to a data area accessible to the hardware monitoring unit environment. During the move, the control unit performs encryption / decryption and data format conversion. When the user execution unit needs to access external data, it issues an external data request, and then the external data exchange unit performs command validity verification and performs data encryption / decryption and data format conversion.
[0202] Conventional TEE systems, such as Intel's SGX / TDX, typically include an enclave, allowing external hosts or rich environments (REEs) to communicate directly with the TEE. This application, however, specifically designs a corresponding external data exchange unit to enable interaction between the TEE and the REE. Furthermore, a dedicated hardware monitoring unit is designed to monitor the user execution unit group, ensuring the legality and security of user-executed programs. The hardware monitoring unit also controls and manages the external data exchange unit.
[0203] For specific limitations on a data exchange method based on a composite executable environment, please refer to the above text, which will not be repeated here.
[0204] The technical features of the above embodiments can be combined in any way (as long as there is no contradiction in the combination of these technical features). For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described; these embodiments not explicitly written should also be considered to be within the scope of this specification.
Claims
1. A data exchange method based on a composite executable environment, characterized in that, include: Step 1: The user execution unit initiates a data exchange request through its internal input / output proxy; Step 2: The input / output agent submits the data exchange request to the data exchange area of the external data exchange unit and marks the corresponding request flag; Step 3: After detecting the request flag, the external data exchange unit performs a validity check on the data exchange request; If valid, perform the data exchange operation; otherwise, return an error and notify the hardware monitoring unit. Step 4: During the data exchange process, the external data exchange unit performs independent data encryption and decryption processes with the user execution unit and the external host respectively; wherein the keys used for encryption and decryption are dynamically configured by the hardware monitoring unit. Step 5: The external data exchange unit relays the exchanged data through its internal private area and completes the secure transfer of data between different data areas. During the data exchange process, all data is relayed between the external data exchange unit and the input / output proxy. The external environment and the execution environment are completely isolated, and data transmission is also completely isolated. The data in the execution environment and the external data exchange unit are controlled and managed by the hardware monitoring unit. Neither external users nor the internal program of the user execution unit can directly control the data transfer process. The address, length, and exception handling of the transfer are all managed by the hardware monitoring unit. Step 6: The hardware monitoring unit monitors the entire data exchange process and updates the corresponding status control register according to the execution status to realize resource management and security control of the user execution unit and the external data exchange unit. Step 7: The hardware monitoring unit sends a detection command to the predetermined execution space of the external host through the external data exchange unit, and determines whether the external host has malicious behavior based on the response data; If malicious behavior is detected, the current data exchange operation will be terminated immediately and the external data access area of the external data exchange unit will be locked. The data exchange method based on a composite executable environment is applied to a data exchange system based on a composite executable environment, the data exchange system based on a composite executable environment comprising: Hardware monitoring unit, used to perform security management and monitoring; The external data exchange unit is used to interact with external hosts. Its exposed data access area is divided into an external data access area, a data exchange area, a hardware monitoring unit control and management area, and an internal private area. A user execution unit group, comprising at least one user execution unit for executing user programs; The hardware monitoring unit, the external data exchange unit, and the user execution unit group operate independently of each other, and form a composite trusted execution environment through secure sharing. The external host can only access the external data access area of the external data exchange unit; The hardware monitoring unit cannot directly access the external data access area, but it can move external host data to the data area accessible by the hardware monitoring unit by configuring the control unit of the external data exchange unit.
2. The data exchange method based on a composite executable environment according to claim 1, characterized in that, Before data exchange, the process also includes: a user environment loading process, which includes: Step A1: The external data exchange unit receives the user program and associated data, and receives the execution request; Step A2: After performing a basic security check on the execution request, the external data exchange unit sends the execution request to the hardware monitoring unit; Step A3: The hardware monitoring unit selects the target user execution unit based on the status control register of the user execution unit group; Step A4: The hardware monitoring unit configures the security policies related to the external data exchange unit and the target user execution unit; the security policies include data firewall inspection policies, encryption and decryption keys, data channel I / O, storage management policies, and secure access scope; Step A5: The external data exchange unit performs signature verification and integrity checks on the data loaded by the user. After confirming the integrity, it proceeds to the encryption / decryption process. Step A6: The external data exchange unit decrypts the user data, obtains the plaintext data, and temporarily stores it in its internal private area; Step A7: The hardware monitoring unit generates a random base key for the target user execution unit. The external data exchange unit uses the key to encrypt the required data and then loads it into the storage area of the target user execution unit through the input / output agent to start the execution process.
3. The data exchange method based on a composite executable environment according to claim 2, characterized in that, The process of initiating execution includes: The target user execution unit requests the data key from the hardware monitoring unit through a dedicated channel, decrypts the corresponding data and instructions locally, and then starts execution; when the target user execution unit finishes execution, it indicates the execution status through the status control register.
4. The data exchange method based on a composite executable environment according to claim 1, characterized in that, When the data exchange request is a data read request, the data exchange operation includes: Step B1: The external data exchange unit converts the requested data address into the real address for external access and performs a validity check based on the data length; Step B2: After the legality check is passed, the external data exchange unit puts the data read request into the read queue and notifies the external host through interrupt or polling. Step B3: The external host reads the corresponding data according to the read queue command, encrypts it according to the agreed key, places it in the external data access area of the external data exchange unit, and sets a data completion flag; Step B4: After the external data exchange unit detects the data completion flag, it moves the encrypted data to its internal private area and clears the relevant data in the external data access area; Step B5: The external data exchange unit obtains the decryption key through the hardware monitoring unit, decrypts the encrypted data, and then encrypts it again using the user execution unit key configured by the hardware monitoring unit to form the user execution unit ciphertext data. Step B6: The external data exchange unit moves the encrypted data of the user execution unit to the data exchange area and notifies the hardware monitoring unit through the status control register; Step B7: After the input / output agent detects the data reading completion flag, it moves the encrypted data of the user execution unit into the user execution unit, and obtains the data key through the hardware monitoring unit to decrypt it, and then submits the returned data to the user execution unit.
5. The data exchange method based on a composite executable environment according to claim 1, characterized in that, When the data exchange request is a data write request, the data exchange operation includes: Step C1: The input / output agent performs a validity check on the data to be written. If the check is successful, it requests a security key from the hardware monitoring unit through the status control register, and uses the security key to encrypt the data to be written. The encrypted data is then submitted to the data exchange area of the external data exchange unit and marked with a write flag. Step C2: After the external data exchange unit detects the write flag, it converts the requested data address into the real address for external access and performs a validity check based on the data length. Step C3: After the legality check is passed, the external data exchange unit obtains the decryption key for the written data through the status control register, decrypts the contents of the data exchange area, and stores the decryption result in its internal private area. Step C4: The external data exchange unit obtains the user key through the hardware monitoring unit, encrypts the decryption result to form external host encrypted data, and moves the external host encrypted data to the external data access area; Step C5: The external data exchange unit notifies the external host to read data via interrupt or polling. Step C6: After the external host reads and decrypts the encrypted data, it sets a data completion flag; Step C7: After the external data exchange unit detects the data completion flag, it clears the relevant data in the external data access area and the internal private area, and updates the status control register to indicate that the write is complete.
6. The data exchange method based on a composite executable environment according to claim 1, characterized in that, After the data exchange is completed, the hardware monitoring unit performs resource management on the user execution unit, specifically including: Step D1: The hardware monitoring unit, according to the indication of the status control register, notifies the input / output agent to encrypt the execution result and move it to the data exchange area of the external data exchange unit; Step D2: The external data exchange unit decrypts the execution result and converts it into data encrypted with the user key, which is then temporarily stored in its internal private area; Step D3: The hardware monitoring unit configures the user execution unit to start the data clearing process, which includes clearing data, code, configuration keys and intermediate state data; Step D4: After the user execution unit completes the cleanup, it notifies the hardware monitoring unit through the status control register so that the user execution unit can provide services for the next program execution.
7. The data exchange method based on a composite executable environment according to claim 1, characterized in that, Also includes: The hardware monitoring unit actively performs security checks, specifically including: Step E1: When the user execution unit needs to read or write data to the external host, the hardware monitoring unit simultaneously initiates an environment detection access to the external host. Step E2: The hardware monitoring unit, by configuring the control unit of the external data exchange unit, detects the read and write status of the external host in the same data access mode as the user execution unit; Step E3: The hardware monitoring unit determines whether the external host environment is safe and reliable based on the detection results; Step E4: If the judgment result indicates that there is a security risk, the hardware monitoring unit will prevent the user from accessing the unit until the external host environment is detected as reliable.
8. The data exchange method based on a composite executable environment according to claim 7, characterized in that, The hardware monitoring unit synchronously initiates environment detection access to the external host, including encrypted access mode and unencrypted access mode. When the encrypted access mode is used, the user execution unit is configured with a user encryption module for encrypted communication with the external host. When the unencrypted access mode is used, the external data exchange unit internally converts plaintext data into ciphertext.
9. The data exchange method based on a composite executable environment according to claim 1, characterized in that, It also includes the output and cleanup process of the external data exchange unit, specifically including: Step F1: The external data exchange unit moves the execution result from the internal private area to the external data access area and notifies the user to read the execution result; Step F2: After the user completes the result reading, notify the external data exchange unit; Step F3: The external data exchange unit clears the data, keys, and cache associated with the current user execution unit in the external data access area and the internal private area; Step F4: The external data exchange unit informs the hardware monitoring unit that the resource release is complete through the status control register, so that the hardware monitoring unit can determine whether the IO resources of the user execution unit have been completely released.
Citation Information
Patent Citations
A high-security trusted mobile terminal security architecture and security service method
CN109086100A
Virtual encryption machine platform based on trusted technology and creation method thereof
CN114117412A