A method, device, apparatus and storage medium for dynamically configuring secure memory
By dynamically configuring secure memory, the client sends a registration command to a trusted application, and uses the trusted execution environment and the trusted framework unit of the processor to update memory attributes. This solves the waste problem caused by fixed-size memory, improves memory utilization, and protects sensitive information.
Patent Information
- Application Number
- CN202211168325.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-23
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-09-23
AI Technical Summary
In the existing technology, fixed-size security memory configurations lead to memory resource waste and strain, failing to meet the dynamic memory requirements of trusted applications within a trusted execution environment.
The client sends a registration command to the trusted application, and uses the trusted framework unit of the operating system and processor of the trusted execution environment to dynamically configure secure memory, ensuring that the attributes of the memory space are updated to secure attributes and can only be accessed by trusted applications.
This approach achieves the goal of meeting security requirements while reducing memory waste, improving memory utilization, and protecting the security of sensitive information.
Smart Images

Figure CN115544585B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computers, and in particular to a method, apparatus, device, and storage medium for dynamically configuring secure memory. Background Technology
[0002] With the development of internet-related technologies, the ways in which information flows have become increasingly diverse. At the same time, people's awareness of information protection is also growing. Currently, based on TrustZone technology, Trusted Execution Environments (TEEs) can be built on user devices. A TEE provides a secure environment on a user's device that is isolated from the Rich Execution Environment (REE), protecting the security of applications running within this TEE and thus contributing to privacy protection.
[0003] How to configure the secure memory required for TEE operation is an urgent problem to be solved. Therefore, this manual provides a method for dynamically configuring secure memory. Summary of the Invention
[0004] This specification provides a method, apparatus, device, and storage medium for dynamically configuring secure memory, to at least partially solve the aforementioned problems existing in the prior art.
[0005] The following technical solution is adopted in this specification:
[0006] This specification provides a method for dynamically configuring secure memory, which is applied to trusted applications, including:
[0007] Receive a registration instruction for secure memory, wherein the registration instruction carries the memory address requested by the client;
[0008] According to the registration instruction, the registration interface of the operating system of the trusted execution environment is invoked to send a registration request for secure memory to the trusted framework unit of the processor, so that the trusted framework unit of the processor updates the attributes of the memory space corresponding to the memory address to secure attributes according to the registration request.
[0009] This specification provides a method for dynamically configuring secure memory, which is applied to an operating system in a trusted execution environment, including:
[0010] Receive a call request from a trusted application to the registration interface, the call request carrying the memory address requested by the client in the general execution environment;
[0011] A registration request is generated based on the call request, and the registration request is sent to the processor trusted framework unit, so that the processor trusted framework unit updates the attributes of the memory space corresponding to the memory address to security attributes according to the registration request.
[0012] This specification provides a method for dynamically configuring secure memory, the method being applied to a processor trusted framework unit, including:
[0013] Receive a registration request sent by the operating system of the trusted execution environment, the registration request containing a memory address;
[0014] Based on the registration request, the attributes of the memory space corresponding to the memory address are updated to security attributes.
[0015] This specification provides a device for dynamically configuring secure memory. The device includes a client in a general execution environment, an operating system in a trusted execution environment, a trusted application, and a processor trusted framework unit, comprising:
[0016] The client is configured to determine the memory address required to perform business operations in the trusted execution environment; and send a registration instruction to the trusted application, wherein the registration instruction carries the memory address.
[0017] The trusted application is configured to receive a registration instruction sent by the client; and generate a call request to invoke the registration interface in the operating system of the trusted execution environment based on the registration instruction carrying the memory address.
[0018] The operating system of the trusted execution environment is used to receive the call request from the trusted application to the registration interface; generate a registration request based on the call request; and send the registration request to the processor trusted framework unit.
[0019] The processor trusted framework unit is configured to receive the registration request sent by the operating system of the trusted execution environment; and update the attributes of the memory space corresponding to the memory address to security attributes according to the registration request.
[0020] This specification provides a dynamically configurable secure memory device, comprising:
[0021] A receiving module is used to receive a registration instruction for secure memory, wherein the registration instruction carries the memory address requested by the client;
[0022] The memory configuration module is used to call the registration interface of the operating system of the trusted execution environment according to the registration instruction, and send a registration request for secure memory to the trusted framework unit of the processor, so that the trusted framework unit of the processor updates the attributes of the memory space corresponding to the memory address to the security attribute according to the registration request.
[0023] This specification provides a dynamically configurable secure memory device, comprising:
[0024] The receiving module is used to receive a call request from a trusted application to the registration interface, wherein the call request carries the memory address requested by the client in the general execution environment;
[0025] The memory configuration module is used to generate a registration request based on the call request, send the registration request to the processor trusted framework unit, and cause the processor trusted framework unit to update the attributes of the memory space corresponding to the memory address size to security attributes based on the registration request.
[0026] This specification provides a dynamically configurable secure memory device, comprising:
[0027] The receiving module receives a registration request sent by the operating system of the trusted execution environment, wherein the registration request contains a memory address;
[0028] The memory configuration module updates the attributes of the memory space corresponding to the memory address to security attributes based on the registration request.
[0029] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for dynamically configuring secure memory.
[0030] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:
[0031] In the method for dynamically configuring secure memory provided in this specification, a client in a general execution environment sends a secure memory registration instruction to a trusted application in a trusted execution environment. The registration instruction carries the memory address requested by the client. Based on the registration instruction, the trusted application invokes the registration interface of the trusted execution environment's operating system to send a secure memory registration request to the processor's trusted framework unit. This causes the processor's trusted framework unit to update the attributes of the memory space corresponding to the memory address to secure attributes based on the registration request.
[0032] As can be seen from the above method, this method satisfies security requirements and reduces the waste of memory resources by dynamically configuring secure memory. Attached Figure Description
[0033] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:
[0034] Figure 1This is a flowchart illustrating a method for dynamically configuring secure memory in an embodiment of this specification.
[0035] Figure 2 This is a schematic diagram illustrating how a client interacts with a trusted application through a processor trusted framework unit, as provided in an embodiment of this specification.
[0036] Figure 3 A flowchart illustrating a method for dynamically configuring secure memory provided in an embodiment of this specification;
[0037] Figure 4 A flowchart illustrating a method for dynamically configuring secure memory provided in an embodiment of this specification;
[0038] Figure 5a A schematic diagram of a device for dynamically configurable secure memory provided in the embodiments of this specification;
[0039] Figure 5b A schematic diagram of a device for dynamically configurable secure memory provided in the embodiments of this specification;
[0040] Figure 6 This specification provides a detailed schematic diagram illustrating the interaction process between a client, a trusted processor framework unit, and an operating system applied to a trusted execution environment, as provided in the embodiments of this specification.
[0041] Figure 7 A schematic diagram of a dynamically configurable secure memory device provided in the embodiments of this specification;
[0042] Figure 8 A schematic diagram of a dynamically configurable secure memory device provided in the embodiments of this specification;
[0043] Figure 9 This is a schematic diagram of a dynamically configurable secure memory device provided in an embodiment of this specification. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative effort are within the scope of protection of this application.
[0045] Unlike methods that configure secure memory during the initialization of the memory access control unit at the device startup stage, this specification proposes a new method for configuring secure memory, avoiding the waste of memory resources caused by a fixed secure memory size. It also addresses the problem of exacerbating memory resource constraints caused by configuring secure memory according to the maximum memory required by trusted applications running within a trusted execution environment (TEE) to ensure the normal operation of trusted applications.
[0046] Currently, one of the purposes of building a Trusted Execution Environment (TA) in a device is to improve data security and mitigate risks during client-side (CA) runtime. Generally, when a client executes a business function, if the function involves sensitive user data or secure computation, the client will transfer the corresponding business steps to a Trusted Application (TA) within the TA. Because the TA and the general execution environment are isolated, malware in the general execution environment cannot access sensitive data in the TA. Similarly, the client cannot access sensitive data; it only provides the data needed to execute the business function to the Trusted Application and receives the execution result returned by the Trusted Application. How the client obtains the execution result is like a "black box" to the client in the general execution environment; the client cannot access the internal data.
[0047] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0048] Figure 1 This is a flowchart illustrating a method for dynamically configuring secure memory as described in this specification, specifically including the following steps:
[0049] S100: Receive a registration instruction for secure memory, the registration instruction carrying the memory address requested by the client.
[0050] Since trusted applications require hardware resources such as processors and memory to execute business operations, secure memory needs to be configured for the trusted application before it executes its business. Secure memory is a part of the device's memory. By configuring certain memory addresses in the device's memory with secure attributes, only trusted applications in the trusted execution environment can access the data at those memory addresses, while clients in the general execution environment cannot access the data at those memory addresses.
[0051] To avoid the problems caused by configuring a fixed-size secure memory, in one or more embodiments of this specification, the device no longer configures a fixed-size secure memory through the memory access control unit at startup. Instead, secure memory is configured only when the client needs the assistance of a trusted application in a trusted execution environment to perform its business operations.
[0052] The execution entity is a trusted application running in the device's trusted execution environment. This trusted application can receive registration instructions sent by the client. Since this registration instruction is used to register the device's memory as secure memory, and the trusted application cannot determine how much memory space it needs to execute its business, the registration instruction carries the memory address requested by the client.
[0053] Furthermore, since a Trusted Execution Environment (TEE) can contain multiple trusted applications, and each trusted application within the TEE is isolated from the others, they cannot access each other without authorization. Typically, only one trusted application is used to perform subsequent privacy-related services. For example, suppose the TEE contains trusted applications A, B, and C, used for facial recognition, fingerprint recognition, and voiceprint recognition respectively, and the service the trusted application needs to perform is facial payment. In this case, only trusted application A is the trusted application required to perform the subsequent service.
[0054] Therefore, before sending the registration command, the client can determine the trusted application required for subsequent business operations from among the trusted applications in the trusted execution environment. Specifically, the client can determine the trusted application required for subsequent business operations from among the trusted applications in the trusted execution environment and send a verification request to the trusted application to verify whether the trusted application can execute the business. The trusted application can return confirmation or denial information based on the verification request. After receiving confirmation information, the client can continue to execute the subsequent step S102; otherwise, it can display an error message to inform the user that business operations cannot be executed within the trusted execution environment. Of course, how the client determines whether a trusted application can normally provide business support is a relatively mature technology, and this specification will not elaborate further.
[0055] Furthermore, since the general execution environment (GEM) and the trusted execution environment (TEX) are two isolated environments, there is a certain risk if the client directly sends the registration command to the trusted application. For example, if the client is processing fingerprint payment but there is also a possibility of fingerprint information theft, and the client directly sends the registration command to the trusted application, the GEM can obtain the verification information of the encrypted fingerprint data, thus rendering the TEX insecure, and the user's fingerprint data could be stolen. Therefore, currently, the registration command is usually forwarded by the processor trusted framework unit (ARM Trusted Firmware, ATF).
[0056] Figure 2 This specification provides a schematic diagram of a client (CA) interacting with a trusted application (TA) through a processor trusted framework unit (ATF). As can be seen, on the left is a general execution environment (REE), in which the client sends a registration instruction to the processor trusted framework unit. In the middle is the processor trusted framework unit, which is used to distribute the registration instruction sent by the client. On the right is a trusted execution environment (TEE), in which the trusted application receives the registration instruction forwarded by the processor trusted framework unit.
[0057] The trusted application verifies the client sending the registration command. If the sender is a client authorized to invoke itself, the application accepts the registration command forwarded by the processor's trusted framework unit. If the sender is not a client authorized to invoke itself, the application rejects the registration command sent by that client.
[0058] Furthermore, a trusted application can handle the services of one or more clients. For example, trusted application D in a trusted execution environment can handle security verification services. Currently, multiple clients in the general execution environment request security verification services. After verifying each client, trusted application D forwards the relevant data for security verification services from each client to trusted application D through the trusted framework unit of the processor. After receiving the data sent by each client, trusted application D uses the data to process the security verification services of each client respectively.
[0059] S102: According to the registration instruction, the registration interface of the operating system of the trusted execution environment is invoked to send a registration request for secure memory to the trusted framework unit of the processor, so that the trusted framework unit of the processor updates the attributes of the memory space corresponding to the memory address to secure attributes according to the registration request.
[0060] Upon receiving a registration instruction, the trusted application, lacking the authority to update the device's memory attributes to security attributes, can invoke the registration interface of the Trusted Execution Environment's operating system. The operating system then sends a registration request for secure memory to the processor's trusted framework unit. The processor's trusted framework unit, in turn, updates the attributes of the memory space corresponding to that memory address to security attributes based on the registration request. This ensures that the memory space can only be accessed by the trusted application, guaranteeing the security of subsequent business operations and reducing the risk of user privacy breaches.
[0061] Specifically, firstly, since the operating system of a typical trusted execution environment provides different interfaces for various trusted applications to implement functions or services, the trusted application needs to first determine the interface for secure memory registration in order to call that interface to register secure memory. Therefore, the trusted application can query the functions of each interface of the trusted execution environment's operating system based on the received registration instruction, and determine the interface used for registering secure memory, i.e., the registration interface.
[0062] Subsequently, once the trusted application finds the registration interface, it can call the registration interface to send the memory address to the operating system of the trusted execution environment.
[0063] Then, the operating system of the trusted execution environment can send a registration request for secure memory to the trusted framework unit of the processor according to the business logic corresponding to the registration interface. The registration request carries the memory address. The trusted framework unit of the processor updates the attributes of the memory to secure attributes, ensuring that the memory can only be used by the corresponding trusted applications.
[0064] The operating system of this trusted execution environment can generate a registration request based on the business logic corresponding to the registration interface and the memory address carried in the call request.
[0065] Specifically, after the registration interface accepts the call from the trusted application, the business logic layer of the trusted execution environment's operating system establishes a business process based on the memory address, runs the business logic code corresponding to the registration interface, and generates the registration request. That is, it generates code that conforms to the syntax rules to generate the registration request according to the business logic, runs the code, and generates the registration request. The registration request carries the memory address.
[0066] Subsequently, after the operating system of the Trusted Execution Environment (TEE) sends the registration request to the Trusted Framework Unit (TFU) of the processor, the TFU sends a call instruction to the TrustZone Address Space Controller (TZASC) based on the registration request. This call instruction carries the memory address. Both the TFU's sending of the registration request to the TFU and the TFU's receiving of the registration request can be verified first. If the verification is successful, the next step is performed; if the verification fails, an error message is returned, indicating a potential security vulnerability. Of course, since the technology for inter-program verification (e.g., authentication) is already relatively mature, this specification will not elaborate further, nor does it limit the specific verification method used.
[0067] Finally, the memory protection controller can determine the memory address based on the call instruction of the processor's trusted framework unit, and determine the contiguous physical addresses of the memory to be registered as secure memory from the free memory storage space. It then updates the attributes of the determined contiguous physical addresses to secure attributes. After updating the attributes of the contiguous physical addresses, the memory protection controller can also return confirmation information to the processor's trusted framework unit. Upon receiving the confirmation information, the processor's trusted framework unit determines that the secure memory registration is successful and returns a secure memory registration completion message to the operating system of the trusted execution environment. Upon receiving the secure memory registration completion message, the operating system of the trusted execution environment maps the memory address, that is, maps the contiguous physical addresses, generating a corresponding mapping table. The mapping table contains the virtual addresses corresponding to the contiguous physical addresses and the mapping relationship between them. This specification does not restrict the mapping relationship. That is, when mapping the contiguous physical addresses, the mapping relationship can be A to A or other logical relationships, as long as it reflects that the contiguous physical addresses are being mapped. After translating the physical address into a virtual address, the information indicating the security memory registration is complete, along with the virtual address, is returned to the trusted application. Upon receiving this information, the trusted application determines that it can jointly execute secure services with the client. Therefore, the trusted application can notify the client via the processor's trusted framework unit that the security memory registration is complete, enabling the client to determine that it can execute services based on the notification.
[0068] For example, a client needs to perform a biometric login process. Since the biometric matching process involves user privacy, to ensure data security and user privacy, this matching process can be performed by a trusted application within a trusted execution environment (TEA). Therefore, before step S100, the client can send a secure memory registration instruction to the trusted application within the TEA for biometric matching via the processor trusted framework unit. After the secure memory registration is completed via the memory protection controller in step S102, the trusted application, upon receiving the secure memory registration completion information, can send a notification to the client via the processor trusted framework unit that the secure memory registration is complete. Upon receiving this notification, the client can determine that the trusted application within the TEA is ready and can proceed with the login process. It can then call the interface of the general execution environment to acquire the image to be matched through the device's image sensor and send the image to be matched to the trusted application for biometric matching via the processor trusted framework unit. The trusted application can then store the image to be matched and the target image obtained from the server based on the registered secure memory, and perform the biometric matching process based on this secure memory. The matching result is returned to the client via the processor trusted framework unit.
[0069] based on Figure 1The method for dynamically configuring secure memory, as shown in this specification, involves a client in a general execution environment sending a secure memory registration instruction to a trusted application in a trusted execution environment. This registration instruction carries the memory address requested by the client. Based on the registration instruction, the trusted application invokes the registration interface of the trusted execution environment's operating system to send a secure memory registration request to the processor's trusted framework unit. This causes the processor's trusted framework unit to update the attributes of the memory space corresponding to the memory address to secure attributes based on the registration request.
[0070] As can be seen from the above method, when the client processes business involving sensitive data, the business is transferred to a trusted application within a trusted execution environment. Before the trusted application processes the data, the client estimates the amount of secure memory required to process the business and then configures the secure memory accordingly. In other words, by configuring secure memory in real-time, memory waste is reduced, memory utilization is improved, and the goal of protecting sensitive information is achieved.
[0071] In addition, in step S102, when the trusted application calls the registration interface of the operating system of the trusted execution environment, in order to improve security, the trusted application can also be authenticated. When it is determined that the trusted application has the permission to register secure memory, the registration interface generates a registration request to be sent to the trusted framework unit of the processor.
[0072] Specifically, in order to authenticate trusted applications calling the system's interfaces, the operating system of this trusted execution environment can pre-configure a list of trusted applications for each interface. The lists of trusted applications for different interfaces are not entirely the same and can be set as needed; this manual does not impose any restrictions.
[0073] Therefore, the registration interface of the operating system in this trusted execution environment can also be configured with a list of trusted applications. This list includes the identifiers of trusted applications authorized to call the registration interface. Upon receiving a call request, the registration interface of the operating system in this trusted execution environment can determine the identifier of the trusted application carried in the call request and compare it with the identifiers in the trusted application list to determine whether the trusted application is authorized to call the registration interface.
[0074] The registration interface compares the identifier carried by the trusted application with the identifiers in the trusted application list. If the identifier of the trusted application matches the identifier of any trusted application in the list of trusted applications authorized to call it, then the trusted application is deemed authorized to call the registration interface, and the registration interface accepts the call. That is, the code corresponding to the registration interface is executed based on the trusted application's call request, performing the corresponding business logic. If the identifier of the trusted application does not match the identifiers of any trusted application in the list of authorized trusted applications, then the trusted application is deemed unauthorized to call the registration interface, and the call is rejected. Furthermore, the operating system of the trusted execution environment can send an error message to the trusted application, which helps the trusted application determine that it is not authorized to call the registration interface.
[0075] For example, suppose the trusted execution environment contains three trusted applications: trusted application A, trusted application B, and trusted application C. Trusted application A carries an identifier of 1, trusted application B carries an identifier of 2, and trusted application C carries an identifier of 3. The registration interface M contains a list of trusted applications authorized to call the registration interface M itself, and this list includes identifiers 1 and 2. If trusted applications A, B, and C all send call requests to the registration interface M, then upon receiving each call request, the registration interface M can compare the identifiers of the trusted applications with the trusted application list, based on the identifiers 1, 2, and 3 carried in the call request and its own list of trusted applications. Based on the comparison results, it can be determined that trusted applications A and B can call the registration interface M. However, since identifier 2 does not match any identifier in the trusted application list, trusted application B is not authorized to call the registration interface M. Therefore, the registration interface M accepts calls from trusted applications A and B, sends an error message to trusted application C, and rejects the call from trusted application C.
[0076] Furthermore, when the operating system of the trusted execution environment sends an error message to the trusted application, the trusted application can determine that it cannot continue executing the business logic. Alternatively, the trusted application can use the processor trusted framework unit to return the result of being unauthorized to call the registered interface to the client. The client can then confirm that the business execution has failed and can further display the result of being unauthorized to call the registered interface, allowing the user who initiated the business to confirm that there is a problem with the business execution.
[0077] Furthermore, in one or more embodiments of this specification, the processor trusted framework unit typically does not have the function of changing the attribute of memory to a secure attribute when secure memory is not configured. To achieve the function described in step S102 where the processor trusted framework unit, based on the registration request, calls the memory protection controller to determine the contiguous physical addresses in the free memory storage space to be registered as secure memory, the code of the processor trusted framework unit can be updated in advance. By updating, code is added to the processor trusted framework unit to implement the above-mentioned secure memory registration function, such as the interface code for the registration interface and the code for updating the memory attributes. This allows the processor trusted framework unit to execute the operation described in step S102 after receiving the registration request, calling the memory protection controller to register secure memory in real time. This enables dynamic configuration of secure memory and improves the memory utilization of the device.
[0078] based on Figure 1 The illustrated process for dynamically configuring secure memory is further illustrated in this specification's embodiments, which also provide a process for dynamically configuring secure memory executed by the operating system of a trusted execution environment, such as... Figure 3 As shown, the specific steps include:
[0079] S200: Receive a call request from a trusted application to the registration interface, the call request carrying the memory address requested by the client in the general execution environment.
[0080] In one or more embodiments of this specification, the process of dynamically configuring secure memory is described using the operating system of the device's trusted execution environment as the execution entity. In one or more embodiments of this specification, the dynamically configured secure memory is intended to support trusted applications in executing business logic, rather than to support the system's operation. Therefore, the operating system of this trusted execution environment can receive calls from trusted applications to the registration interface. These calls carry memory addresses requested by clients in the general execution environment. The specific process and reasons for clients in this general execution environment requesting memory addresses have been explained above and will not be repeated here.
[0081] After the client determines the memory address, the client can distribute the memory address to the trusted application via the processor trusted framework unit. The trusted application can then request to call the registration interface of the operating system of the trusted execution environment and send the memory address to the operating system of the trusted execution environment.
[0082] In addition, before the operating system of the trusted execution environment executes business logic through the code of the registered interface according to the call request, it can determine whether the trusted application has the right to call the registered interface by using the identifier of the trusted application carried in the call request.
[0083] Specifically, in order to authenticate trusted applications calling the system's interfaces, the operating system of this trusted execution environment can pre-configure a list of trusted applications for each interface. The lists of trusted applications for different interfaces are not entirely the same and can be set as needed; this manual does not impose any restrictions.
[0084] Therefore, the registration interface of the operating system in this trusted execution environment can also be configured with a list of trusted applications. This list includes the identifiers of trusted applications authorized to call the registration interface. Upon receiving a call request, the registration interface of the operating system in this trusted execution environment can determine the identifier of the trusted application carried in the call request and compare it with the identifiers in the trusted application list to determine whether the trusted application is authorized to call the registration interface.
[0085] The specific authentication process described above includes the following steps: The registration interface compares the identifier carried by the trusted application with the identifiers in the trusted application list. If the identifier carried by the trusted application matches the identifier of any trusted application in the list of trusted applications authorized to call itself contained in the registration interface, then the trusted application is determined to be authorized to call the registration interface, and the registration interface accepts the call from the trusted application. That is, the code corresponding to the registration interface is executed according to the call request of the trusted application, and the corresponding business logic is performed. If the identifier carried by the trusted application does not match the identifiers of any trusted application in the list of trusted applications authorized to call itself contained in the registration interface, then the trusted application is determined not to be authorized to call the registration interface, and the call from the trusted application is rejected. Furthermore, the operating system of the trusted execution environment can also send an error message to the trusted application, which is used to help the trusted application determine that it is not authorized to call the registration interface.
[0086] For example, suppose the trusted execution environment contains three trusted applications: trusted application A, trusted application B, and trusted application C. Trusted application A carries an identifier of 1, trusted application B carries an identifier of 2, and trusted application C carries an identifier of 3. The registration interface M contains a list of trusted applications authorized to call the registration interface M itself, and this list includes identifiers 1 and 2. If trusted applications A, B, and C all send call requests to the registration interface M, then upon receiving each call request, the registration interface M can compare the identifiers of the trusted applications with the trusted application list, based on the identifiers 1, 2, and 3 carried in the call request and its own list of trusted applications. Based on the comparison results, it can be determined that trusted applications A and B can call the registration interface M. However, since identifier 2 does not match any identifier in the trusted application list, trusted application B is not authorized to call the registration interface M. Therefore, the registration interface M accepts calls from trusted applications A and B, sends an error message to trusted application C, and rejects the call from trusted application C.
[0087] Furthermore, when the operating system of the trusted execution environment sends an error message to the trusted application, the trusted application can determine that it cannot continue executing the business logic. Alternatively, the trusted application can use the processor trusted framework unit to return the result of being unauthorized to call the registered interface to the client. The client can then confirm that the business execution has failed and can further display the result of being unauthorized to call the registered interface, allowing the user who initiated the business to confirm that there is a problem with the business execution.
[0088] S202: Generate a registration request based on the call request, send the registration request to the processor trusted framework unit, and cause the processor trusted framework unit to update the attributes of the memory space corresponding to the memory address to security attributes according to the registration request.
[0089] Because the operating system of a Trusted Execution Environment (TEE) is an isolated environment, it typically cannot directly update the memory attributes of a device; that is, the TEE's operating system cannot directly configure secure memory. Therefore, in one or more embodiments of this specification, after the TEE's operating system receives the call request through the registration interface, it generates a registration request based on the business logic corresponding to the registration interface and the memory address carried in the call request. The operating system then sends the registration request to the processor's trusted framework unit, which in turn calls the memory protection controller to update the memory space's attributes to secure attributes, thus ensuring that the memory is only accessible to trusted applications.
[0090] Specifically, firstly, the operating system of the trusted execution environment can determine the memory address based on the registration interface called by the trusted application. Then, based on the business logic corresponding to the registration interface, it executes the interface code of the registration interface.
[0091] Then, by running the interface code, the operating system of the trusted execution environment can generate a registration request based on the memory address carried in the call request.
[0092] Finally, the operating system of the trusted execution environment sends the registration request to the processor trusted framework unit, which in turn calls the memory protection controller to update the memory space attributes to security attributes.
[0093] Typically, the trusted processor framework unit (TFR) lacks the capability to change memory attributes to secure attributes without configuring secure memory. To enable the TFR to determine the contiguous physical addresses of memory to be registered as secure memory within the available storage space by invoking the memory protection controller upon receiving a registration request, the TFR's code can be updated beforehand. This update adds code to the TFR to implement the secure memory registration function. For example, the interface code for the registration process and the code for updating memory attributes allow the TFR to execute the above operations upon receiving the registration request, invoking the memory protection controller to register the secure memory in real time. This enables dynamic configuration of secure memory and improves the device's memory utilization.
[0094] In one or more embodiments of this specification, the memory protection controller has the function of updating the attributes of the memory space. Under the call of the processor trusted framework unit, it can determine the corresponding contiguous physical address based on the memory address and update the attributes of the contiguous physical address to security attributes. Afterwards, the memory protection controller can return confirmation information to the processor trusted framework unit. Upon receiving the confirmation information, the processor trusted framework unit returns information indicating that secure memory registration is complete to the operating system of the trusted execution environment. Upon receiving this information, the operating system of the trusted execution environment maps the memory address, i.e., maps the contiguous physical address, generating a corresponding mapping table. This mapping table contains the virtual address corresponding to the contiguous physical address and the mapping relationship between the two. This specification does not limit the mapping relationship. That is, when mapping the contiguous physical address, the mapping relationship can be A to A or other logical relationships, as long as it reflects the mapping of the contiguous physical address. After converting the physical address to a virtual address, the secure memory registration completion information and the virtual address are returned to the trusted application. After receiving the secure memory registration completion information and the virtual address, the trusted application determines that it can jointly execute secure services with the client.
[0095] Furthermore, the Trusted Execution Environment (TEX) operating system can verify the registration request sent to the processor's Trusted Framework Unit (TFR), and the TFR can verify the received registration request before proceeding to the next step. If the verification fails, an error message is returned to indicate a potential security vulnerability. Of course, since the technology for inter-program verification (e.g., authentication) is already quite mature, this specification will not elaborate further, nor does it limit the specific verification method used.
[0096] based on Figure 1The illustrated process for dynamically configuring secure memory, along with an embodiment of this specification, also provides a process for dynamically configuring secure memory executed by a processor trusted framework unit, such as... Figure 4 As shown, the specific steps include:
[0097] S300: Receives a registration request sent by the operating system of the trusted execution environment, the registration request containing a memory address.
[0098] In one or more embodiments of this specification, before the processor trusted framework unit receives the secure memory registration request sent by the operating system of the trusted execution environment, it first receives a registration instruction sent by a client in the general execution environment and forwards the registration instruction to the trusted application. The registration instruction carries a contiguous memory address obtained by the client from a request to the contiguous memory allocator. The process by which the client obtains the contiguous memory address and the reason for forwarding the registration instruction through the processor trusted framework unit have been explained above and will not be repeated here. After receiving the registration instruction, the trusted application sends a call request to the operating system of the trusted execution environment. The operating system of the trusted execution environment generates a registration request based on the call request and sends the registration request to the processor trusted framework unit. The registration request includes the memory address.
[0099] S302: Based on the registration request, update the attributes of the memory space corresponding to the memory address to security attributes.
[0100] The processor's trusted framework unit sends a call instruction to the memory protection controller based on the registration request. This call instruction carries the memory address. The memory protection controller, based on the call instruction from the processor's trusted framework unit, determines the memory address and identifies contiguous physical addresses from free memory space to be registered as secure memory. It then updates the attributes of the identified contiguous physical addresses to secure attributes. The specific process by which the memory protection controller updates the memory space attributes to secure attributes has been described in detail and will not be repeated here.
[0101] Additionally, the computer device contains an electronic component with its own storage space. This storage space contains memory configuration information. After the electronic component is started, it determines, based on this configuration information, which memory is secure, which is insecure, and the list of services that the processor is authorized to access when executing corresponding business operations. In one or more embodiments of this specification, the processor must first undergo authentication by the electronic component before accessing secure memory. The specific authentication process is as follows: Before accessing secure memory, the processor sends a request to access the secure memory to the electronic component. After receiving the access request, the electronic component compares its own stored list of services authorized to access secure memory with the requested service. If the service exists in the list of services authorized to access secure memory stored by the electronic component, it is determined that the processor processing the service is authorized to use the secure memory, and access to secure memory is permitted. If the service does not exist in the list of services authorized to access secure memory stored by the electronic component, it is determined that the processor processing the service is not authorized to use the secure memory, and access to secure memory is denied.
[0102] In this specification, the electronic component no longer performs this authentication operation at startup. Instead, authentication is performed in real time, and the memory protection controller sends memory attribute change information to the electronic component. Based on this information, the electronic component stores the memory information that has been changed to secure memory and the corresponding service list. After the information changes, when the electronic component authenticates the processor, it determines whether the processor has the right to access the secure memory based on the latest memory information.
[0103] After the attributes of the contiguous physical address are updated to security attributes and the electronic component changes its memory information, the subsequent steps will not be repeated.
[0104] based on Figure 1 , Figure 3 as well as Figure 4 The process for dynamically configuring secure memory is illustrated in the embodiments of this specification. A device diagram for dynamically configuring secure memory is also provided, as shown below. Figure 5a As shown, the device for dynamically configuring secure memory has at least the following programs installed: client 400, trusted application 402, operating system 404 of trusted execution environment, and processor trusted framework unit 406.
[0105] The client 400 runs in a generic execution environment (REE), the trusted application 402 and the operating system 404 of the trusted execution environment run in a trusted execution environment (TEE), and the processor trusted framework unit 406 is the middleware between the trusted execution environment and the generic execution environment, used to provide services for the interaction between the trusted application 402 in the trusted execution environment and the client 400 in the generic execution environment.
[0106] The client 400 is used to determine the memory address required to perform business in the trusted execution environment; and sends a registration instruction to the trusted application 402, which carries the memory address.
[0107] The trusted application 402 is used to receive the registration instruction sent by the client 400; and based on the registration instruction carrying the memory address, to generate a call request to invoke the registration interface in the operating system 404 of the trusted execution environment.
[0108] The operating system 404 of the trusted execution environment is used to receive the call request from the trusted application 402 to the registration interface; generate a registration request based on the call request, and send the registration request to the processor trusted framework unit 406.
[0109] The processor trusted framework unit 406 is used to receive the registration request sent by the operating system 404 of the trusted execution environment; and update the attributes of the memory space corresponding to the memory address to security attributes according to the registration request.
[0110] Of course, in one or more embodiments of this specification, such as Figure 5b As shown, the device for dynamically configuring secure memory may also include a memory protection controller 408.
[0111] After receiving the registration request sent by the operating system 404 of the trusted execution environment, the processor trusted framework unit 406 is also used to send a call instruction to the memory protection controller 408 according to the registration request.
[0112] The memory protection controller 408 is used to update the attributes of the memory space corresponding to the memory address to security attributes according to the call instruction.
[0113] The interaction process between the parties involved in the above-mentioned dynamic configuration of secure memory, such as... Figure 6 As shown, the specific steps include:
[0114] S500: The client determines the memory address required to perform business in the trusted execution environment.
[0115] S501: The client sends a registration instruction to the processor trusted framework unit, the registration instruction carrying the memory address.
[0116] In one or more embodiments of this specification, the client determines the memory size required to execute services in the trusted execution environment and sends a memory allocation request carrying that memory size to a contiguous memory allocator. It receives the memory address returned by the contiguous memory allocator. Based on the memory address, it generates a registration instruction. The registration instruction is then sent to the processor trusted framework unit. For details of the above process, please refer to [reference needed]. Figure 1Related descriptions.
[0117] S502: The processor trusted framework unit forwards the registration instruction to the trusted application.
[0118] S503: The trusted application receives a registration instruction sent by the processor's trusted framework unit.
[0119] S504: The trusted application calls the registration interface in the operating system of the trusted execution environment according to the registration instruction.
[0120] After receiving the registration instruction, the trusted application queries the registration interface from the operating system's interface in the trusted execution environment (TEA). It then calls this registration interface, sending the memory address to the TEA's operating system. This causes the TEA's operating system to send a secure memory registration request to the processor's trusted framework unit, carrying the memory address, based on the business logic corresponding to the registration interface. For details of this process, please refer to [link to relevant documentation]. Figure 1 Related descriptions
[0121] S505: The operating system of the trusted execution environment receives the call request from the trusted application to the registration interface.
[0122] S506: The operating system of the trusted execution environment generates a registration request based on the call request and sends the registration request to the processor trusted framework unit.
[0123] Specifically, the operating system of the trusted execution environment generates a registration request based on the business logic corresponding to the registration interface and the memory address carried in the call request. This registration request is sent to the processor trusted framework unit, causing the processor trusted framework unit to invoke the memory protection controller to update the memory space attributes to security attributes. The registration request includes the aforementioned memory address. For details of the above process, please refer to [link / reference needed]. Figure 3 Related descriptions
[0124] S507: The processor trusted framework unit updates the attributes of the memory space corresponding to the memory address to security attributes according to the registration request.
[0125] Specifically, based on the registration request, the processor trusted framework unit invokes the memory protection controller to update the memory space attributes to security attributes. Additionally, this processor trusted framework unit is also used to receive registration instructions sent by the client and forward those instructions to the trusted application.
[0126] based on Figure 1 , Figure 3 as well as Figure 4 The illustrated process for dynamically configuring secure memory is described, and the embodiments in this specification also provide corresponding dynamically configuring secure memory devices, such as... Figure 7 As shown.
[0127] Figure 7 The dynamically configurable secure memory devices provided in this specification include:
[0128] The first receiving module 600 is used to receive a registration instruction for secure memory, wherein the registration instruction carries the memory address requested by the client.
[0129] The memory configuration module 602 is used to call the registration interface of the operating system of the trusted execution environment according to the registration instruction, and send a registration request for secure memory to the trusted framework unit of the processor, so that the trusted framework unit of the processor updates the attribute of the memory space corresponding to the memory address to a secure attribute according to the registration request.
[0130] The second receiving module 604 is used to receive a virtual address returned by the operating system of the trusted execution environment, so as to call the secure memory execution service according to the virtual address, wherein the virtual address is a virtual address determined by the operating system of the trusted execution environment and has a mapping relationship with the memory address.
[0131] Optionally, the first receiving module 600 is specifically used to receive a registration instruction for secure memory forwarded by the processor trusted framework unit, wherein the registration instruction is sent by a client in the general execution environment calling the interface of the processor trusted framework unit; wherein the memory address is obtained by the client sending a request to the contiguous memory allocator.
[0132] Optionally, the memory configuration module 602 is specifically used to query the registration interface from the interface of the operating system of the trusted execution environment according to the registration instruction; call the registration interface to send the memory address to the operating system of the trusted execution environment, so that the operating system of the trusted execution environment sends a registration request for secure memory to the trusted framework unit of the processor according to the business logic corresponding to the registration interface, and the registration request carries the memory address.
[0133] based on Figure 1 , Figure 3 as well as Figure 4 The illustrated process for dynamically configuring secure memory is described, and the embodiments in this specification also provide corresponding dynamically configuring secure memory devices, such as... Figure 8 As shown.
[0134] Figure 8 The dynamically configurable secure memory devices provided in this specification include:
[0135] The receiving module 700 is used to receive a call request from a trusted application to the registration interface, wherein the call request carries the memory address requested by the client in the general execution environment;
[0136] The memory configuration module 702 is used to generate a registration request based on the call request, send the registration request to the processor trusted framework unit, and cause the processor trusted framework unit to update the attributes of the memory space corresponding to the memory address to security attributes based on the registration request.
[0137] Optionally, the memory configuration module 702 is specifically used to generate a registration request based on the business logic corresponding to the registration interface and the memory address carried in the call request; send the registration request to the processor trusted framework unit, so that the processor trusted framework unit calls the memory protection controller to update the attributes of the memory space to security attributes, wherein the registration request includes the memory address.
[0138] Optionally, the memory configuration module 702 is further configured to, after determining that the attribute of the memory space corresponding to the memory address is updated to a security attribute, generate a virtual address corresponding to the memory address, and determine the correspondence between the memory address and the virtual address; return the virtual address to the trusted application, so that the trusted application can call the secure memory according to the virtual address when executing business.
[0139] based on Figure 1 , Figure 3 and Figure 4 The illustrated process for dynamically configuring secure memory is described, and the embodiments in this specification also provide corresponding dynamically configuring secure memory devices, such as... Figure 9 As shown.
[0140] Figure 9 The dynamically configurable secure memory devices provided in this specification include:
[0141] The forwarding module 800 is used to receive a registration instruction sent by a client in a general execution environment, wherein the registration instruction carries a contiguous memory address obtained by the client from a request sent to a contiguous memory allocator; and forwards the registration instruction to the trusted application.
[0142] The receiving module 802 is used to receive a registration request sent by the operating system of the trusted execution environment, wherein the registration request includes a memory address;
[0143] The memory configuration module 804 is used to update the attributes of the memory space corresponding to the memory address to security attributes according to the registration request.
[0144] Optionally, the memory configuration module 804 is specifically used to call the memory protection controller according to the registration request to update the attributes of the memory space corresponding to the memory address to security attributes.
[0145] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 , Figure 3 as well as Figure 4 Provides a method for dynamically configuring secure memory.
[0146] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using a hardware physical module. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program a digital system themselves to "integrate" it onto a PLD, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0147] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, ASICs, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0148] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0149] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0150] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0151] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0152] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0153] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0154] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0155] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0156] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0157] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0158] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0159] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0160] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0161] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this application.
Claims
1. A method for dynamically configuring secure memory, the method being applied to a trusted application, the method comprising: The system receives a registration instruction for secure memory sent by the interface of the trusted framework unit of the processor from the client in the general execution environment. The registration instruction carries the memory address requested by the client. According to the registration instruction, the registration interface of the operating system of the Trusted Execution Environment is invoked, so that the operating system of the Trusted Execution Environment sends a registration request for secure memory to the Trusted Framework Unit of the processor, so that the Trusted Framework Unit of the processor sends a call instruction to the memory protection controller according to the registration request, so that the memory protection controller updates the attribute of the memory space corresponding to the memory address to a secure attribute according to the call instruction; The system receives a virtual address returned by the operating system of the trusted execution environment, and invokes the secure memory execution service according to the virtual address, wherein the virtual address is a virtual address determined by the operating system of the trusted execution environment and has a mapping relationship with the memory address.
2. The method as described in claim 1, wherein the memory address is a contiguous memory address obtained by the client from sending a request to the contiguous memory allocator.
3. The method as described in claim 1, wherein, according to the registration instruction, the registration interface in the trusted execution environment system is invoked, causing the operating system of the trusted execution environment to send a registration request for secure memory to the processor trusted framework unit, specifically including: According to the registration instruction, the registration interface is queried from the interface of the operating system of the trusted execution environment; The registration interface is invoked to send the memory address to the operating system of the trusted execution environment. The operating system of the trusted execution environment then sends a registration request for secure memory to the trusted framework unit of the processor according to the business logic corresponding to the registration interface. The registration request carries the memory address.
4. A method for dynamically configuring secure memory, the method being applied to an operating system in a trusted execution environment, the method comprising: The system receives a call request from a trusted application to the registration interface based on a registration instruction. The call request carries the memory address requested by the client in the general execution environment. The registration instruction is sent by the client in the general execution environment to call the interface of the processor trusted framework unit, and the registration instruction carries the memory address requested by the client. A registration request is generated based on the call request, and the registration request is sent to the processor trusted framework unit. The processor trusted framework unit then sends a call instruction to the memory protection controller based on the registration request, so that the memory protection controller updates the attributes of the memory space corresponding to the memory address to security attributes based on the call instruction. After determining that the attribute of the memory space corresponding to the memory address is updated to a security attribute, a virtual address corresponding to the memory address is generated, and the correspondence between the memory address and the virtual address is determined. The virtual address is returned to the trusted application, enabling the trusted application to access secure memory based on the virtual address when performing business operations.
5. The method as described in claim 4, wherein a registration request is generated based on the invocation request, the registration request is sent to the processor trusted framework unit, and the processor trusted framework unit updates the attributes of the memory space corresponding to the memory address to security attributes based on the registration request, specifically including: A registration request is generated based on the business logic corresponding to the registration interface and the memory address carried in the call request; The registration request is sent to the processor trusted framework unit, which instructs the processor trusted framework unit to invoke the memory protection controller to update the attributes of the memory space to security attributes. The registration request includes the memory address.
6. A method for dynamically configuring secure memory, the method being applied to a processor trusted framework unit, the method comprising: Receive a registration instruction sent by a client in a general execution environment, wherein the registration instruction carries the memory address requested by the client; Forward the registration instruction to a trusted application; Receive a registration request sent by the operating system of the trusted execution environment, the registration request containing a memory address; The registration request is used to send a call instruction to the memory protection controller, so that the memory protection controller can update the attribute of the memory space corresponding to the memory address to a security attribute according to the call instruction; Wherein, after the operating system of the trusted execution environment determines that the attribute of the memory space corresponding to the memory address is updated to a security attribute, it returns a virtual address to the trusted application, so that the trusted application can call the secure memory according to the virtual address when executing business. The virtual address is a virtual address determined by the operating system of the trusted execution environment and has a mapping relationship with the memory address.
7. The method as described in claim 6, wherein the registration instruction carries the contiguous memory addresses obtained by the client from sending a request to the contiguous memory allocator.
8. A device for dynamically configuring secure memory, the device comprising a client in a general execution environment, an operating system in a trusted execution environment, a trusted application and a processor trusted framework unit, and a memory protection controller, wherein: The client is used to determine the memory address required to perform business operations in the trusted execution environment; The interface of the processor trusted framework unit is invoked to send a registration instruction to the trusted application, the registration instruction carrying the memory address; The trusted application is used to receive the registration instruction; Based on the registration instruction carrying the memory address, a call request is generated to invoke the registration interface in the operating system of the trusted execution environment; The operating system of the trusted execution environment is used to receive the call request from the trusted application to the registration interface; A registration request is generated based on the invocation request, and the registration request is sent to the processor trusted framework unit; The processor trusted framework unit is used to receive the registration request sent by the operating system of the trusted execution environment; A call instruction is sent to the memory protection controller according to the registration request; The memory protection controller is used to update the attributes of the memory space corresponding to the memory address to security attributes according to the calling instruction; The operating system of the trusted execution environment is further configured to generate a virtual address corresponding to the memory address and determine the correspondence between the memory address and the virtual address after determining that the attribute of the memory space corresponding to the memory address is updated to a security attribute; Return the virtual address to the trusted application; The trusted application is also used to receive a virtual address sent by the system of the trusted execution environment, so as to invoke the secure memory to perform services according to the virtual address.
9. The device as described in claim 8, wherein the client is specifically configured to determine the memory size required to perform services in the trusted execution environment, send a memory allocation request carrying the memory size to a contiguous memory allocator; receive contiguous memory addresses returned by the contiguous memory allocator; generate a registration instruction based on the memory addresses; and send the registration instruction to the processor trusted framework unit; The processor trusted framework unit is also configured to receive the registration instruction sent by the client and forward the registration instruction to the trusted application; The trusted application is specifically used to receive the registration instruction forwarded by the processor's trusted framework unit.
10. The device of claim 8, wherein the trusted application is specifically configured to query a registration interface from the interface of the operating system of the trusted execution environment according to the registration instruction carrying the memory address; generate a call request for the registration interface according to the registration instruction; and send the call request to the operating system of the trusted execution environment.
11. The device as described in claim 8, wherein the operating system of the trusted execution environment is specifically configured to receive the invocation request, determine the registration interface, and generate a registration request based on the business logic corresponding to the registration interface and the memory address carried by the invocation request.
12. The device of claim 8, wherein the processor trusted framework unit is further configured to return confirmation information to the operating system of the trusted execution environment after determining that the attribute of the memory space corresponding to the memory address has been updated to a security attribute; The operating system of the trusted execution environment is further configured to determine, based on the received confirmation information, update the attributes of the memory space corresponding to the memory address to security attributes.
13. A dynamically configurable secure memory device, the device comprising: The first receiving module is used to receive a registration instruction for secure memory sent by the client in the general execution environment calling the interface of the processor trusted framework unit, wherein the registration instruction carries the memory address requested by the client; The memory configuration module is used to call the registration interface of the operating system of the trusted execution environment according to the registration instruction, so that the operating system of the trusted execution environment sends a registration request for secure memory to the trusted framework unit of the processor, and the trusted framework unit of the processor sends a call instruction to the memory protection controller according to the registration request, so that the memory protection controller updates the attribute of the memory space corresponding to the memory address to a secure attribute according to the call instruction; The second receiving module is used to receive a virtual address returned by the operating system of the trusted execution environment, so as to call the secure memory execution service according to the virtual address, wherein the virtual address is a virtual address determined by the operating system of the trusted execution environment and has a mapping relationship with the memory address.
14. A dynamically configurable secure memory device, the device comprising: The receiving module is used to receive a call request from a trusted application to the registration interface according to a registration instruction. The call request carries the memory address requested by the client in the general execution environment. The registration instruction is sent by the client in the general execution environment to call the interface of the trusted framework unit of the processor. The registration instruction carries the memory address requested by the client. The memory configuration module is used to generate a registration request based on the call request, send the registration request to the processor trusted framework unit, and cause the processor trusted framework unit to send a call instruction to the memory protection controller based on the registration request, so that the memory protection controller updates the attribute of the memory space corresponding to the memory address to a security attribute based on the call instruction. The memory configuration module is further configured to determine the virtual address corresponding to the memory address after the attribute of the memory space corresponding to the memory address is updated to a security attribute, and to determine the correspondence between the memory address and the virtual address. The virtual address is returned to the trusted application, enabling the trusted application to access secure memory based on the virtual address when performing business operations.
15. A dynamically configurable secure memory device, the device comprising: The receiving module receives a registration instruction sent by a client in the general execution environment, the registration instruction carrying the memory address requested by the client; Forward the registration instruction to a trusted application; Receive a registration request sent by the operating system of the trusted execution environment, the registration request containing a memory address; The memory configuration module sends a call instruction to the memory protection controller according to the registration request, so that the memory protection controller updates the attribute of the memory space corresponding to the memory address to a security attribute according to the call instruction; Wherein, after the operating system of the trusted execution environment determines that the attribute of the memory space corresponding to the memory address is updated to a security attribute, it returns a virtual address to the trusted application, so that the trusted application can call the secure memory according to the virtual address when executing business. The virtual address is a virtual address determined by the operating system of the trusted execution environment and has a mapping relationship with the memory address.
16. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
A secure memory dynamic management system and method based on a trusted execution environment
CN109426742A
Secure memory expansion method and device, secure memory release method and device and electronic equipment
CN111459673A
A trusted application program running method, an information processing method, a memory allocation method and a memory allocation device
CN112528288A
Timing verification method, electronic equipment and readable storage medium
CN115017495A