Method and apparatus for initializing TEE for trusted application program

By configuring multiple files for trusted applications, specifying different memory usage amounts for each file, and selecting appropriate files to initialize TEE based on target data, the problem of memory usage balance in the prior art is solved, and efficient TEE initialization and target data processing are achieved.

WO2025043920A1PCT designated stage expired Publication Date: 2025-03-06ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/135061
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-31
Filing Date
2023-11-29
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

The prior art is difficult to effectively balance memory usage when initializing a trusted execution environment (TEE), resulting in excessive performance overhead or inability to process target data correctly.

Method used

By preconfiguring multiple files for trusted applications, each specifying a different memory usage, predicting the required amount of memory based on the target data, thereby determining the appropriate target file and initializing the TEE.

Benefits of technology

It realizes that while ensuring that trusted applications can correctly process the target data after TEE initialization, it avoids performance overhead caused by excessive memory usage, thereby quickly completing TEE initialization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023135061_06032025_PF_FP_ABST
    Figure CN2023135061_06032025_PF_FP_ABST
Patent Text Reader

Abstract

A method and apparatus for initializing a TEE for a trusted application program. The trusted application program corresponds to a plurality of pre-stored files, and the first memory usage amounts of trusted application programs specified respectively in the plurality of files are different. The method comprises: acquiring target data to be processed by a trusted application program; predicting the second memory usage amount of the trusted application program on the basis of the target data; determining a target file from among a plurality of files, wherein the first memory usage amount of a trusted application program specified in the target file is not less than the second memory usage amount; and on the basis of the target file, initializing a TEE corresponding to the trusted application program.
Need to check novelty before this filing date? Find Prior Art

Description

Method and apparatus for initializing TEE for trusted applications

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on August 31, 2023, with application number 202311120254.2 and application name “Method and Apparatus for Initializing TEE for Trusted Applications”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of this specification belong to the field of computer technology, and more particularly, to a method and apparatus for initializing a trusted execution environment (TEE) for a trusted application. Background Art

[0003] The file used to initialize the TEE corresponding to a trusted application can specify the memory usage of the trusted application. Accordingly, when initializing the TEE corresponding to the trusted application based on this file, memory space reserved for the trusted application can be requested from the secure memory area in memory based on the specified memory usage.

[0004] Summary of the Invention

[0005] The present invention aims to provide a method and apparatus for initializing TEE for a trusted application.

[0006] In a first aspect, a method for initializing a TEE for a trusted application is provided, wherein the trusted application corresponds to multiple pre-stored files, each of which specifies a different first memory usage of the trusted application. The method includes: obtaining target data to be processed by the trusted application; predicting a second memory usage of the trusted application based on the target data; determining a target file from the multiple files, wherein the first memory usage of the trusted application specified in the target file is not less than the second memory usage; and initializing the TEE corresponding to the trusted application based on the target file.

[0007] In a second aspect, a device for initializing a TEE for a trusted application is provided, wherein the trusted application corresponds to a plurality of pre-stored files, wherein the first memory usage of the trusted application specified by each file is different, and the device includes: a data acquisition unit, configured to acquire target data to be processed by the trusted application; a prediction processing unit, configured to predict the second memory usage of the trusted application based on the target data; a file determination unit, configured to determine a target file from the plurality of files, wherein the first memory usage of the trusted application specified in the target file is not less than the second memory usage; and a configuration processing unit, configured to initialize the TEE corresponding to the trusted application based on the target file.

[0008] In a third aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores executable code / instructions, and when the processor executes the executable code / instructions, the method described in the first aspect is implemented.

[0009] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed in a computing device, the computing device executes the method described in the first aspect.

[0010] In the technical solution provided by the embodiments of this specification, by configuring a trusted application with multiple files that can be used to initialize its corresponding TEE, the first memory usage of the trusted application specified in each of the multiple files is different; when the TEE corresponding to the trusted application needs to be initialized so that the trusted application can process the corresponding target data in the initialized TEE: the second memory usage of the trusted application can be first predicted based on the target data, and then a target file can be determined from multiple files based on the second memory usage, the first memory usage of the trusted application specified in the target file is not less than the second memory usage, and the TEE corresponding to the trusted application is initialized based on the target file. In this way, it is possible to avoid the large performance overhead caused by specifying an excessively large memory usage in the file used to initialize the TEE while ensuring that the initialized TEE can support the trusted application to correctly process the target data. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0012] FIG1 is a schematic diagram illustrating an exemplary process of obtaining multiple files for initializing a TEE corresponding to a trusted application;

