A method, device and computer system for sharing TEE resources based on a virtualized environment

By using the TEE resource sharing method and leveraging the collaborative operation between TEE and the Linux system, the problem of the Android system being unable to directly access the RPMB partition was solved, enabling secure reading of RPMB data in eMMC and ensuring the security and integrity of data transmission.

CN116405218BActive Publication Date: 2025-09-02DONGFENG MOTOR GRP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310296271.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-22
Publication Date
2025-09-02
Estimated Expiration
2043-03-22

AI Technical Summary

Technical Problem

The Android system cannot directly access the RPMB partition in the in-vehicle entertainment system, making data reading difficult.

Method used

By using the TEE resource sharing method, and leveraging the TEE's key operation interface to work in conjunction with the Linux system's Socket server, secure transmission and comparison of RPMB data can be achieved, ensuring data integrity and confidentiality.

Benefits of technology

This invention enables the Android system to securely read RPMB data in eMMC, solving the problem that the Android system cannot directly access the RPMB partition and ensuring the security and integrity of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116405218B_ABST
    Figure CN116405218B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for sharing TEE resources based on a virtualized environment, including the following steps: S1. Android calls a HID layer service program to obtain a key interface; S2. The TEE sends a first data packet to a socket client; S3. The socket client sends the first data packet to a socket server; S4. The socket server obtains a second data packet and sends it to the client; S5. The client compares the first data packet with the second data packet; S6. The client sends the second data; S7. The storage HIDL service sends the second data to Android. The present invention also discloses a device and computer system for sharing TEE resources based on a virtualized environment, which can solve the problem of the Android system reading data stored in the RPMB and can be widely used in vehicle-mounted systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an in-vehicle system, and in particular to a method, device and computer system for sharing TEE resources based on a virtualized environment. Background Art

[0002] Virtualization is a technology that allows multiple operating systems and applications to share a single underlying physical hardware. The hypervisor is the core of all virtualization technologies. It is an intermediate layer of software that runs between the physical server and the operating system, enabling non-disruptive migration of multiple workloads. When the server boots up and executes the hypervisor, it allocates appropriate amounts of memory, CPU, network, and disk resources to each virtual machine and loads the guest operating system for each virtual machine.

[0003] like Figure 1 As shown in the figure, in-vehicle entertainment systems currently utilize virtualization technology as a typical software architecture. For functional safety reasons, hardware devices generally need to be mounted on a Linux system, and the Android system cannot directly access the RPMB partition through the TEE. Currently, no effective solutions have been proposed to address the problems encountered in related technologies. Summary of the Invention

[0004] The purpose of the present invention is to overcome the shortcomings of the above-mentioned background technology and provide a method, device and computer system for TEE resource sharing based on a virtualized environment, so as to solve the problem of Android system reading data stored in RPMB.

[0005] The present invention provides a method for TEE resource sharing based on a virtualization environment, comprising the following steps: S1, an Android client program calls a HAL layer service program storage hidl service to obtain a key operation interface; S2, TEE obtains a first data packet of RPMB through TA and sends it to a Socket client; S3, Android sends the first data packet accessing RPMB to a Socket server in Linux through the Socket client; S4, the Socket server accesses and obtains a second data packet required on an eMMC, and sends the second data packet to TA through the Socket client and teei daemon; S5, TA compares the first data packet with the second data packet, and if they are the same, proceeds to the next step, otherwise returns to step S1; S6, TA sends the second data in RPMB to storage hidl service; S7, storage hidl service sends the second data of RPMB to the Android client program.

[0006] In the above technical solution, the specific process of step S2 is as follows: S21, sending a key reading instruction to TA through the key operation interface of TEE; S22, TA processes the instruction sent by the Android client program and organizes the first data packet accessing RPMB; S23, TA sends the first data packet accessing RPMB to teei daemon; S24, teei daemon forwards the first data packet accessing RPMB to the Socket client.

[0007] In the above technical solution, the specific process of step S4 is as follows: S41, Socket server accesses eMMC, eMMC reads the requested second data from RPMB, and eMMC sends the second data packet containing the second data to Socketserver; S42, Socket server sends the second data packet of RPMB to Socket client; S43, Socketclient sends the second data packet of RPMB to teei daemon; S44, teei daemon sends the second data packet of RPMB to TA.

