Convolutional neural network casual reasoning method based on semi-honesty trusted execution environment

By using inadvertent inference methods of fully homomorphic encryption and lookup table optimization in a semi-honest and trusted execution environment, the computational efficiency and security problems of convolutional neural network inference services are solved, and efficient and secure user input, output and Model confidentiality protection.

CN119047581AInactive Publication Date: 2024-11-29XIDIAN UNIV

Patent Information

Application Number
CN202411138347.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-11-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing convolutional neural network inference services have limitations in computing efficiency, communication efficiency and security, especially in terms of data security and model protection on the TEE side, and traditional privacy protection solutions are difficult to ensure user input and output at the same time. and the confidentiality of the model.

Method used

Using an inadvertent reasoning method based on a semi-honest and trusted execution environment, through fully homomorphic encryption and lookup table optimization, a security protocol is designed to perform CNN calculations on TEE side finite memory, reducing computational overhead, and performing between the REE side and the TEE side Efficient memory conversion ensures the efficiency and security of ciphertext operation.

Benefits of technology

It realizes efficient model inference calculation, reduces homomorphic computing overhead, ensures the confidentiality of user input, output and model, improves computing efficiency and security, is suitable for scenarios with limited memory, supports convolution, activation, pooling and Computation of the fully connected layer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119047581A_ABST
    Figure CN119047581A_ABST
Patent Text Reader

Abstract

The invention provides a convolutional neural network casual reasoning method based on a semi-honest trusted execution environment, and the method comprises the steps: constructing a look-up table corresponding to a first public parameter by a model provider in a safety reasoning service request stage; selecting a second common parameter to create an enclave and initializing the enclave; the data user requests registration from the model provider to apply for the secret key so as to obtain the secret key from the model provider, and the model provider updates the private key correspondingly stored in the enclave; in a security reasoning service query stage, a data user encrypts own data by using a secret key distributed to the data user and transmits the encrypted data to a cloud server; and the cloud server performs linear and nonlinear layer calculation on the transmitted data through an oblivious security protocol to obtain a ciphertext prediction result, and feeds back the ciphertext prediction result to a data user. According to the method, the security of a cryptography and trusted hardware cooperation scheme is improved, the model security is protected, interactive communication is not needed, the calculation overhead related to homomorphic calculation is reduced, and the calculation efficiency is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of network security computing technology, and in particular relates to a convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment. Background Art

[0002] With the rapid development of machine learning and the widespread use of Model as a Service (MaaS) platforms, convolutional neural network (CNN) reasoning services have also received great attention. However, traditional reasoning services based on plaintext data and models are vulnerable to the risk of data and model leakage. In order to protect the security of data and models, privacy-preserving neural network reasoning schemes have been proposed, including interactive and non-interactive privacy-preserving reasoning technology routes. However, these schemes have some limitations in computing efficiency, communication efficiency or security.

[0003] Specifically, in interactive secure reasoning, multi-party secure computing technology is often used to protect data privacy and model privacy. For example, the patent applied for by Wuhan University, "An outsourced convolutional neural network privacy protection system based on secure two-party computing" (application number: CN202010075863.0A, application publication number: CN111324870A), this system randomly distributes the neural network and query data to two servers that do not collude with each other, and realizes image processing through collaborative operations on the two servers. The two image components are input into the two servers, and the triples of random data are used in the convolution layer to hide the information transmitted between the servers. The obfuscation circuit is designed in the activation layer to implement the ReLU function, and then the image is reduced in dimension by average pooling. Finally, the two components of the prediction result are obtained by using the fully connected layer that hides the information with triples. The two components are returned to the user for merging to obtain the desired prediction result. However, this system requires that the two servers remain non-colluding, which introduces new security assumptions. At the same time, during the reasoning process, the two servers need to remain online and communicate frequently, which will introduce huge computational overhead.

[0004] In non-interactive secure reasoning, homomorphic encryption (HE) and trusted execution environment (TEE side) are often used to protect the privacy of data and models. For example, the paper "Optimized privacy-preserving CNN inference with fully homomorphic encryption" published in 2023 implements privacy-preserving neural network reasoning based on fully homomorphic encryption. They designed an optimization method for the convolutional layer to accelerate the calculation of the convolutional layer, and used high-order polynomials to approximate the ReLU activation function to achieve non-interactive neural network reasoning. However, expensive ciphertext operations such as rotation, multiplication, and bootstrapping incur huge computational overhead on the server. Trusted execution environment provides a lighter solution that allows users to create an isolated area (called an enclave) on a remote server where the integrity and confidentiality of data and code are protected at the chip-level security level. For example, the paper "Privacy-preserving neural network inference framework via homomorphic encryption and SGX" published in 2021 proposed a hybrid framework for convolutional neural network (CNN) reasoning based on homomorphic encryption and SGX. They deployed the model into the TEE side and protected it using the confidentiality of the TEE side. To reduce the parameters in the TEE side, they deployed the linear layer into the REE side and the nonlinear layer into the TEE side. The linear computation is done by HE and the nonlinear computation is done in plain text within the TEE side.