[0013] FIG2 is a flowchart of a method for initializing a TEE for a trusted application provided in an embodiment of this specification;

[0014] FIG3 is a schematic diagram of the structure of a device for initializing TEE for a trusted application provided in an embodiment of this specification. DETAILED DESCRIPTION

[0015] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of this specification.

[0016] The TEE is a secure extension of the CPU (Central Processing Unit) hardware that is completely isolated from the outside world. Currently, the industry is paying close attention to TEE solutions, and nearly all major chip and software alliances have their own TEE solutions, such as the TPM (Trusted Platform Module) in software and SGX (Software Guard Extensions), ARM Trustzone, and AMD PSP (Platform Security Processor) in hardware. The TEE acts as a black box, where the executed code and data cannot be viewed, even by the operating system. These operations can only be performed through predefined interfaces within the code.

[0017] Let's take SGX technology as an example. Based on SGX technology, an enclave (or enclave) can be created as a TEE for running trusted applications (i.e., the trusted portion of an application). New processor instructions in the CPU allocate an EPC (Enclave Page Cache) in memory to house the enclave. The memory area corresponding to the EPC is encrypted by the CPU's internal MEE (Memory Encryption Engine). The code and related data of the trusted applications in this memory area can only be decrypted within the CPU core, and the keys used to support encryption and decryption operations are only generated and stored in the CPU when the EPC is started. This shows that the enclave's security boundary only includes the enclave itself and the CPU hardware. Neither privileged nor unprivileged software can access the enclave. Even operating system administrators and VMMs (Virtual Machine Monitors, also known as hypervisors) cannot affect the code and data in the enclave, resulting in an extremely high level of security.

[0018] For applications that need to use TEE, it is usually possible to use the untrusted part of the application (i.e., untrusted application) running outside the TEE to trigger the corresponding driver (e.g., SGX driver) to initialize the TEE corresponding to the trusted application according to the file corresponding to the trusted part of the application (i.e., trusted application); after completing the initialization of the TEE corresponding to the trusted application, the untrusted application can provide target data to the trusted application running in the TEE, so that the trusted application running in the TEE can complete the secure processing of the target data.

[0019] The file corresponding to a trusted application can specify the memory usage of the trusted application. During the process of initializing the TEE based on the file, the memory space for the trusted application can be configured based on the specified memory usage. If the memory usage specified in the file is too small, the trusted application running in the TEE may not be able to correctly process the target data, or even cause the trusted application to exit, thus affecting its usability. If the memory usage specified in the file is too large, it will take a long time to initialize and measure the memory space for the trusted application, making it difficult to quickly initialize the TEE corresponding to the trusted application.

[0020] The embodiments of this specification at least provide a method and device for initializing a TEE for a trusted application. By pre-configuring a trusted application with multiple files that can be used to initialize its corresponding TEE, the first memory usage of the trusted application specified in each of the multiple files is different; when the TEE corresponding to the trusted application needs to be initialized so that the trusted application can process specific target data in the initialized TEE: the second memory usage of the trusted application can be first predicted based on the target data, and then the target file can be determined from the multiple files based on the second memory usage, the first memory usage of the trusted application specified in the target file is not less than the second memory usage, and the TEE corresponding to the trusted application is initialized according to the target file. In this way, it is possible to ensure that the initialized TEE can support the trusted application to correctly process the target data while avoiding the large performance overhead caused by specifying an excessively large memory usage in the file used to initialize the TEE, thereby completing the initialization of the TEE corresponding to the trusted application more quickly.

[0021] For example, consider an application that requires TEE, including an untrusted application A1 that needs to run outside the TEE and a trusted application A2 that needs to run within the TEE. During the compilation phase of trusted application A2, its corresponding source code can be compiled into multiple versions of binary files. Each version of the binary file specifies different memory usage for trusted application A2. As shown in FIG1 , the source code corresponding to the trusted application A2 is written in C language, and the TEE to be used is an enclave created based on SGX technology. First, GCC (GNU Compiler Collection) can be used to compile the source code corresponding to the trusted application A2 to obtain a static library file, where the static library file can be, for example, a ".lib" format file used in a Windows system, or a ".a" format file used in a Linux system. Then, M description files greater than 1 can be configured. A single description file must at least specify the memory usage of the trusted application, and the memory usage of the trusted application A2 specified in different description files is different. Finally, the SGX compilation tool can be used to continue compiling the static library file and the M description files to obtain M dynamic library files corresponding to the M description files. The memory usage of the trusted application A2 specified in any i-th dynamic library file is the same as the memory usage of the trusted application A2 specified in the i-th description file. The dynamic library file can be, for example, a ".dll" format file used in a Windows system, or a ".so" format file used in a Linux system. It can be understood that, except for specifying different memory usages for the trusted application A2, different dynamic library files contain the same logic code for implementing predetermined transactions.