[0008] In the above technical solution, the first data packet includes the first data and the first random number; the second data packet includes the read second data, the received second random number, and the calculated second signature.

[0009] In the above technical solution, the specific process of step S5 is as follows: S51, the TA compares whether the first random number is consistent with the second random number; S52, if the two random numbers are consistent, the first data and the first random number are combined together to perform a first signature; S53, the first signature is then compared with the second signature sent by the eMMC. If the two signatures are consistent, it can be determined that the second data packet sent by the teei daemon to the TA is the correct data read from the RPMB.

[0010] In the above technical solution, in step S41, the second signature is a signature obtained by calculating and splicing the read second data and the received second random number together using the Secure Key through the HMAC SHA-256 algorithm; in step S52, the first signature is a signature obtained by combining the first data and the first random number together using the Secure Key through the HMAC SHA-256 algorithm.

[0011] In the above technical solution, the first random number and the second random number are both 16-bit random numbers.

[0012] The present invention also provides a device for TEE resource sharing based on a virtualization environment, comprising the following parts: a key operation module: an Android client program calls a hal layer service program storage hidl service to obtain a key operation interface; a TEE data sending module: TEE obtains the first data packet of RPMB through TA and sends it to the Socket client; a Socketclient sending module: Android sends the first data packet accessing RPMB to the Socket server in Linux through the Socket client; a second data sending module: the Socket server accesses and obtains the second data packet required on the eMMC, and sends the second data packet to TA through the Socket client and teei daemon; a data comparison module: TA compares the first data packet with the second data packet, and if they are the same, proceeds to the next step, and if they are different, returns to the key operation module; a TA data sending module: TA sends the second data in RPMB to the storage hidl service; and a final data sending module: the storage hidl service sends the second data of RPMB to the Android client program.

[0013] The present invention further provides a computer system storing a computer program, wherein the computer program executes a method for TEE resource sharing based on a virtualized environment.

[0014] The method, device, and computer system for sharing TEE resources in a virtualized environment of the present invention have the following beneficial effects:

[0015] The present invention uses the RPMB function on the Linux side of the daemon process to send key data to Linux, and Linux then sends the key data to Android, thereby solving the problem of the Android system reading data stored in the RPMB. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A software architecture diagram for applying virtualization technology to existing in-vehicle entertainment and audio-visual systems;

[0017] Figure 2 The software structure diagram of the method for sharing TEE resources based on a virtualized environment of the present invention;

[0018] Figure 3 Schematic diagram of the overall process of the method for sharing TEE resources based on a virtualized environment of the present invention;

[0019] Figure 4 Schematic diagram of the structure of the device for sharing TEE resources based on a virtualized environment of the present invention;

[0020] Figure 5 Schematic diagram of the structure of the computer system of the present invention. DETAILED DESCRIPTION

[0021] The present invention will be further described in detail below with reference to the accompanying drawings and examples, but the examples should not be construed as limiting the present invention.

[0022] like Figure 1 The principles of the prior art architecture shown have been outlined in the background art and will not be repeated here.

[0023] See also Figures 2 to 3 The method for sharing TEE resources in a virtualized environment includes the following steps:

[0024] 1. The Android client program calls the HAL layer service program storage HIDL service to obtain the key operation interface;

[0025] 2. Send a key read instruction to TA through the TEE key operation interface;

[0026] 3. TA processes the instructions sent by the Android client program, organizes access to the first data of RPMB, and generates a first 16-bit random number;

[0027] 4. The TA sends the first data and the first random number for accessing the RPMB to the teei daemon;

[0028] 5. Because RPMB cannot be directly operated in Android, teei daemon forwards the first data and the first random number accessed to RPMB to the socket client;

[0029] 6. Android sends the first data for accessing RPMB and the first random number to the Socket server in Linux through the Socket client;

[0030] 7. The socket server is the real RPMB operating program in Linux and is responsible for accessing the eMMC. The eMMC reads the requested data from the RPMB and uses the Secure Key to calculate the second signature by combining the read second data and the received second random number using the HMAC SHA-256 algorithm. The eMMC then sends the read second data, the received second random number, and the calculated second signature to the socket server.