[0005] Although these TEE-based works have improved computing efficiency to a certain extent, researchers are still skeptical about the security of data in the TEE side. First, in TEE-side applications, the code can only be trusted after it is published and checked by the user. However, the model provider's (MP) code, as an important intellectual property, is usually kept confidential during the model inference process. To prevent code leakage, the enclave cannot provide users with remote authentication to verify the code. This means that if the model provider uses backdoors or steganography to monitor the data in the enclave, they can easily steal the user's data. In addition, even if the code is provided to the user, it is difficult for the user to audit it as the amount of code continues to increase. To solve this problem, some works believe that the TEE side is honest but curious. For example, the paper "Efficient and privacy preserving neural network prediction scheme with TEE side" published in 2023 uses homomorphic encryption to complete linear calculations in a rich execution environment (REE side), and designs security protocols based on the REE side and TEE side to complete nonlinear calculations. However, its efficiency can be further improved. Summary of the invention

[0006] In order to solve the above problems existing in the prior art, the present invention provides a convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment. The technical problem to be solved by the present invention is achieved through the following technical solutions:

[0007] The present invention provides a convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment, including:

[0008] In the security reasoning service request phase,

[0009] The model provider constructs a lookup table corresponding to the first public parameter of the neural network model; selects the second public parameter of CKKS in the fully homomorphic encryption scheme to create an enclave and initialize the enclave; the enclave stores a private key, the first public parameter and a lookup table corresponding to the first public parameter; the data user requests registration from the model provider to apply for a key, and the model provider generates a key in response to the registration request and distributes it to the data user, and updates the corresponding private key stored in the enclave;

[0010] In the secure reasoning service query phase,

[0011] The data user uses the key distributed to himself to encrypt his own data and transmit it to the cloud server; the cloud server performs linear and nonlinear layer calculations on the transmitted data through the oblivious security protocol to obtain the ciphertext prediction result, and feeds it back to the data user.

[0012] Beneficial effects:

[0013] (1) The present invention efficiently implements model inference calculations while protecting user data and model owner models. First, a secure oblivious protocol is designed to perform CNN calculations securely and efficiently based on the limited memory on the TEE side. Considering this feature, the data is encrypted using HE and stored outside the TEE side, while only the private key is retained on the TEE side. In addition, the designed protocol is designed to adapt to SIMD operations and optimize efficiency. These protocols are carefully designed to improve computing efficiency and minimize the computational overhead associated with homomorphic computing.

[0014] (2) The present invention proposes a lookup table method to optimize the computation of convolution and pooling layers, eliminates the computational overhead caused by ciphertext rotation, and optimizes the lookup table to further reduce the computational overhead. Based on the designed protocol and the proposed optimization method, an oblivious neural network prediction scheme is designed, which can ensure the confidentiality of user input, output and the model itself, and supports various computations including convolution, activation, average / max pooling and fully connected layers.

[0015] (3) The present invention improves the security of existing cryptography and trusted hardware collaboration schemes, making them consistent with the semi-honest security assumption of cryptography, protecting the security of the model, eliminating the need for interactive communication, reducing the computational overhead associated with homomorphic computing, and greatly improving computing efficiency. The designed protocol supports the calculation of convolutional layers, activation layers, average / maximum pooling layers, and fully connected layers in neural networks.

[0016] (4) The present invention encrypts the data uploaded by the user and the prediction results returned by the CSP, ensuring the confidentiality of the user input and output. In addition, the scheme can also ensure the confidentiality of the model itself, that is, the designed oblivious neural network prediction scheme can simultaneously ensure the confidentiality of the user input, output and the model itself.

[0017] (5) The protocol designed by the present invention is carefully designed to improve computational efficiency and minimize the computational overhead associated with homomorphic computation. It is designed to adapt to SIMD operations and optimize efficiency. The proposed lookup table method optimizes the computation of convolutional and pooling layers, eliminates the computational overhead caused by ciphertext rotation, and the optimization of the lookup table further reduces the computational overhead.

[0018] (6) The present invention is suitable for scenarios where the memory on the TEE side is relatively limited. A secure oblivious protocol is designed to perform CNN calculations securely and efficiently based on the limited memory on the TEE side. The data is encrypted using HE and stored outside the TEE side, while the TEE side only retains the private key.