[0022] These M dynamic library files are the M files corresponding to trusted application A2. Later, application A1 or other computer programs running outside the TEE can use these M files as needed to initialize the TEE corresponding to trusted application A2. The number of files M and the memory usage of each trusted application A2 can be appropriately selected based on actual circumstances. For example, the number M can be 6, and the memory usage of application A2 specified in each of the M files can be 16MB, 128MB, 512MB, 1GB, 8GB, and 64GB, respectively.

[0023] The aforementioned process of obtaining multiple files corresponding to the trusted application is merely exemplary, and multiple files corresponding to the trusted application may also be obtained by other means. In summary, the multiple files corresponding to the trusted application are obtained by compiling the same source code corresponding to the trusted application and multiple different first memory usages.

[0024] Figure 2 is a flowchart of a method for initializing a TEE for a trusted application, provided in an embodiment of this specification. The trusted application corresponds to multiple pre-stored files, each of which specifies a different first memory usage for the trusted application. This method can be executed based on an untrusted application running outside the TEE. The untrusted application and the trusted application can be different components of the same application that requires the use of the TEE.

[0025] 2 , the method may include but is not limited to part or all of the following steps S201 to S207 .

[0026] Step S201: Acquire target data to be processed by a trusted application.

[0027] The trusted application may include a linear algorithm model, or may also include other computer programs for implementing predetermined transactions. The linear algorithm model may include, but is not limited to, a logistic regression model, a linear regression model, or at least one network layer of a deep learning model. The following description primarily uses the example of a trusted application including a linear algorithm model.

[0028] When a trusted application includes a linear algorithm model, the target data to be processed by the linear algorithm model can typically be presented in the form of a multidimensional feature matrix. The memory address sizes occupied by different elements in the feature matrix typically need to remain the same, meaning that different elements in the feature matrix correspond to the same amount of data.

[0029] Step S203: predicting a second memory usage of the trusted application according to the target data.

[0030] The specifications of target data expected to be processed by a trusted application in different technical scenarios may vary; accordingly, when different target data need to be processed by a trusted application running in a TEE, the size of the memory space actually required to be used by the trusted application may be different. Take the example of a trusted application including a linear algorithm model: in the process of training the linear algorithm model, a relatively large training data set (i.e., target data) may be used to train it, and the linear algorithm model running in the TEE needs to use a relatively large memory space; in the process of verifying the linear algorithm model, a relatively small verification data set (i.e., target data) may be used to verify it, and the linear algorithm model running in the TEE needs to use a relatively small memory space; in the process of using the linear algorithm model to implement the corresponding prediction transaction, the amount of input data (i.e., target data) that needs to be processed by the linear algorithm model may be much smaller than the aforementioned training data set and verification data set, and the linear algorithm model running in the TEE needs to use an even smaller memory space.

[0031] For example, a trusted application includes a linear algorithm model, and the target data includes a feature matrix to be processed by the linear algorithm model. The second memory usage of the linear algorithm model can be predicted based on the total amount of data weight of the weight coefficient matrix corresponding to the linear algorithm model, the number of rows N, the number of columns D of the feature matrix, and the amount of data itemsize of each individual element included therein. Exemplarily, the second memory usage can be obtained by processing the total amount of data weight, the number of rows N, the number of columns D of the feature matrix, and the amount of data itemsize of each individual element included therein through a pre-trained linear regression model f(weight, N, D, itemsize).

[0032] In the pre-trained linear regression model f(weight, N, D, itemsize), weight, N, D, and itemsize are all variables. The linear regression model also includes corresponding weight coefficients for weight, N, D, and itemsize. For example, the linear regression model can correspond to the following formula 1 or other variations based on the following formula 1. S = w1*weight+w2*N+w3*D+w4*itemsize (1)