[0031] 8. The Socket server sends the second data of the RPMB, the second random number, and the second signature to the Socketclient;

[0032] 9. Socket client sends the second data + second random number + second signature of RPMB to teeidaemon;

[0033] 10. The teei daemon sends the second data + second random number + second signature from the RPMB to the TA. The TA first compares the second random number to see if it is consistent with the first random number it sent. If they are consistent, it uses the same Secure Key to sign the first data and the first random number together using the HMAC SHA-256 algorithm. If the obtained first signature is consistent with the second signature sent by the eMMC, it can be determined that the data is correct data read from the RPMB.

[0034] 11. The TA sends the second data in the RPMB to the storage hidl service;

[0035] 12. The storage hidl service sends the second data of RPMB to the Android client program.

[0036] See also Figure 4 , a device for sharing TEE resources based on a virtualized environment, including the following parts:

[0037] Key operation module: The Android client program calls the HAL layer service program storage HIDL service to obtain the key operation interface;

[0038] TEE data sending module: TEE obtains the first data packet of RPMB through TA and sends it to the Socket client;

[0039] Socket client sending module: Android sends the first data packet accessing RPMB to the Socket server in Linux through the Socket client;

[0040] Second data sending module: The Socket server accesses and obtains the required second data packet on the eMMC, and sends the second data packet to the TA through the Socket client and teei daemon;

[0041] Data comparison module: TA compares the first data packet with the second data packet. If they are the same, it proceeds to the next step. If they are different, it returns to the key operation module.

[0042] TA data sending module: TA sends the second data in RPMB to storage hidl service;

[0043] The final data sending module: storage hidl service sends the second data of RPMB to the Android client program.

[0044] See also Figure 5 The computer system of the present invention includes a device for sharing TEE resources based on a virtualized environment, and the device stores a program for executing a method for sharing TEE resources based on a virtualized environment.

[0045] The working principle of the present invention is as follows:

[0046] TEE, or Trusted Execution Environment, is an area on the CPU of a smart terminal. This area provides a more secure space for data and code execution, ensuring confidentiality and integrity. TEE is based on TrustZone, a hardware virtualization technology, and its associated hardware implementation. TrustZone is a product that supports TEE technology, aiming to build a security framework for smart terminals to defend against various potential attacks. TrustZone conceptually divides the SoC's hardware and software resources into two worlds: the secure world and the non-secure world. All operations requiring confidentiality (such as cryptographic processing, data encryption and decryption, and security authentication) are performed in the secure world, while all other operations (such as the user operating system and various applications) are performed in the non-secure world.

[0047] RPMB is a security-rich partition within the eMMC memory, typically used to store data that needs to be protected from tampering. Hosts and devices require signatures and verification when reading and writing to the RPMB. Messages are signed using a MAC, which is derived by signing the message and write counter using the HMAC SHA-256 algorithm with the AuthKey. The message sent is a combination of the MAC, message, and write counter. Protecting RPMB data is crucial because the AuthKey must be explicitly used to access the RPMB. Therefore, reading and writing the RPMB must be done in a TEE environment.

[0048] Due to functional safety requirements, hardware devices need to be mounted on the Linux system. The Android system, as a virtual machine, cannot access the physical RPMB partition. The present invention uses the daemon process of the RPMB function on the Linux side to send key data to Linux, and Linux then sends the key data to Android, thereby solving the problem of the Android system reading data stored in RPMB.

[0049] The technical terms related to the present invention are explained as follows:

[0050] RPMB: (Replay Protected Memory Block) replay memory protection block.

[0051] TEE: (trusted execution environment) Trusted execution environment.

[0052] MAC: (Message Authentication Code) Message Authentication Code.

[0053] TA: (Trust Application) Trusted Application.

[0054] storage hidl service: hal layer service program that provides key operation interface to client programs.

[0055] teei daemon: TEE daemon, responsible for some system monitoring and message forwarding.

[0056] Socket client: Responsible for forwarding RPMB data packets from Android to Linux, because RPMB cannot be directly operated in Android.

[0057] Socket server: The actual RPMB operating program in Linux, which actually writes data to RPMB.

[0058] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