[0019] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a flowchart of a convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment provided by an embodiment of the present invention;

[0021] Figure 2 is a flow chart of a secure inner product protocol provided by an embodiment of the present invention;

[0022] Figure 3 is a flow chart of an inadvertent comparison protocol provided by an embodiment of the present invention;

[0023] Figure 4 It is a framework diagram of a convolutional neural network inadvertent reasoning system based on a semi-honest trusted execution environment provided by an embodiment of the present invention.

[0024] Figure 5 It is a schematic diagram of the implementation process of the convolutional neural network inadvertent reasoning system based on the semi-honest trusted execution environment provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.

[0026] In order to overcome the defects of the prior art, the present invention is based on a convolutional neural network inadvertent reasoning method in a semi-honest trusted execution environment, and introduces the technical concept of the present invention from four aspects: strong privacy protection, low computational overhead, low communication overhead and strong functional implementation.

[0027] Strong privacy protection: Traditional reasoning services based on plaintext data and models are vulnerable to the risk of data and model leakage. Although privacy-preserving neural network reasoning solutions with various technical routes have been proposed and can provide privacy protection for models and data, many solutions still have problems such as it is difficult to find two non-collusive clouds and the data on the TEE side may not be completely secure. Therefore, this solution should provide sufficiently strong protection for the intellectual property rights of the model and the privacy of the data uploaded by the user, further improve the security of the existing solution, and ensure the confidentiality of the user input, output and the model itself under the assumption of the semi-honest TEE side.

[0028] Low computational overhead: Although many existing privacy-preserving neural network inference schemes can protect the security of data and models, they have huge computational overhead, which makes the schemes extremely limited in practical application scenarios. Therefore, when designing an oblivious security protocol, this scheme should reduce computational overhead as much as possible and improve computational efficiency on the basis of achieving privacy protection.

[0029] Low communication overhead: Although many existing privacy-preserving neural network inference schemes protect the security of data and models, they have large communication overhead. Therefore, this scheme should have the lowest possible communication overhead while achieving privacy protection.

[0030] Strong functional implementation: Many existing privacy-preserving neural network inference solutions cannot support all four types of computations: convolution, activation (ReLU), average / max pooling, and fully connected layers. Therefore, this solution should have strong functional implementation and support various computations, including convolution, activation (ReLU), average / max pooling, and fully connected layers.

[0031] The specific details of the solution of the present invention will be described below.

[0032] like Figure 1 As shown, the present invention provides a convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment, including:

[0033] In the security reasoning service request phase,

[0034] The model provider MP constructs a lookup table corresponding to the first public parameter of the neural network model; selects the second public parameter of CKKS in the fully homomorphic encryption scheme to create an enclave and initialize the enclave; the enclave stores a private key, the first public parameter and a lookup table corresponding to the first public parameter; the data user requests registration from the model provider to apply for a key, and the model provider generates a key in response to the registration request and distributes it to the data user, and updates the corresponding private key stored in the enclave;

[0035] It is worth noting that the reasoning method of the present invention involves three-party interactions, namely, the model provider MP, the cloud server CSP, and the data users Users. The cloud server CSP is a service provider that hopes to provide services to users for profit. However, due to the lack of high-quality models, it needs to download an enclave containing public parameters, corresponding lookup tables, and a fully homomorphic cryptographic system from the MP to provide secure reasoning services.

[0036] The model provider MP generates keys for users and updates the keys in the enclave to ensure the freshness of the keys in each inference process, thereby protecting the security of data and models. Data users,Data users who want to obtain inference services register on the MP and request keys, then encrypt the data and send the encrypted data to the CSP to complete the secure inference service.

[0037] In the secure reasoning service query phase,

[0038] The data user uses the key distributed to itself to encrypt its own data and transmit it to the cloud server; the cloud server performs linear and nonlinear layer calculations on the transmitted data through oblivious security protocol interaction to obtain ciphertext prediction results, and feeds back to the data user.

[0039] Among them, when performing linear and nonlinear calculations, the present invention designs an oblivious security protocol between the REE side and the TEE side, and the protocol includes a linear protocol and a nonlinear protocol.

[0040] The application scenario of the present invention has two important characteristics: limited memory and fast interaction. Specifically, the memory in the TEE side is limited, and the interaction between the REE side and the TEE side is more efficient than the traditional interaction, because the interaction in the present invention only involves memory conversion between the REE side and the TEE side, while the traditional interaction involves remote communication. Based on these two characteristics, in the present invention, an oblivious security protocol between the REE side and the TEE side is designed, including a linear transformation layer protocol and a nonlinear transformation layer protocol, which performs CNN calculations securely and efficiently on the basis of limited memory on the TEE side, wherein the TEE side only stores keys, and the data is encrypted using homomorphic encryption (HE) and stored in the REE side. All protocols run between the REE side and the enclave of the MP, and the TEE side is used for the enclave of the MP in the present invention. The REE side and the TEE side strictly follow the instructions during the protocol and cannot obtain any useful plaintext data. In addition, the designed protocol is intended to adapt to single instruction multiple data (SIMD) operations to optimize their efficiency. These protocols are carefully designed to improve computing efficiency and minimize the computing overhead associated with homomorphic computing.