[0033] Among them, S represents the second memory usage, w1 represents the weight coefficient of the total data weight of the weight coefficient matrix corresponding to the linear algorithm model, w2 represents the weight coefficient of the number of rows N of the feature matrix, w3 represents the weight coefficient of the number of columns D of the feature matrix, and w4 represents the weight coefficient of the data size itemsize of a single element in the feature matrix.

[0034] The process of training the linear regression model f(weight, N, D, itemsize) is to determine the weight coefficients corresponding to the variables weight, N, D, and itemsize. Multiple sample data can be used for training. In addition to sample values ​​corresponding to the variables weight, N, D, and itemsize, a single sample data piece also includes sample values ​​corresponding to the variable S obtained through actual measurement. The loss function used in the training process can be a minimum sum of squares. The specific process of training a linear regression model can be referenced in related technologies and will not be further described here.

[0035] When the trusted application does not include a linear algorithm model but is other computer program for implementing a predetermined transaction, the second memory usage of the trusted application can also be calculated directly according to the total amount of target data and in accordance with predetermined rules.

[0036] Step S205 : determining a target file from a plurality of files corresponding to the trusted application, wherein a first memory usage of the trusted application specified in the target file is not less than a second memory usage.

[0037] For any file among the multiple files corresponding to the trusted application, if the first memory usage specified by the file is not less than the second memory usage, the file may be used as the target file.

[0038] In order to complete the initialization of the TEE corresponding to the trusted application more quickly, at least one candidate file can be determined from multiple files, and the first memory usage specified in the at least one candidate file is not less than the second memory usage; then a target file is determined from the at least one candidate file, and the first memory usage specified in the target file is the minimum value of the second memory usage specified in the at least one candidate file.

[0039] Take a trusted application including a linear algorithm model as an example, and assume that the memory usage of the trusted application specified in the six files corresponding to the trusted application is 16M, 128M, 512M, 1G, 8G, and 64G respectively.

[0040] During the training of a linear algorithm model, the scale of the training data set that the linear algorithm model needs to process in the TEE is large. The second memory usage predicted based on the training data set may be greater than 8G and less than 64G. At this time, you can select a file with a specified memory usage of 64G as the target file.

[0041] During the verification of a linear algorithm model, the size of the verification dataset that the linear algorithm model needs to process in the TEE is smaller than the training dataset. The second memory usage predicted based on the verification dataset may be greater than 1G and less than 8G. In this case, you can select a file with a specified memory usage of 8G as the target file.

[0042] In the process of using a linear algorithm model to implement a prediction transaction, the scale of the input data that the linear algorithm model needs to process in the TEE is much smaller than the verification data set. The second memory usage predicted based on the input data may be less than 16M. At this time, you can select a file with a specified memory usage of 16M as the target file.

[0043] Step S207: Initialize the TEE corresponding to the trusted application according to the target file.

[0044] Depending on the TEE solution used, the process of initializing the TEE corresponding to the trusted application based on the target file may vary. The following example describes the TEE as an enclave created based on SGX.

[0045] An untrusted application running outside the enclave can pass the address information of the target file to the SGX driver, so that the SGX driver reads the target file from the corresponding location based on the address information of the target file. The SGX driver can then parse the target file to obtain the first memory usage and corresponding logic code specified in the target file. In addition to performing predetermined operations related to the logic code itself, the SGX driver can also trigger the CPU of the computing device to execute hardware instructions to achieve the following: generating an identifier eid of the enclave corresponding to the trusted application; querying a memory space of a corresponding size from the secure memory reserved in the computing device based on the first memory usage specified in the target file, and declaring that the memory space belongs to the identifier eid; initializing the memory space and measuring the memory space; and then completing the initialization of the enclave corresponding to the trusted application, and returning the identifier eid through the SGX driver so that the untrusted application outside the enclave can communicate with the trusted application running in the enclave based on the identifier eid.

[0046] After initializing the TEE corresponding to the trusted application, the trusted application runs in the TEE. Untrusted applications running outside the TEE can pass target data to the trusted application running in the TEE. For example, the SGX driver can pass target data to the trusted application in the enclave based on the identifier eid, allowing the trusted application to process the target data accordingly.

[0047] Based on the same concept as the aforementioned method embodiment, an embodiment of this specification further provides an apparatus 300 for initializing a TEE for a trusted application, wherein the trusted application corresponds to multiple files, and each of the multiple files specifies a different first memory usage of the trusted application. Referring to FIG3 , the apparatus 300 includes: a data acquisition unit 301 configured to acquire target data to be processed by the trusted application; a prediction processing unit 303 configured to predict the second memory usage of the trusted application based on the target data; a file determination unit 305 configured to determine a target file from the multiple files, wherein the first memory usage of the trusted application specified in the target file is not less than the second memory usage; and a configuration processing unit 307 configured to initialize the TEE corresponding to the trusted application based on the target file.

