Cross-operating-environment communication method and device, electronic equipment and storage medium
The communication between REE and TEE is achieved at the software level based on the RPMSG protocol, which solves the problem that the TEE/REE switching framework cannot be unified in the prior art, improves the adaptability and versatility of cross-hardware platforms, and reduces the coupling degree with the hardware and processor architecture.
Patent Information
- Application Number
- CN202311405709.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-26
- Publication Date
- 2025-04-29
AI Technical Summary
The prior art cannot implement the unified switching framework between TEE/REE, resulting in the inability to improve the adaptability and universality across hardware platforms.
Communication between REE and TEE is realized through the software level based on the RPMSG protocol, data transmission across the operation environment is carried out using the first RPMSG protocol interface and the second RPMSG protocol interface, and switching of the execution environment is realized through the interrupt mechanism.
It improves the versatility of electronic devices' cross-operation environment communication and cross-hardware platform adaptability, reduces the coupling degree with hardware and processor architecture, and realizes cross-environment communication without changing the processor architecture or hardware architecture.
Smart Images

Figure CN119903517A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a communication method and device across operating environments, an electronic device, and a storage medium. Background Art
[0002] With the rapid development of Internet technology and electronic devices, the requirements for the security of the operating environment of electronic devices are becoming higher and higher. For example, the processing of user password input and user account input requires the electronic device to be in a trusted execution environment (TEE). The current framework for switching between the trusted execution environment TEE / rich execution environment (REE) needs to be changed according to the different hardware structures and processor architectures, and it is impossible to achieve uniformity. Therefore, how to improve the versatility and cross-hardware platform adaptability of switching between TEE / REE has become a problem that needs to be solved urgently. Summary of the invention
[0003] The present disclosure provides a communication method and device across operating environments, an electronic device, and a storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a communication method across operating environments is provided, the method comprising:
[0005] In response to detecting an access instruction to sensitive information of an application running in a common execution environment REE, sending an access request to the sensitive information to a second RPMSG protocol interface in a trusted execution environment TEE based on a first RPMSG protocol interface in the REE, and switching the current execution environment from the REE to the TEE;
[0006] Responding, in the TEE, to access the sensitive information based on the access request;
[0007] Based on the second RPMSG protocol interface, the access result of the sensitive information is fed back to the first RPMSG protocol interface in the REE, and the current execution environment is switched from the TEE to the REE.
[0008] In some embodiments, the method further comprises:
[0009] Based on the access instruction, trigger a first interrupt;
[0010] The step of sending the access request for the sensitive information to the second RPMSG protocol interface in the trusted execution environment TEE based on the first RPMSG protocol interface in the REE, and switching the current execution environment from the REE to the TEE includes:
[0011] The second RPMSG protocol interface is triggered based on the first interrupt to receive the access request and switch the current execution environment from the REE to the TEE.
[0012] In some embodiments, the method further comprises:
[0013] According to the first interruption, the running of the application in the REE is suspended and the running state of the application is saved.
[0014] In some embodiments, the method further comprises:
[0015] In response to the access to the sensitive information, triggering a second interrupt;
[0016] Feedback of the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switching the current execution environment from the TEE to the REE, includes:
[0017] The first RPMSG protocol interface is triggered based on the second interrupt to receive the feedback of the access result of the sensitive information, and the current execution environment is switched from the TEE to the REE.
[0018] In some embodiments, the method further comprises:
[0019] According to the second interrupt, the running state of the application in the REE is restored.
[0020] In some embodiments, the first RPMSG protocol interface is located in the kernel layer of the REE, and the method further includes:
[0021] The access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE is sent to the application program located in the application layer of the REE.
[0022] In some embodiments, the kernel layer of the REE further includes a connection interface compatible with the GP specification; and sending the access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE to the application located in the application layer of the REE includes:
[0023] The access result of the sensitive information received based on the first RPMSG protocol interface is forwarded to the application program located in the application layer of the REE through the connection interface.
[0024] In some embodiments, the first RPMSG protocol interface and the second RPMSG protocol interface are generated based on an open asymmetric multi-processing framework OpenAMP, and the first RPMSG protocol interface and the second RPMSG protocol interface communicate through a shared memory.
[0025] According to a second aspect of an embodiment of the present disclosure, a communication device across operating environments is provided, the device comprising:
[0026] A first sending module is configured to, in response to detecting an access instruction to sensitive information of an application running in a common execution environment REE, send an access request for the sensitive information to a second RPMSG protocol interface in a trusted execution environment TEE based on a first RPMSG protocol interface in the REE, and switch a current execution environment from the REE to the TEE;
[0027] an access module configured to respond to access to the sensitive information in the TEE based on the access request;
[0028] A feedback module is configured to feed back the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switch the current execution environment from the TEE to the REE.
[0029] In some embodiments, the apparatus further comprises:
[0030] A first trigger module, configured to trigger a first interrupt based on the access instruction;
[0031] The first sending module is further configured to trigger the second RPMSG protocol interface to receive the access request based on the first interrupt, and switch the current execution environment from the REE to the TEE.
[0032] In some embodiments, the apparatus further comprises:
[0033] The saving module is configured to suspend the running of the application in the REE and save the running state of the application according to the first interruption.
[0034] In some embodiments, the apparatus further comprises:
[0035] A second trigger module, configured to trigger a second interrupt in response to access to the sensitive information;
[0036] The feedback module is further configured to trigger the first RPMSG protocol interface to receive the feedback of the access result of the sensitive information based on the second interrupt, and switch the current execution environment from the TEE to the REE.
[0037] In some embodiments, the apparatus further comprises:
[0038] A recovery module is configured to recover the running state of the application in the REE according to the second interrupt.
[0039] In some embodiments, the first RPMSG protocol interface is located at the kernel layer of the REE, and the apparatus further comprises:
[0040] The second sending module is configured to send the access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE to the application program located in the application layer of the REE.
[0041] In some embodiments, the core layer of the REE further includes a connection interface compatible with the GP specification;
[0042] The second sending module is further configured to forward the access result of the sensitive information received based on the first RPMSG protocol interface to the application program located in the application layer of the REE through the connection interface.
[0043] In some embodiments, the first RPMSG protocol interface and the second RPMSG protocol interface are generated based on an open asymmetric multi-processing framework OpenAMP, and the first RPMSG protocol interface and the second RPMSG protocol interface communicate through a shared memory.
[0044] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0045] A processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method as described in the first aspect above.
[0046] According to a fourth aspect of an embodiment of the present disclosure, there is provided a storage medium, including:
[0047] When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as described in the first aspect above.
[0048] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0049] The disclosed embodiments implement communication between REE and TEE based on the RPMSG protocol at the software level. Since the RPMSG protocol communication method has high adaptability, the disclosed embodiments can improve the versatility of cross-operating environment communication of electronic devices through the RPMSG protocol interface without changing the processor architecture or the electronic device hardware architecture. Through the disclosed embodiments, fewer electronic device hardware platforms can be used, reducing the coupling degree between the cross-operating environment communication of electronic devices and the electronic device hardware and processor architecture, and improving the cross-hardware platform adaptability of the cross-operating environment communication method of electronic devices.
[0050] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0052] Figure 1 It is a schematic diagram of the structure for realizing the conversion between the security domain and the non-security domain in the related technology.
[0053] Figure 2 A flow chart of a communication method across operating environments shown in an embodiment of the present disclosure.
[0054] Figure 3 This is an example diagram of the internal architecture of an electronic device according to an embodiment of the present disclosure.
[0055] Figure 4 The present invention is a flowchart of a communication method across operating environments in an embodiment of the present invention.
[0056] Figure 5 It is a diagram of an operating device of an application shown in an embodiment of the present disclosure.
[0057] Figure 6 It is a block diagram of an electronic device shown in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0059] In the related art, there is a method for realizing conversion between a security domain and a non-security domain by using a security extension of a processor module. Figure 1It is a schematic diagram of the structure for realizing the conversion between the security domain and the non-security domain in the related technology, such as Figure 1 As shown, when the ordinary application module 100 in the non-security domain needs to process sensitive data and services, it needs to initiate a security request first. After the transaction delegation module 104 captures the request, it realizes the communication between the non-security domain and the security domain by calling the communication proxy module 105. In addition, during the communication between the non-security domain and the security domain, it is also necessary to call the security extension abstraction layer 107 to call the TrustZone technology. After the trusted application module 101 in the security domain receives the security request, it further processes the security request, such as opening a security input interface and waiting for the user to enter a user name, password, etc.
[0060] In the above scheme, the security domain and the non-security domain communicate with each other through the communication proxy module 105. The communication proxy module 105 can be a virtual module or a specific hardware architecture. It has different manifestations on different hardware platforms and cannot be adapted to all hardware platforms. In the communication process, it is also necessary to call the security extension abstraction layer 107 to call the TrustZone technology. The security extension abstraction layer 107 is based on the security extension of the processor module, that is, the scheme is highly coupled with the processor architecture.
[0061] In this regard, the present disclosure provides a communication method across operating environments. Figure 2 A flow chart of a communication method across operating environments shown in an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the following steps are included:
[0062] S11, in response to detecting an access instruction to sensitive information of an application running in a common execution environment REE, sending an access request for the sensitive information to a second RPMSG protocol interface in a trusted execution environment TEE based on a first RPMSG protocol interface in the REE, and switching the current execution environment from the REE to the TEE;
[0063] S12, in the TEE, responding to access to the sensitive information based on the access request;
[0064] S13: Feedback the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switch the current execution environment from the TEE to the REE.
[0065] In the disclosed embodiment, the communication method across operating environments can be applied to electronic devices including REE and TEE, wherein the electronic devices include user equipment (UE), mobile devices, user terminals, mobile phones, tablet computers, personal digital assistants (PDAs), handheld devices, computing devices, vehicle-mounted devices, wearable devices, and other electronic devices including REE and TEE. Among them, REE refers to an environment in which the operating system is running, and can run general operating systems (OS) such as Android and IOS, and TEE refers to an independent processing environment with computing and storage functions that can provide security and integrity protection. Since REE is an open environment that is vulnerable to attacks, such as theft of sensitive data, theft of mobile payments, etc., therefore, when processing sensitive information such as user password input and user account input, it is necessary to control the electronic device to be in a TEE with a higher security level. Client applications can be run in REE, and trusted applications corresponding to client applications can be run in TEE.
[0066] In step S11, the electronic device detects an access instruction to sensitive information of an application running in the REE, where the application may be, for example, a payment application, a social application associated with user information, etc., and the sensitive information includes user passwords, user accounts, and other information involving the user's personal privacy.
[0067] In the disclosed embodiment, the electronic device may determine that an access instruction is detected based on the user's operation, for example, the electronic device may determine that an access instruction is detected when it detects a click operation on a payment control on a payment page; in addition, the electronic device may also determine that an access instruction is detected when it determines that the application has executed a step to obtain relevant sensitive information based on the self-executing logic of the application. The access instruction is used to instruct the operating environment of the electronic device to switch from REE to TEE.
[0068] In the disclosed embodiment, after the electronic device detects the access instruction, it switches the current execution environment from REE to TEE, and sends an access request for sensitive information to the second RPMSG protocol interface in TEE based on the first inter-core communication standard (Remote Processor Messaging, RPMSG) protocol interface in REE, and the REE and TEE communicate through the first RPMSG protocol interface and the second RPMSG protocol interface.
[0069] In some embodiments, the first RPMSG protocol interface and the second RPMSG protocol interface are generated based on an open asymmetric multi-processing framework (Open Asymmetric Multi-Processing, OpenAMP), and the first RPMSG protocol interface and the second RPMSG protocol interface communicate through a shared memory.
[0070] In the disclosed embodiments, OpenAMP refers to a standard communication framework for interaction between operating environments of asymmetric multiprocessing systems in embedded systems. OpenAMP includes components that specifically implement cross-core communication, such as RPMSG communication components. Among them, the components that implement cross-core communication communicate based on the RPMSG protocol. The RPMSG protocol defines the standard binary interface used for communication between cores in a heterogeneous multi-core processing system (Asymmetric Multiprocessing, AMP), so it is convenient to use the RPMSG protocol for communication when communicating across operating environments.
[0071] In the embodiment of the present disclosure, the RPMSG protocol interface is formed by encapsulating the cross-core communication framework composed of the components for implementing cross-core communication in OpenAMP (including the first RPMSG protocol interface and the second RPMSG protocol interface), for example, encapsulating it into an RPMSG socket. It should be noted that the RPMSG protocol interface of the embodiment of the present disclosure may comply with the specification of the non-profit industry association (Global Platform, GP).
[0072] In the disclosed embodiment, the first RPMSG protocol interface and the second RPMSG protocol interface can communicate through shared memory. For example, the electronic device can be based on the access instruction of the sensitive information of the application in the REE. The REE sends the relevant data required for the TEE to access the sensitive information to the shared memory through the first RPMSG protocol interface, and the TEE obtains the data from the shared memory through the second RPMSG protocol interface, wherein the relevant data is the data required for the TEE to access the sensitive information, such as when the sensitive data is a user password, the relevant data is user account data, etc.
[0073] In step S12, after the electronic device switches the current execution environment to TEE, it can access sensitive information in TEE based on the access request response. The electronic device can access sensitive information based on the user's operation, such as the user inputting sensitive information through touch, voice, etc. on the display component of the electronic device; in addition, the electronic device can also access sensitive information through the memory in the TEE, for example, using the result corresponding to the access request stored in the memory as a response to the access request.
[0074] In step S13, after accessing sensitive information in TEE, the electronic device can feedback the access result of the sensitive information to the first RPMSG protocol interface in REE based on the second RPMSG protocol interface, and switch the current execution environment from TEE back to REE so that the application running in the REE environment can continue to run.
[0075] The disclosed embodiments implement communication between REE and TEE based on the RPMSG protocol at the software level. Since the RPMSG protocol communication method has high adaptability, the disclosed embodiments can improve the versatility of cross-operating environment communication of electronic devices through the RPMSG protocol interface without changing the processor architecture or the electronic device hardware architecture. Through the disclosed embodiments, fewer electronic device hardware platforms can be used, reducing the coupling degree between the cross-operating environment communication of electronic devices and the electronic device hardware and processor architecture, and improving the cross-hardware platform adaptability of the cross-operating environment communication method of electronic devices.
[0076] In some embodiments, the method further comprises:
[0077] Based on the access instruction, trigger a first interrupt;
[0078] The sending the access request for the sensitive information to the second RPMSG protocol interface in the TEE based on the first RPMSG protocol interface in the REE, and switching the current execution environment from the REE to the TEE, includes:
[0079] The second RPMSG protocol interface is triggered based on the first interrupt to receive the access request and switch the current execution environment from the REE to the TEE.
[0080] In an embodiment of the present disclosure, after the electronic device detects an access instruction to sensitive information of an application running in the REE, the first interrupt is triggered. For example, the electronic device may detect an access instruction to trigger the first interrupt, or the electronic device may detect that the REE sends an access request for sensitive information to the TEE to trigger the first interrupt. Among them, the first interrupt includes interrupts such as FIQ (Fast Interrupt Request) and IRQ (Interrupt Request). In addition, the electronic device may represent the first interrupt with a high level or a low level. In some embodiments, the first interrupt for converting the execution environment from REE to TEE may be set to FIQ, so that after the first interrupt is triggered, the electronic device can quickly trigger the TEE end to receive the access request for sensitive information sent by the REE end, and enable the electronic device to switch the current execution environment from REE to TEE.
[0081] In the disclosed embodiment, since the real-time performance of the interrupt mechanism is good, the TEE end is triggered to receive the access request by triggering the first interrupt, and the electronic device is triggered to switch the current execution environment from REE to TEE, which can improve the execution efficiency of the method of switching the operating environment, and the solution is simple and effective.
[0082] In some embodiments, the method further comprises:
[0083] According to the first interruption, the running of the application in the REE is suspended and the running state of the application is saved.
[0084] In the embodiment of the present disclosure, the electronic device triggers the first interruption, which will suspend the running of the application in the REE and save the running state of the application, that is, save the context environment of the REE, and the context environment of the REE includes the register variables of the current process in the REE, the files opened by the process, memory information, etc. Exemplarily, the running state of the application in the REE is stored in the memory.
[0085] The disclosed embodiment saves the running state of the application before the current execution environment of the electronic device is switched from REE to TEE, so that the running of the application in REE can be restored when the execution environment of the electronic device is switched from TEE back to REE.
[0086] In some embodiments, the method further comprises:
[0087] In response to the access to the sensitive information, triggering a second interrupt;
[0088] Feedback of the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switching the current execution environment from the TEE to the REE, includes:
[0089] The first RPMSG protocol interface is triggered based on the second interrupt to receive the feedback of the access result of the sensitive information, and the current execution environment is switched from the TEE to the REE.
[0090] In an embodiment of the present disclosure, the electronic device triggers a second interrupt in response to access to sensitive information in the TEE. For example, the electronic device may detect that the TEE completes access to the sensitive information, thereby triggering the second interrupt, or the electronic device may detect that the TEE sends the access result of the sensitive information to the REE, thereby triggering the second interrupt. The second interrupt includes interrupts such as FIQ and IRQ. In addition, the electronic device may represent the second interrupt with a high level or a low level. In some embodiments, the second interrupt for converting the execution environment from TEE to REE is set to IRQ, so that after the second interrupt is triggered, the electronic device can trigger the REE end to receive the access result of the sensitive information fed back by the TEE end, and enable the electronic device to switch the current execution environment from TEE to REE.
[0091] In the disclosed embodiment, since the interrupt mechanism has good real-time performance, the REE end is triggered to receive the access result of sensitive information by triggering the second interrupt, and the electronic device is triggered to switch the current execution environment from TEE to REE, which can improve the execution efficiency of the switching method of the operating environment, and the solution is simple and effective.
[0092] In some embodiments, the method further comprises:
[0093] According to the second interrupt, the running state of the application in the REE is restored.
[0094] In the disclosed embodiment, the electronic device triggers the second interruption to restore the running state of the application in the REE, because the running state of the application in the REE was saved based on the first interruption before the execution environment of the electronic device was switched from the REE to the TEE. That is, the context environment of the REE is saved, so the running state of the application in the REE can be restored after the execution environment of the electronic device is switched from the TEE back to the REE. Exemplarily, the running state of the application in the REE is restored by calling the memory.
[0095] The disclosed embodiment of the present invention can restore the running state of the application program in the saved REE in a timely manner when the electronic device execution environment is switched from TEE back to REE by triggering the second interrupt to trigger the electronic device to restore the running state of the application program in the REE.
[0096] In some embodiments, the first RPMSG protocol interface is located in the kernel layer of the REE, and the method further includes:
[0097] The access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE is sent to the application program located in the application layer of the REE.
[0098] In the disclosed embodiment, the first RPMSG protocol interface is located in the kernel layer of REE, and the second RPMSG protocol interface is located in the kernel layer of TEE. After receiving the access result of sensitive information through the first RPMSG protocol interface, REE sends the access result to the application layer so that the user can view and confirm and continue the operation of the application. Exemplarily, when the user checks the access result and confirms that the access result is correct, the access result can be confirmed by touch, voice, etc.; when the user checks the access result and finds that the access result is wrong or the user needs to modify the sensitive information, the user can send an instruction of the error of the sensitive information access result to the electronic device by touch, voice, etc., and re-enter the sensitive information. After the electronic device obtains the new sensitive information, it can re-store the sensitive information, such as deleting the erroneous sensitive information in the memory, and storing the recovered sensitive information in the memory.
[0099] In the disclosed embodiment, REE may send the access result to the application layer directly through the first RPMSG protocol interface, or may first send the access result to other interfaces of the REE kernel layer through the first RPMSG protocol interface, and then send it to the application layer through other interfaces.
[0100] The disclosed embodiment of the present invention can facilitate users to learn the access results of sensitive information and make corresponding adjustments by sending the access results of sensitive information to the application program in the application layer, so as to promote the subsequent operation of the application program.
[0101] In some embodiments, the kernel layer of the REE further includes a connection interface compatible with the GP specification; and sending the access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE to the application located in the application layer of the REE includes:
[0102] The access result of the sensitive information received based on the first RPMSG protocol interface is forwarded to the application program located in the application layer of the REE through the connection interface.
[0103] In the disclosed embodiment, the first RPMSG protocol interface may not be able to communicate with the application layer, and the GP specification is a set of specifications defined for application layer applications (such as client applications and trusted applications) for connecting the kernel layer and the application layer, and is unrelated to the kernel layer (including the REE kernel layer and the TEE kernel layer). Therefore, in the disclosed embodiment, the application layer and the kernel layer can be connected through a connection interface compatible with the GP specification.
[0104] The disclosed embodiment sets a connection interface compatible with the GP specification in the kernel layer of REE, such as TEE driver, which can be compatible with the GP specification in the application layer and can also communicate with the first RPMSG protocol interface. Therefore, the access result of the sensitive information received by the first RPMSG protocol interface can be forwarded to the application in the application layer of REE through the connection interface.
[0105] The disclosed embodiments can improve the convenience and versatility of communication between the REE kernel layer and the application layer by setting a connection interface.
[0106] Figure 3 FIG. 1 is an example diagram of the internal architecture of an electronic device according to an embodiment of the present disclosure. Figure 3 As shown, processor 0 is a processor inside the electronic device, client applications (including client application 1 and client application 2) are client applications running under REE, for example, client application 1 is an application running in REE in the embodiment of the present disclosure, and trusted applications (including trusted application 1 and trusted application 2) are trusted applications corresponding to the client applications running under TEE, for example, trusted application 1 is a trusted application corresponding to client application 1. Figure 3 In the embodiment, the TEE driver belongs to the connection interface of the embodiment of the present disclosure, which is used to connect the application program interface in the application layer and the socket interface of the REE kernel layer. The open asymmetric multi-processing framework refers to a standard communication framework for interaction of an asymmetric multi-processing system operating environment in an embedded system. The cross-core communication framework is implemented based on the inter-core communication standard of the open asymmetric multi-processing framework; the socket interface located in the REE kernel layer belongs to the first RPMSG protocol interface of the embodiment of the present disclosure, and the socket interface located in the TEE kernel layer belongs to the second RPMSG protocol interface of the embodiment of the present disclosure. The socket interface is formed by encapsulating the cross-core communication framework. REE and TEE communicate through the socket interface, and REE and TEE transfer data through shared memory. As mentioned above, the first RPMSG protocol interface and the second RPMSG protocol interface can communicate through shared memory. Figure 3 In the embodiment, fast interrupt / interrupt are both a form of interrupt. As mentioned above, the electronic device triggers the TEE end to receive the access request for sensitive information sent by the REE by triggering the first interrupt, triggers the REE to receive the access result of the sensitive information by triggering the second interrupt, and performs conversion between the REE and the TEE by triggering interrupts (including the first interrupt and the second interrupt).
[0107] Figure 4 This is a flow chart of a cross-operation environment communication method in an embodiment of the present disclosure, which is applied to Figure 3 In electronic devices such as Figure 4 As shown, the following steps are included:
[0108] S21, application layer interface;
[0109] In the embodiment of the present disclosure, the application layer interface may be an interface of an application located at the application layer in the embodiment of the present disclosure, and the application runs in the application layer of the REE. After the electronic device detects an access instruction to sensitive information of the application running in the REE, it may send an access instruction to the sensitive information to the REE kernel layer based on the application layer interface.
[0110] S22, TEE driver;
[0111] In the embodiment of the present disclosure, the TEE driver is located in the REE kernel layer and is a connection interface compatible with the GP specification in the embodiment of the present disclosure. The connection interface is compatible with the GP specification and connects the application layer interface with the first RPMSG protocol interface located in the kernel layer.
[0112] S23, encapsulate the cross-core communication framework as a socket interface;
[0113] In the embodiment of the present disclosure, the cross-core communication framework is encapsulated as a socket interface that complies with the GP specification, and the socket interface is the first RPMSG protocol interface of the embodiment of the present disclosure. REE and TEE exchange information and implement switching based on the first RPMSG protocol interface and the second RPMSG protocol interface located in the TEE kernel.
[0114] S24, REE sends a message to TEE;
[0115] S25, message notification component;
[0116] In an embodiment of the present disclosure, the electronic device sends an access request for sensitive information to a second RPMSG protocol interface in the TEE through a message notification component based on the first RPMSG protocol interface in the REE; wherein the message notification component may be an rptunnotify component.
[0117] S26, security interrupt processing;
[0118] In the disclosed embodiment, REE sends a message to TEE, thereby triggering the electronic device to send an interrupt. The electronic device triggers the TEE end to receive the message sent by REE through the interrupt. The interrupt includes FIQ and IRQ. In the disclosed embodiment, the first interrupt that triggers the electronic device to convert the current execution environment from REE to TEE can be set to FIQ to improve the response speed of REE conversion to TEE.
[0119] S27, context preservation;
[0120] In the disclosed embodiment, before converting the current execution environment of the electronic device from REE to TEE, the context environment of the REE application needs to be saved first so that the operation of the application in the REE can be restored when the electronic device execution environment is switched back from TEE to REE.
[0121] S28, switch to safe state;
[0122] In the disclosed embodiment, after the context environment of the REE application is saved, the current execution environment of the electronic device is converted from REE to TEE.
[0123] S29, receiving message processing;
[0124] In the disclosed embodiment, the TEE side receives the access request for sensitive information sent by the REE side in the form of a triggered interrupt, and responds to the access request for sensitive information in the TEE to access the sensitive information.
[0125] S30, return to safe state;
[0126] In the disclosed embodiment, after the TEE end completes access to sensitive information, the access result of the sensitive information is sent to the REE end, and the current execution environment of the electronic device is converted from TEE to REE.
[0127] S31, context recovery;
[0128] S32, switching to a non-safe state;
[0129] In the disclosed embodiment, while converting the current execution environment of the electronic device from TEE to REE, the previously saved context environment of the REE application is restored to continue the operation of the REE application.
[0130] S33, receiving message processing result;
[0131] In the disclosed embodiment, after switching to the non-secure state, the first RPMSG protocol interface in the REE can receive the message processing result through the message notification component of S25, and the message processing result is the sensitive information access result. After receiving the sensitive information access result, the REE end continues to run the application. In the disclosed embodiment, the REE end can also be triggered to receive the message and convert the current execution environment of the electronic device from TEE to REE by triggering an interrupt.
[0132] In the disclosed embodiment, after detecting an access instruction to sensitive information of an application running in the REE, the electronic device first calls the connection interface and then calls the TEE driver, and the TEE driver then calls the cross-core communication framework encapsulated in the form of a socket interface to achieve cross-core communication between the REE and the TEE. The method of the disclosed embodiment is highly intelligent and can use fewer electronic device hardware platforms, reducing the coupling between the electronic device's cross-operating environment communication and the electronic device's hardware and processor architecture, and improving the cross-hardware platform adaptability of the electronic device's cross-operating environment communication method.
[0133] Figure 5 is a diagram of an operating device of an application shown in an embodiment of the present disclosure, comprising Figure 5 It can be seen that the device includes:
[0134] The first sending module 101 is configured to, in response to detecting an access instruction to sensitive information of an application running in a common execution environment REE, send an access request for the sensitive information to a second RPMSG protocol interface in a trusted execution environment TEE based on a first RPMSG protocol interface in the REE, and switch the current execution environment from the REE to the TEE;
[0135] An access module 102 configured to respond to access to the sensitive information in the TEE based on the access request;
[0136] The feedback module 103 is configured to feed back the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switch the current execution environment from the TEE to the REE.
[0137] In some embodiments, the apparatus further comprises:
[0138] A first trigger module 104, configured to trigger a first interrupt based on the access instruction;
[0139] The first sending module 101 is further configured to trigger the second RPMSG protocol interface to receive the access request based on the first interrupt, and switch the current execution environment from the REE to the TEE.
[0140] In some embodiments, the apparatus further comprises:
[0141] The saving module 105 is configured to suspend the running of the application in the REE and save the running state of the application according to the first interruption.
[0142] In some embodiments, the apparatus further comprises:
[0143] A second trigger module 106, configured to trigger a second interrupt in response to access to the sensitive information;
[0144] The feedback module 103 is further configured to trigger the first RPMSG protocol interface to receive the feedback of the access result of the sensitive information based on the second interrupt, and switch the current execution environment from the TEE to the REE.
[0145] In some embodiments, the apparatus further comprises:
[0146] The recovery module 107 is configured to recover the running state of the application in the REE according to the second interruption.
[0147] In some embodiments, the first RPMSG protocol interface is located at the kernel layer of the REE, and the apparatus further comprises:
[0148] The second sending module 108 is configured to send the access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE to the application program located in the application layer of the REE.
[0149] In some embodiments, the kernel layer of the REE further includes a connection interface compatible with a GP specification interface;
[0150] The second sending module 108 is further configured to forward the access result of the sensitive information received based on the first RPMSG protocol interface to the application program located in the application layer of the REE through the connection interface.
[0151] In some embodiments, the first RPMSG protocol interface and the second RPMSG protocol interface are generated based on an open asymmetric multi-processing framework OpenAMP, and the first RPMSG protocol interface and the second RPMSG protocol interface communicate through a shared memory.
[0152] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0153] Figure 6 8 is a block diagram of an electronic device 800 shown in an embodiment of the present disclosure. For example, the electronic device 800 may be a mobile phone, a mobile computer, etc.
[0154] Reference Figure 6, the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0155] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0156] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0157] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0158] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0159] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0160] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0161] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0162] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0163] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0164] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0165] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the aforementioned cross-operating environment communication method.
[0166] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims above.
[0167] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A communication method across operating environments, characterized in that: The method comprises: In response to detecting an access instruction to sensitive information of an application running in a common execution environment REE, sending an access request to the sensitive information to a second RPMSG protocol interface in a trusted execution environment TEE based on a first RPMSG protocol interface in the REE, and switching the current execution environment from the REE to the TEE; Responding, in the TEE, to access the sensitive information based on the access request; Based on the second RPMSG protocol interface, the access result of the sensitive information is fed back to the first RPMSG protocol interface in the REE, and the current execution environment is switched from the TEE to the REE.
2. The method according to claim 1, characterized in that The method further comprises: Based on the access instruction, trigger a first interrupt; The step of sending the access request for the sensitive information to the second RPMSG protocol interface in the trusted execution environment TEE based on the first RPMSG protocol interface in the REE, and switching the current execution environment from the REE to the TEE includes: The second RPMSG protocol interface is triggered based on the first interrupt to receive the access request and switch the current execution environment from the REE to the TEE.
3. The method according to claim 2, characterized in that The method further comprises: According to the first interruption, the running of the application in the REE is suspended and the running state of the application is saved.
4. The method according to claim 1, characterized in that: The method further comprises: In response to the access to the sensitive information, triggering a second interrupt; Feedback of the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switching the current execution environment from the TEE to the REE, includes: The first RPMSG protocol interface is triggered based on the second interrupt to receive the feedback of the access result of the sensitive information, and the current execution environment is switched from the TEE to the REE.
5. The method according to claim 4, characterized in that The method further comprises: According to the second interrupt, the running state of the application in the REE is restored.
6. The method according to claim 1, characterized in that The first RPMSG protocol interface is located at the kernel layer of the REE, and the method further includes: The access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE is sent to the application program located in the application layer of the REE.
7. The method according to claim 6, characterized in that The kernel layer of the REE also includes a connection interface compatible with the GP specification; the step of sending the access result of the sensitive information received by the first RPMSG protocol interface based on the kernel layer of the REE to the application program located in the application layer of the REE includes: The access result of the sensitive information received based on the first RPMSG protocol interface is forwarded to the application program located in the application layer of the REE through the connection interface.
8. The method according to any one of claims 1 to 7, characterized in that The first RPMSG protocol interface and the second RPMSG protocol interface are generated based on an open asymmetric multi-processing framework OpenAMP, and the first RPMSG protocol interface and the second RPMSG protocol interface communicate through a shared memory.
9. A communication device across operating environments, characterized in that: The device comprises: A first sending module is configured to, in response to detecting an access instruction to sensitive information of an application running in a common execution environment REE, send an access request for the sensitive information to a second RPMSG protocol interface in a trusted execution environment TEE based on a first RPMSG protocol interface in the REE, and switch a current execution environment from the REE to the TEE; an access module configured to respond to access to the sensitive information in the TEE based on the access request; A feedback module is configured to feed back the access result of the sensitive information to the first RPMSG protocol interface in the REE based on the second RPMSG protocol interface, and switch the current execution environment from the TEE to the REE.
10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method as claimed in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as claimed in any one of claims 1 to 8.