[0041] In a specific implementation of the present invention, the model provider constructs a lookup table corresponding to the first common parameter including:

[0042] The model provider selects a filling mode according to the convolutional layer of the neural network model, and constructs a lookup table corresponding to the first common parameter according to the selected filling mode; the filling mode includes same and valid modes.

[0043] The elements that need to be calculated can be found by constructing a lookup table. This step can be achieved by calling the lookup table construction algorithm. The algorithm input is the public parameter {n,f,u,d}, where n×n and f×f represent the size of the input image and the convolution or pooling kernel, respectively, and u and d represent the size of the stride and padding, respectively. The algorithm output is the index table t. The specific steps of the algorithm include:

[0044] 1) Setup And set

[0045] 2) Initialize the index table to

[0046] 3) Calculation in

[0047] Using the index table t, the elements in the matrix can be quickly found, so that the calculation can be completed using the convolution or pooling kernel, which means that the elements in the matrix do not need special processing. In the convolution or pooling layer, rotation and summation techniques are usually used to implement the corresponding calculations. However, it contains a large number of rotation operations, which will bring huge computational overhead. By constructing an index table for convolution and pooling layer calculations through the above algorithm, and using the index table to sort the ciphertext, complex operations such as ciphertext rotation and multiplication are avoided, thereby improving computational efficiency.

[0048] Considering that the filling mode includes two modes, "same" and "valid", the index table is further optimized in the present invention.

[0049] 1) In the "same" mode, the output size is the same as the input size, which is achieved by padding the convolution matrix with 0. As the convolution kernel moves, many small matrices will be generated, which can filter out elements containing 0 and reduce the number of multiplications. After filtering the matrix and convolution kernel whose elements contain 0 and obtaining the length table, the index table is then expanded and obtained, which contains the index table of the expanded kernel, the index table of the expanded vector, and the length table. When SIPP is used for convolution calculation, the ciphertext vector can be constructed by the index table of the flattened vector, and the plaintext vector can be constructed by the index table of the flattened kernel. Each element in the vector can be derived from the element at the corresponding index in the matrix or kernel. In addition, when the image is small, multiple images can be packed into one ciphertext and SIMD can be used to execute them in parallel. Finally, the inner product summation is performed at the corresponding length position in the ciphertext according to the length in the length table, and SIPP is completed.

[0050] 2) In the "valid" mode, the original image and convolution kernel are fully utilized, so only key indexes can be recorded to reduce storage space. Specifically, when the filling mode is "valid", the matrix does not need to be filled with 0. Similarly, many small matrices can be generated in this mode, and then each matrix can be filtered and the index of the first row of each small matrix can be recorded. This is because the indexes of other rows can be calculated as index i,j =index 1,j +n*(i-1), where i represents the row, j represents the column, 1≤i,j≤f. Next, expand and obtain the flattened vector. In this mode, the length table and index table of the flattened kernel are not required because they are the same. When performing convolution calculations, you need to follow the equation index i,j =index 1,j+n*(i-1) fills the index table, and the ciphertext vector can be constructed through the new index table. For other steps, this mode is consistent with the "same" mode.

[0051] Similarly, lookup tables can be constructed to speed up the calculation of the pooling layer, and all tables can be built in advance.

[0052] In a specific embodiment of the present invention, the selecting the second public parameter of CKKS in the fully homomorphic encryption scheme to create an enclave and initializing the enclave includes:

[0053] Selecting a second public parameter of CKKS in a fully homomorphic encryption scheme; the second public parameter includes a private key;

[0054] Create various parameters in the enclave according to the second public parameters;

[0055] Initialize various parameters in the enclave.

[0056] In a specific embodiment of the present invention, the cloud server performs linear and nonlinear layer calculations on the transmitted data through the oblivious security protocol interaction to obtain the ciphertext prediction result, which includes:

[0057] The cloud server designs linear and nonlinear protocols in the oblivious security protocol. The linear protocols include: secure inner product protocol, secure plaintext multiplication protocol and secure average pooling protocol; the nonlinear protocols include: oblivious comparison protocol, oblivious ReLU protocol and secure maximum pooling protocol;