[0048] An embodiment of this specification also provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed in a computing device, the computing device executes the method for initializing TEE for a trusted application provided in any embodiment of this specification.

[0049] An embodiment of this specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code / instructions, and when the processor executes the executable code / instructions, it implements the method of initializing TEE for a trusted application provided in any embodiment of this specification.

[0050] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, 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, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages ​​and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0051] The controller can be implemented in any suitable manner. For example, the controller 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, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as both a software module implementing the method and a structure within the hardware component.

[0052] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0053] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.

[0054] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0055] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.

[0056] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0057] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0058] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0059] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0060] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules 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 technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0061] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0062] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0063] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, unless otherwise inconsistent.

[0064] The foregoing description is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. Those skilled in the art will appreciate that various modifications and variations of one or more embodiments of this specification are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification are intended to be included within the scope of the claims.

Claims

1. A method for initializing a trusted execution environment (TEE) for a trusted application, wherein the trusted application corresponds to a plurality of pre-stored files, wherein the plurality of files each specify a different first memory usage of the trusted application, the method comprising: acquiring target data to be processed by the trusted application; predicting a second memory usage of the trusted application according to the target data; Determine a target file from the plurality of files, wherein a first memory usage of the trusted application specified in the target file is not less than the second memory usage; Initialize the TEE corresponding to the trusted application according to the target file.

2. The method according to claim 1, determining the target file from the plurality of files comprises: Determine at least one candidate file from the multiple files, wherein the first memory usage specified in each of the at least one candidate file is not less than the second memory usage; A target file is determined from the at least one candidate file, wherein a first memory usage specified in the target file is a minimum value of second memory usages respectively specified in the at least one candidate file.

3. The method of claim 1, wherein the trusted application comprises a linear algorithm model.

4. The method according to claim 3, wherein the linear algorithm model comprises: A logistic regression model, a linear regression model, or at least one network layer of a deep learning model.

5. The method according to claim 3, wherein the target data comprises a feature matrix to be processed by the linear algorithm model; The method of predicting the second memory usage of the trusted application based on the target data includes: predicting the second memory usage of the linear algorithm model based on the total amount of data of the weight coefficient matrix corresponding to the linear algorithm model, the number of rows and columns of the feature matrix, and the amount of data of a single element included therein.

6. The method according to claim 5, wherein the second memory usage of the linear algorithm model is predicted based on the total amount of data of the weight coefficient matrix corresponding to the linear algorithm model, the number of rows and columns of the feature matrix, and the amount of data of a single element included therein, comprising: The second memory usage is obtained by processing the total amount of data, the number of rows and columns of the feature matrix, and the amount of data of a single element included therein through a pre-trained linear regression model.

7. The method according to any one of claims 1 to 6, wherein the method is executed by an untrusted application, and the untrusted application and the trusted application are different components of the same application.

8. According to the method according to any one of claims 1-6, the TEE includes an Enclave created based on the Software Guard Extension (SGX) technology.

9. The method according to any one of claims 1 to 6, wherein the plurality of files are a plurality of dynamic library files obtained by compiling the same source code and a plurality of different first memory usages.

10. A device for initializing a trusted execution environment (TEE) for a trusted application, wherein the trusted application corresponds to a plurality of files, wherein the first memory usage of the trusted application specified by each file is different, the device comprising: a data acquisition unit configured to acquire target data to be processed by the trusted application; a prediction processing unit configured to predict a second memory usage of the trusted application according to the target data; a file determining unit configured to determine a target file from the plurality of files, wherein a first memory usage of the trusted application specified in the target file is not less than the second memory usage; A configuration processing unit is configured to initialize the TEE corresponding to the trusted application according to the target file.

11. A computing device, comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 9 is implemented.

12. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computing device, the computing device executes the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method, device and terminal for traceless running of application program on basis of trusted execution environment (TEE)

    CN108021823A

  • A trusted application program running method, an information processing method, a memory allocation method and a memory allocation device

    CN112528288A

  • Implementation system for trusted execution environment of mobile terminal application program

    CN113239329A

  • Method and device for initializing TEE for trusted application program

    CN117076000A