[0059] The contents not described in detail in this specification belong to the prior art known to those skilled in the art.

Claims

1. A method for sharing TEE resources based on a virtualized environment, characterized by: The steps include: S1. The Android client program calls the HAL layer service program storage HIDL service to obtain the key operation interface; S2. TEE obtains the first data packet of RPMB through TA and sends it to the socket client. The specific process of step S2 is as follows: S21. Send a key read instruction to the TA through the TEE key operation interface; S22, TA processes the instruction sent by the Android client program and organizes the first data packet accessing RPMB; S23. The TA sends the first data packet for accessing the RPMB to the teei daemon. S24, teei daemon forwards the first data packet accessing RPMB to the socket client; The first data packet includes the first data and the first random number; the second data packet includes the read second data, the received second random number, and the calculated second signature; S3. Android sends the first data packet accessing RPMB to the Socket server in Linux through the Socket client. S4. The Socket server accesses and obtains the required second data packet on the eMMC, and sends the second data packet to the TA through the Socket client and teei daemon; S5. The TA compares the first data packet with the second data packet. If they are identical, the process proceeds to the next step. If they are different, the process returns to step S1. S6. The TA sends the second data in the RPMB to the storage hidl service; S7. The storage hidl service sends the second data of the RPMB to the Android client program.

2. The method for sharing TEE resources based on a virtualized environment according to claim 1, characterized in that: The specific process of step S4 is as follows: S41. The Socket server accesses the eMMC. The eMMC reads the requested second data from the RPMB and sends a second data packet containing the second data to the Socket server. S42. The Socket server sends the second data packet of the RPMB to the Socket client. S43, the socket client sends the second data packet of RPMB to the teei daemon; S44. Teei daemon sends the second data packet of RPMB to TA.

3. The method for sharing TEE resources based on a virtualized environment according to claim 2, characterized in that: The specific process of step S5 is as follows: S51, TA compares whether the first random number is consistent with the second random number; S52: If the two random numbers are consistent, the first data and the first random number are combined to perform a first signature. S53: Compare the first signature with the second signature sent by the eMMC. If the two signatures are consistent, it can be determined that the second data packet sent by the teei daemon to the TA is correct data read from the RPMB.

4. The method for sharing TEE resources based on a virtualized environment according to claim 3, characterized in that: In step S41, the second signature is a signature obtained by calculating and concatenating the read second data and the received second random number using the Secure Key through the HMAC SHA-256 algorithm; In step S52, the first signature is a signature performed by combining the first data and the first random number using the Secure Key through the HMAC SHA-256 algorithm.

5. The method for sharing TEE resources based on a virtualized environment according to claim 4, characterized in that: The first random number and the second random number are both 16-bit random numbers.

6. A device for sharing TEE resources in a virtualized environment, characterized by: Includes the following parts: Key operation module: The Android client program calls the HAL layer service program storage HIDL service to obtain the key operation interface; TEE data sending module: TEE obtains the first data packet of RPMB through TA and sends it to the Socket client. The specific contents of the TEE data sending module are as follows: Send a key read instruction to TA through the TEE's key operation interface; TA processes the instructions sent by the Android client program and organizes the first data packet accessing RPMB; TA sends the first data packet to teei daemon to access RPMB; The teei daemon forwards the first data packet accessing RPMB to the socket client; The first data packet includes the first data and the first random number; the second data packet includes the read second data, the received second random number, and the calculated second signature; Socket client sending module: Android sends the first data packet accessing RPMB to the Socket server in Linux through the Socket client; Second data sending module: The Socket server accesses and obtains the required second data packet on the eMMC, and sends the second data packet to the TA through the Socket client and teei daemon; Data comparison module: TA compares the first data packet with the second data packet. If they are the same, it proceeds to the next step. If they are different, it returns to the key operation module. TA data sending module: TA sends the second data in RPMB to storage hidl service; The final data sending module: storage hidl service sends the second data of RPMB to the Android client program.

7. A computer system, characterized in that: A computer program is stored, and the computer program executes the method for sharing TEE resources based on a virtualized environment as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Security data storage method and system

    CN104392188A

  • Method and device for accessing RPMB partitions and related equipment

    CN110633055A