[0058] It is worth noting that for the linear transformation layer protocol, based on the semi-honesty assumption, the present invention designs a secure inner product protocol (SIPP) for the linear transformation layer, and then implements other protocols on this basis, such as the secure plaintext multiplication protocol (SPMP) and the secure average pooling protocol (SAPP).

[0059] SIPP is used to implement the inner product, assuming that the REE side has the CKKS ciphertext vector The TEE side has the plaintext vector m2 and the key. After executing SIPP, the REE side will obtain the encrypted result of the inner product

[0060] SPMP is used to implement multiplication between two plaintexts. Assume that the REE side has plaintext vector m1 and the TEE side has plaintext vector m2. After executing SPMP, the REE side will obtain the multiplication result

[0061] SAPP is used to calculate the average. Assume that the REE side has the CKKS ciphertext vector The TEE side has the key, and the length of the pooling layer is N, where N is a power of 2. After executing SAPP, the REE side will get the average result

[0062] For the nonlinear transformation layer protocol, based on the semi-honesty assumption, the present invention designs g(x i ), where a given value x i , g(x i ) is defined as the basic comparison function:

[0063]

[0064] Then, the present invention implements other inadvertent comparison protocols based on OCP, such as inadvertent (Oblivious ReLU Protocol) and Secure Maximum Pooling Protocol (SMPP). These protocols are designed to support SIMD technology and improve its efficiency. In addition, the present invention utilizes oblivious functions based on conditional move instructions, including movsd, comisd and cmp, etc., to eliminate branches in the above protocols, aiming to avoid attacks based on branch prediction. In the present invention, the method of introducing oblivious functions based on conditional move instructions is combined with the designed oblivious security protocol, providing a hybrid method to enhance the security of the scheme.

[0065] OCP is used to calculate g(x i ). Assume that the REE side has the CKKS ciphertext vector The TEE side has the key. After executing OCP, the REE side will obtain the encrypted result

[0066] Used to calculate ReLU. Assume that the REE side has the ciphertext value The REE side can be implemented through a secure ReLU protocol Get the encrypted result of ReLU.

[0067] SMPP is used to obtain the maximum value in the pooling layer. Assume that the REE side has the CKKS ciphertext vector The TEE side has the key, and the length of the pooling layer is N, where N is a power of 2.

[0068] The cloud server performs linear calculations on the input data of the corresponding layer using the linear protocol and performs nonlinear calculations on the input data of the corresponding layer using the nonlinear protocol according to the propagation order of the transmitted data in the neural network model, to obtain the ciphertext prediction result.

[0069] In a specific embodiment of the present invention, reference Figure 2 , the calculation process of the secure inner product protocol includes:

[0070] The REE side in the cloud server selects a random vector p and calculates the ciphertext represents the ciphertext vector of CKKS on the REE side, m1 represents the plaintext vector on the REE side, including N components;

[0071] The REE side converts the ciphertext Sent to the TEE side; where each element in p is greater than the square power of the plaintext space p;

[0072] Decryption of ciphertext on TEE side Get the plaintext m1+p and calculate ,in represents component multiplication; m2 represents the plaintext vector on the TEE side, including N components;

[0073] TEE side selects random vector calculate and encrypt it as N is a power of 2, represents the integer ring of length N and modulus p, r1 includes N components;

[0074] The TEE side sends m′+r1 and

[0075] The REE side decodes m′+r1 as:

[0076] REE side calculates and obtains the encrypted result of the inner product

[0077] In a specific implementation of the present invention, the calculation process of the secure plaintext multiplication protocol includes:

[0078] The REE side in the cloud server selects a random vector p and calculates the plaintext m1+p; m1 represents the plaintext vector on the REE side, including N components;

[0079] The REE side sends the plaintext m1+p to the TEE side; wherein each element in p is greater than the square power of the plaintext space p;

[0080] TEE-side calculation ,in represents component multiplication; m2 represents the plaintext vector on the TEE side, including N components;

[0081] TEE side selects random vector and encrypt it as N is a power of 2.

[0082] The TEE side converts m′+r1 and Send to REE side;

[0083] The REE side decodes m′+r1 into m″:

[0084] REE side calculates the multiplication result

[0085] In a specific implementation of the present invention, the calculation process of the security average pool protocol includes:

[0086] The REE side slices the ciphertext into c (1) Send to TEE side and calculate Among them, the ciphertext vector on the REE side is

[0087] TEE side receives c (1) Then, calculate c (1) ·s, get And encrypt it and send it to the REE side; s represents the key polynomial, which contains N components; s i is the i-th component;

[0088] The REE side is calculated by Get the encrypted average.

[0089] In a specific embodiment of the present invention, reference Figure 3 , the calculation process of the inadvertent comparison protocol includes:

[0090] The REE side selects random vectors r1 and r2, both of which contain N components, and encrypts r1; where for each element in r1 and r2, r 1i >r 2i >0 or r 1i <r 2i <0, where 1≤i≤N;

[0091] REE side calculation Will Send to TEE side and calculate

[0092] TEE side reception And calculate

[0093] REE inputs t1, TEE inputs t2, REE and TEE interact to perform the calculation process of the secure plaintext multiplication protocol, and REE obtains t1, t2 includes N components, which are represented by t 1i ,t 2i , 1≤i≤N;

[0094] REE side calculation

[0095] In a specific embodiment of the present invention, the calculation process of the oblivious ReLU protocol includes:

[0096] The REE side calculates the ciphertext through the oblivious comparison protocol

[0097] in,

[0098] According to the expression of ReLU OReLU(m i )=m i ·g(m i ) performs the ciphertext multiplication operation of CKKS to obtain the encryption result of ReLU.

[0099] In a specific implementation of the present invention, the calculation process of the secure maximum pool protocol includes:

[0100] The REE side selects a random vector r containing N components and writes the ciphertext Send to TEE side;

[0101] TEE side Decrypt and split the vector to obtain m1+r1 and m2+r2, expressed as:

[0102]

[0103] Among them, r includes r1 and r2;

[0104] The TEE side encrypts m1+r1 and m2+r2 and returns them to the REE side;

[0105] The REE side eliminates the corresponding noise in the encryption result and obtains

[0106] The REE side and the TEE side are calculated by executing the oblivious ReLU protocol calculation process And calculate

[0107]

[0108] The REE and TEE sides repeat the process of selecting random vectors to calculate the maximum value logN times to obtain the ciphertext in the pooling layer. The maximum value of each component of .

[0109] For example, assuming that the filling mode is "valid", the model connection is as follows: CV→AC→PL→FC. Where CV represents the convolution layer (CV), AC represents the activation layer (AC), PL represents the pooling layer (PL), and FC represents the fully connected layer (FC). Define the input size or length of the i-th layer as n( i )×n( i ) or l( i ), whose output size or length is n( i+1 )×n( i+1 ) or l( i+1 ). The output of the i-th layer will be used as the input of the next layer. Each process is described in detail as follows.

[0110] 1) CV: After receiving the user's encrypted data, the REE side needs to complete the convolution calculation by looking up the table. Before that, the REE side needs to build a ciphertext vector. Therefore, the REE side first adds a random vector to the encrypted data and passes it to the TEE side. Then, the TEE side decrypts it and builds a flattened vector through the index table of the flattened vector. Next, the flattened vector is encrypted and returned to the REE side. Finally, the REE side removes the random data of the encrypted flattened vector through the flattened vector index table to obtain the ciphertext vector. This means that the image vector will be packaged into Through SIPP, CSP can complete the convolution calculation between the flattened vector and the flattened kernel. It only needs to call The result of the convolutional layer can be obtained in one go.

[0111] 2) AC: Assuming ReLU is used as the activation function, the image data is divided into This means that the CSP needs to call times to get the result of the activation layer.

[0112] 3)PL: In the pooling layer, the REE side first constructs the flattened vector by looking up the table like the convolutional layer. Then, the REE side calls times to get the result of the average or max pooling layer.

[0113] 4) FC: In the fully connected layer, the calculation can be regarded as an inner product. Therefore, after obtaining the encrypted flattened vector, CSP can be performed Second, we get the result of the fully connected layer.

[0114] CSP returns the corresponding ciphertext prediction result to the user, and the query is completed.

[0115] The present invention can efficiently realize model reasoning calculation under the premise of ensuring the security of user data and model owner's model. At the same time, the CNN model outsourced by the model provider to the CSP is not affected by the privacy protection mechanism and can be applied in real scenarios.

[0116] In addition, the present invention utilizes oblivious functions based on conditional move instructions to eliminate branches. These instructions are implemented in x86-64, operate only on registers, and support oblivious primitives such as ocmp and ochoose. Since these registers are private to the processor, attackers cannot extract sensitive information by monitoring cache access time. Therefore, it can resist side channel attacks based on branch prediction.

[0117] Combination Figure 4 and Figure 5 ,The present invention also provides a convolutional neural network oblivious reasoning system based on a semi-honest trusted execution environment, including a model provider, a cloud server and a data owner;

[0118] In the security reasoning service request phase,

[0119] The model provider constructs a lookup table corresponding to the first public parameter of the neural network model; selects the second public parameter of CKKS in the fully homomorphic encryption scheme to create an enclave and initialize the enclave; the enclave stores a private key, the first public parameter and a lookup table corresponding to the first public parameter; the data user requests registration from the model provider to apply for a key, and the model provider generates a key in response to the registration request and distributes it to the data user, and updates the corresponding private key stored in the enclave;

[0120] In the secure reasoning service query phase,

[0121] The data user uses the key distributed to itself to encrypt its own data and transmit it to the cloud server; the cloud server performs linear and nonlinear layer calculations on the transmitted data through oblivious security protocol interaction to obtain ciphertext prediction results, and feeds back to the data user.

[0122] refer to Figure 5 In an optional embodiment of the present invention, further, the CSP includes:

[0123] The enclave download module is used to download the enclave containing public parameters, corresponding lookup tables, and a fully homomorphic cryptosystem from the MP to provide secure reasoning services.

[0124] The secure reasoning module is used to complete the calculation of the linear and nonlinear layers in the reasoning through the oblivious security protocol interaction between the REE side and the TEE side. It includes the linear transformation layer protocol submodule, the nonlinear transformation layer protocol submodule, the CV calculation submodule, the AC calculation submodule, the PL calculation submodule and the FC calculation submodule, a total of 6 submodules.

[0125] The linear transformation layer protocol submodule is used for the calculation of the linear transformation layer protocol and supports the secure inner product protocol, secure plaintext multiplication protocol and secure average pooling protocol.

[0126] Nonlinear transformation layer protocol submodule, used for nonlinear transformation layer protocol calculation, supports inadvertent comparison protocol, inadvertent and secure max-pooling protocols.

[0127] The CV calculation submodule is used for convolution layer calculation and can call SIPP.

[0128] The AC calculation submodule is used for the calculation of the activation layer and can be called

[0129] The PL calculation submodule is used for pooling layer calculations and can call SAPP and SMPP.

[0130] The FC calculation submodule is used for the calculation of the fully connected layer and can call SIPP.

[0131] The ciphertext prediction result return module is used to return the ciphertext prediction result to the user.

[0132] refer to Figure 5 In an optional embodiment of the present invention, MP comprises:

[0133] The lookup table construction module is used to construct a lookup table corresponding to the common parameters according to the selected filling mode, and the filling mode includes two modes: "same" and "valid".

[0134] The enclave system initialization module is used to select a second public parameter of CKKS in the fully homomorphic encryption scheme; the second public parameter includes a private key; and the parameters in the enclave are created according to the second public parameter to initialize the parameters in the enclave.

[0135] Request response module, used to generate keys for users.

[0136] The key update module is used to update the keys in the enclave to ensure the freshness of the keys in each inference process, thereby protecting the security of data and models.

[0137] In an optional implementation manner of the present invention, the data users include:

[0138] The inference service request module is used to initiate a request for an inference service. Data users who want to obtain inference services must register on the MP and request a key. This module must participate.

[0139] The data upload module is used to receive the keys distributed by the MP, encrypt and send the data used for inference, and receive the ciphertext prediction results returned by the CSP.

[0140] It is worth noting that the terms "first" and "second" in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0141] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality of components or steps.

[0142] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment, characterized in that: include: In the security reasoning service request phase, The model provider constructs a lookup table corresponding to a first common parameter of the neural network model; Selecting a second public parameter of CKKS in a fully homomorphic encryption scheme to create an enclave and initialize the enclave; the enclave stores a private key, the first public parameter, and a lookup table corresponding to the first public parameter; The data user requests registration from the model provider to apply for a key. The model provider generates a key in response to the registration request and distributes it to the data user, and updates the corresponding private key stored in the enclave; In the secure reasoning service query phase, The data user uses the key distributed to the user to encrypt the data and transmit it to the cloud server; The cloud server performs linear and nonlinear layer calculations on the transmitted data through an oblivious security protocol to obtain a ciphertext prediction result, and feeds it back to the data user.

2. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 1 is characterized in that: The model provider constructs a lookup table corresponding to the first common parameter, comprising: The model provider selects a filling mode according to the convolutional layer of the neural network model, and constructs a lookup table corresponding to the first common parameter according to the selected filling mode; the filling mode includes same and valid modes.

3. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 1 is characterized in that: The selecting a second public parameter of CKKS in the fully homomorphic encryption scheme to create an enclave and initializing the enclave comprises: Selecting a second public parameter of CKKS in a fully homomorphic encryption scheme; the second public parameter includes a private key; Create various parameters in the enclave according to the second public parameters; Initialize various parameters in the enclave.

4. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 1 is characterized in that: The cloud server performs linear and nonlinear layer calculations on the transmitted data through the oblivious security protocol interaction to obtain the ciphertext prediction results including: The cloud server designs linear and nonlinear protocols in the oblivious security protocol. The linear protocols include: secure inner product protocol, secure plaintext multiplication protocol and secure average pooling protocol; the nonlinear protocols include: oblivious comparison protocol, oblivious ReLU protocol and secure maximum pooling protocol; The cloud server performs linear calculations on the input data of the corresponding layer using the linear protocol and performs nonlinear calculations on the input data of the corresponding layer using the nonlinear protocol according to the propagation order of the transmitted data in the neural network model, to obtain the ciphertext prediction result.

5. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 4 is characterized in that: The calculation process of the secure inner product protocol includes: The REE side in the cloud server selects a random vector p and calculates the ciphertext represents the ciphertext vector of CKKS on the REE side, m1 represents the plaintext vector on the REE side, including N components; The REE side converts the ciphertext Sent to the TEE side; where each element in p is greater than the square power of the plaintext space p; Decryption of ciphertext on TEE side Get the plaintext m1+p and calculate in represents component multiplication; m2 represents the plaintext vector on the TEE side, including N components; TEE side selects random vector calculate and encrypt it as N is a power of 2, represents the integer ring of length N and modulus p, r1 includes N components; The TEE side sends m′+r1 and The REE side decodes m′+r1 as: REE side calculates and obtains the encrypted result of the inner product 6. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 4 is characterized in that: The calculation process of the secure plaintext multiplication protocol includes: The REE side in the cloud server selects a random vector p and calculates the plaintext m1+p; m1 represents the plaintext vector on the REE side, including N components; The REE side sends the plaintext m1+p to the TEE side; wherein each element in p is greater than the square power of the plaintext space p; TEE-side calculation in represents component multiplication; m2 represents the plaintext vector on the TEE side, including N components; TEE side selects random vector and encrypt it as ; N is a power of 2, represents the integer ring of length N and modulus p, r1 includes N components; The TEE side converts m′+r1 and Send to REE side; The REE side decodes m′+r1 into m″: REE side calculates the multiplication result 7. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 4 is characterized in that: The calculation process of the security average pool protocol includes: The REE side slices the ciphertext into c (1) Send to TEE side and calculate Among them, the ciphertext vector on the REE side is TEE side receives c (1) Then, calculate c (1) ·s, get and encrypt it and send it to the REE side; s represents the key polynomial, which contains N components; The REE side is calculated by Get the encrypted average.

8. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 4 is characterized in that: The calculation process of the oblivious comparison protocol includes: The REE side selects random vectors r1 and r2, both of which contain N components, and encrypts r1; where for each element in r1 and r2, r 1i >r 2i >0 or r 1i <r 2i <0, where 1≤i≤N; m represents the plaintext vector owned by the REE side, Represents the ciphertext vector owned by the REE side; REE side calculation Will Send to TEE side and calculate TEE side reception And calculate The REE side inputs t1, the TEE side inputs t2, and the REE side and the TEE side interact to perform the calculation process of the secure plaintext multiplication protocol. The REE side obtains t1, t2 includes N components, which are represented by t 1i ,t 2i , 1≤i≤N; REE side calculation 9. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 4 is characterized in that: The calculation process of the oblivious ReLU protocol includes: The REE side calculates the ciphertext through the oblivious comparison protocol in, m i Represents the i-th plaintext value; According to the expression of ReLU OReLU(m i )=m i ·g(m i ) performs the ciphertext multiplication operation of CKKS to obtain the encryption result of ReLU.

10. The convolutional neural network inadvertent reasoning method based on a semi-honest trusted execution environment according to claim 4 is characterized in that: The calculation process of the secure maximum pool protocol includes: The REE side selects a random vector r containing N components and writes the ciphertext Sent to the TEE side; m represents the plaintext vector owned by the REE side, Represents the ciphertext vector owned by the REE side; TEE side Decrypt and split the vector to obtain m1+r1 and m2+r2, expressed as: Among them, r includes r1 and r2; The TEE side encrypts m1+r1 and m2+r2 and returns them to the REE side; The REE side eliminates the corresponding noise in the encryption result and obtains and The REE side and the TEE side are calculated by executing the oblivious ReLU protocol calculation process And calculate The REE and TEE sides repeat the process of selecting random vectors to calculate the maximum value logN times to obtain the ciphertext in the pooling layer. The maximum value of each component of .

Citation Information

Patent Citations

  • Outsourcing convolutional neural network privacy protection system based on secure two-party calculation

    CN111324870A

  • Convolutional neural network model-based protection model and user privacy prediction system

    CN117668900A

Cited By

  • TEE technology-based single cloud architecture intra-field security data transaction method

    CN119831589A

  • Convolutional neural network reasoning method, device and equipment based on equipment-side trusted execution environment

    CN119990310A