Trusted processing method, equipment and medium
By encrypting user data, the encrypted data performs operations outside the trusted computing environment and processes the results in the trusted computing environment, the existing trusted computing environment has solved the problem of high cost and limited computing power, and an efficient and secure computing process is achieved.
Patent Information
- Application Number
- CN202311397415.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-05-02
AI Technical Summary
The existing trusted computing environment/trusted chips have high cost and limited computing power, making it difficult to compare with ordinary CPUs in terms of cost efficiency.
By encrypting the user data, the encrypted data performs a first operation outside the trusted computing environment, and the generated calculation results are performed in the trusted computing environment to obtain a result equivalent to the target result, thereby realizing trusted computing with the help of a non-trusted computing device.
While ensuring data security, it improves computing efficiency, reduces computing costs, and reduces the amount of computing in a trusted computing environment.
Smart Images

Figure CN119921960A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data security technology, and in particular to a trusted processing method, device and medium. Background Art
[0002] In scenarios such as artificial intelligence, the server deploys a trained AI model (such as a large language model LLM) containing parameters M, and the client sends its own data vector to the server. As the input of the model, the server uses the model parameters M and the input vector Calculate the output vector of the model
[0003] If the client input Contains confidential information that cannot be made public, and the client is unwilling to The plain text is sent to the server; and the model parameter M is also trained by the server at a considerable cost, especially for large-scale models like the large language model LLM, the training cost is very high, so the server cannot disclose the model parameter M to the client and complete the model calculation on the client.
[0004] One solution is to use a trusted chip that supports a trusted execution environment (TEE) on the server side to complete the calculation. The trusted computing environment (TEE) can ensure that only authenticated code is run, and the runtime data will not be leaked outside the trusted execution environment. In this way, the client can input After encryption, it is sent to the trusted computing environment of the server, and the key required for decryption is also in the trusted computing environment and will not be leaked outside the trusted computing environment, so the client input The plain text will not be obtained by the server. The server decrypts it in the trusted computing environment and uses the model parameter M and the decrypted Calculate the output vector of the model like Fig. 9 shown.
[0005] The trusted computing environment / trusted chip used in the above solution must be carefully designed to ensure that only verified code is run and that runtime data will not be leaked outside the trusted computing environment. Therefore, compared with computing devices that do not require a trusted computing environment, the cost of a trusted chip or trusted computing environment to provide the same computing power is much higher; or in other words, at a comparable cost, the computing power provided by a trusted chip or trusted computing environment is much lower. Existing TEE solutions, including Intel CPU's SGX and ARM CPU's trustzone, have many limitations in computing performance compared to CPU computing that does not provide a trusted computing environment, and their computing power cannot be compared with mainstream GPUs. Summary of the invention
[0006] To solve the problems in the related art, the embodiments of the present disclosure provide a trusted processing method, device and medium.
[0007] One aspect of an embodiment of the present disclosure provides a trusted processing method, including obtaining user data; performing an encryption operation on the user data to obtain encrypted data; sending the encrypted data so that the encrypted data performs a first operation outside a trusted computing environment to generate a first operation result; receiving the first operation result; and performing a second operation on the first operation result to obtain a second operation result, the second operation result being equivalent to the operation result of performing a target operation on the user data, wherein the sum of the operations of the encryption operation and the second operation is less than the operations of the target operation.
[0008] According to an embodiment of the present disclosure, performing an encryption operation on user data to obtain encrypted data includes performing an encryption operation on user data using a first encryption parameter and a second encryption parameter to obtain encrypted data. Before performing the second operation, the method further includes: sending the first encryption parameter so that the first encryption parameter performs a third operation outside the trusted computing device to generate a third operation result; and receiving the third operation result. Performing a second operation on the first operation result to obtain the second operation result includes performing a second operation on the first operation result, the third operation result, and the second encryption parameter to obtain the second operation result.
[0009] According to an embodiment of the present disclosure, performing an encryption operation on user data to obtain encrypted data includes generating a random matrix, a random number seed, and noise, wherein the random matrix is disclosed outside a trusted computing environment; generating a pseudo-random number that is linearly related to the random matrix, the random number seed, and the noise; and performing an encryption operation on the user data using the pseudo-random number to obtain encrypted data.
[0010] According to an embodiment of the present disclosure, user data includes an n-dimensional vector The target operation includes an operation of multiplying the user data by an m×n target matrix M, where m and n are both positive integers.
[0011] According to an embodiment of the present disclosure, performing an encryption operation on user data to obtain encrypted data, including generating an n×k encryption matrix A, a k-dimensional encryption vector and an n-dimensional noise vector The number of non-zero elements in the noise vector is r×n, 0 < r ≤ 1, and k < mn(1 - r) / (m + n) is satisfied.
[0012] According to an embodiment of the present disclosure, using the encryption matrix A, the encryption vector and the noise vector to perform an encryption operation on user data to obtain encrypted data, including subtracting the product of the encryption matrix A and the encryption vector from the user data, and then subtracting the noise vector to obtain the encrypted data wherein,
[0013] According to an embodiment of the present disclosure, generating a k-dimensional encryption vector including generating a k×k′ matrix A′, a k′-dimensional vector and a k-dimensional vector where k′ < k; determining the encryption vector according to the sum of the product of the matrix A′ and the vector and the vector wherein,
[0014] According to an embodiment of the present disclosure, the first operation result is generated by calculating the product of the target matrix M and the encrypted data outside the trusted computing device. Wherein,
[0015] According to an embodiment of the present disclosure, before performing the second operation, the method further includes receiving a third operation result M′ calculated outside the trusted computing device, and the third operation result M′ is generated by calculating the product of the target matrix M and the encryption matrix A. Wherein, M′ = M×A.
[0016] According to an embodiment of the present disclosure, performing a second operation on the first operation result to obtain a second operation result, including determining a first product of the third operation result M′ and the encryption vector , determining a second product of the target matrix M and the noise vector , and summing the first product, the second product, and the first operation result to generate the second operation result wherein,
[0017] According to an embodiment of the present disclosure, the trusted processing method also includes performing a transformation operation on the user data to obtain transformed data, performing a verification operation on the transformed data at least partially through an electronic device other than the trusted computing device to obtain verification data, and using the verification data to verify the second operation result to generate a verification result.
[0018] Another aspect of an embodiment of the present disclosure provides a trusted computing device, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the processor implements the trusted processing method as described above.
[0019] Another aspect of an embodiment of the present disclosure provides a trusted processing method, including obtaining target data, receiving encrypted data from a trusted computing device, performing a first operation on the encrypted data and the target data, obtaining a first operation result, and sending the first operation result to the trusted computing device so that the trusted computing device generates a second operation result based on the first operation result.
[0020] According to the embodiment of the present disclosure, the encrypted data is an n-dimensional vector The target data is an m×n matrix M, where m and n are positive integers. Performing a first operation on the encrypted data and the target data to obtain a first operation result includes multiplying the target data by the encrypted data to obtain the first operation result. in,
[0021] According to an embodiment of the present disclosure, the method also includes receiving a first encryption parameter from a trusted computing device, performing a third operation on the first encryption parameter to generate a third operation result, and sending the third operation result to the trusted computing device so that the trusted computing device generates a second operation result based on the first operation result and the third operation result.
[0022] According to an embodiment of the present disclosure, the first encryption parameter includes an n×k encryption matrix A, and the target data is an m×n matrix M, where m, n, and k are positive integers. Performing a third operation on the first encryption parameter to generate a third operation result includes multiplying the target data with the encryption matrix to obtain a third operation result M′. Wherein, M′=M×A.
[0023] Another aspect of an embodiment of the present disclosure provides an electronic device, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the processor implements the trusted processing method as described above.
[0024] Another aspect of an embodiment of the present disclosure provides a computer-readable storage medium having computer-readable instructions stored thereon, which, when executed by a processor, enables the processor to implement the various methods described above.
[0025] Another aspect of an embodiment of the present disclosure provides a computer program, which, when executed by a processor, enables the processor to implement the method described above.
[0026] According to the technical solution of the embodiment of the present disclosure, by encrypting user data, a first operation is performed on the encrypted data outside the trusted computing environment, and a second operation is performed on the generated operation result in the trusted computing environment to obtain a result equivalent to the target result, thereby realizing trusted computing with the help of non-trusted computing devices, and executing part of the computing amount outside the trusted computing environment, thereby improving computing efficiency and reducing computing costs while ensuring data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0028] Figure 1 A schematic diagram schematically illustrates a system architecture for applying a trusted processing method according to an embodiment of the present disclosure;
[0029] Figure 2 A flowchart schematically illustrating a trusted processing method according to an embodiment of the present disclosure;
[0030] Figure 3 A flowchart schematically illustrating a trusted processing method according to another embodiment of the present disclosure;
[0031] Figure 4 A flowchart schematically illustrating an encryption operation of an embodiment of the present disclosure;
[0032] Figure 5 A flowchart schematically illustrating a trusted processing method according to another embodiment of the present disclosure;
[0033] Figure 6 A flowchart schematically illustrating a trusted processing method according to an embodiment of the present disclosure;
[0034] Figure 7 A flowchart schematically illustrating a trusted processing method according to another embodiment of the present disclosure;
[0035] Figure 8 A schematic diagram schematically shows the structure of a computer system suitable for implementing the trusted processing method and device of the embodiment of the present disclosure;
[0036] Fig. 9 A schematic diagram of a system architecture of related technologies for solving data privacy issues is schematically shown. DETAILED DESCRIPTION
[0037] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can more easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0038] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0039] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.
[0040] The embodiment of the present disclosure provides a trusted processing method, including obtaining user data; performing an encryption operation on the user data to obtain encrypted data; sending the encrypted data so that the encrypted data performs a first operation outside the trusted computing environment to generate a first operation result; receiving the first operation result; and performing a second operation on the first operation result to obtain a second operation result, the second operation result being equivalent to the operation result of performing a target operation on the user data, wherein the sum of the operations of the encryption operation and the second operation is less than the operation of the target operation. By encrypting the user data, the encrypted data is subjected to a first operation outside the trusted computing environment, and the generated operation result is subjected to a second operation within the trusted computing environment to obtain a result equivalent to the target result, so that part of the calculation amount can be performed outside the trusted computing environment, while ensuring data security, improving calculation efficiency and reducing calculation cost. The technical solutions provided by the embodiments of the present disclosure are described in detail below in conjunction with the accompanying drawings.
[0041] Figure 1 A schematic diagram schematically illustrates a system architecture to which the trusted processing method according to an embodiment of the present disclosure is applied.
[0042] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, a trusted computing device 105, and an electronic device 106. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103, the trusted computing device 105, and the electronic device 106. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0043] The terminal device 101, the terminal device 102, and the terminal device 103 interact with the trusted computing device 105 and the electronic device 106 through the network 104 to receive or send messages, etc. The terminal device 101, the terminal device 102, and the terminal device 103 can be hardware or software. When the terminal device 101, the terminal device 102, and the terminal device 103 are hardware, they can be various special or general electronic devices, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, etc. When the terminal device 101, the terminal device 102, and the terminal device 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, multiple software or software modules used to provide distributed services), or it can be implemented as a single software or software module.
[0044] The trusted computing device 105 can be used to build a trusted computing environment. In some embodiments, the trusted computing device 105 may include dedicated hardware, such as a dedicated chip, in which the private key of the chip is stored and kept confidential. After the user encrypts the private data with the public key, the private data is sent to the dedicated chip for processing, and the processing result is returned. Since the service provider does not have the private key of the chip, the plain text of the private data sent by the user cannot be obtained at any stage. In other embodiments, the trusted computing device 105 can also be a general-purpose computer, and a trusted computing environment is built by software. As long as it can be guaranteed that the private data cannot be illegally obtained by the service provider or a third party.
[0045] The electronic device 106 may be a server that provides various computing services, such as a hardware device with processing functions including a central processing unit (CPU), a graphics processing unit (GPU), etc. The electronic device 106 does not need to build a trusted computing environment and does not directly process private data.
[0046] The trusted computing device 105 and the electronic device 106 may be implemented as a distributed server cluster consisting of multiple servers, or may be implemented as a single server.
[0047] The trusted processing method provided by the embodiment of the present disclosure may be executed by the trusted computing device 105 and the electronic device 106, for example. It should be understood that Figure 1 The number of terminal devices, networks, trusted computing devices, and electronic devices in the embodiment is only illustrative. Any number of terminal devices, networks, trusted computing devices, and electronic devices may be provided according to implementation requirements.
[0048] Figure 2 The flowchart of the trusted processing method according to the embodiment of the present disclosure is schematically shown.
[0049] like Figure 2 As shown, the trusted processing method can be, for example, Figure 1The trusted computing device 105 shown is executed, and the method includes operations S210 - S250 .
[0050] In operation S210, user data is obtained.
[0051] In operation S220, an encryption operation is performed on the user data to obtain encrypted data.
[0052] In operation S230, the encrypted data is sent so that the encrypted data performs a first operation outside the trusted computing environment to generate a first operation result.
[0053] In operation S240 , a first operation result is received.
[0054] In operation S250, a second operation is performed on the first operation result to obtain a second operation result, which is equivalent to the operation result of performing the target operation on the user data, wherein the sum of the operation amount of the encryption operation and the second operation is less than the operation amount of the target operation.
[0055] According to the embodiments of the present disclosure, user data may be private. For example, in a hospital scenario, according to relevant regulations, the hospital bears confidentiality responsibility for the patient's medical data (such as medical imaging data). Therefore, the hospital cannot directly hand over the patient's medical data to a third-party company for processing. Through a trusted computing environment, a user can send encrypted user data to a trusted computing environment, and decrypt and calculate it in the trusted computing environment to obtain the desired result. Therefore, the operation S210 may include receiving encrypted user data, decrypting the encrypted user data, and obtaining the user data.
[0056] According to the embodiment of the present disclosure, user data needs to perform target operations in a trusted computing environment to obtain operation results. However, it is inefficient to perform target operations directly in a trusted computing environment. The method of the embodiment of the present disclosure uses external electronic devices to improve operation efficiency while ensuring the privacy and security of data.
[0057] According to the embodiment of the present disclosure, user data is re-encrypted within the trusted computing environment to obtain encrypted data. One or more encryption parameters used in the encryption process will not be leaked outside the trusted computing environment, thereby ensuring the security of the data. On the other hand, these encryption parameters can also be used to calculate the final result.
[0058] According to the embodiment of the present disclosure, the electronic device outside the trusted computing environment may be, for example, an electronic device including a CPU or a GPU. Among them, the GPU has a natural parallel processing advantage. For matrix or vector operations, an electronic device including a GPU may be preferred, which is conducive to improving the operation efficiency.
[0059] According to an embodiment of the present disclosure, an electronic device outside the trusted computing environment performs a first operation on encrypted data, and the first operation is specified by the trusted computing environment so that the trusted computing environment can restore the first operation result generated by the first operation after receiving it to a second operation result equivalent to performing a target operation on the user data.
[0060] In this way, the target operation is decomposed into an encryption operation and a second operation performed within the trusted computing environment, and a first operation performed outside the trusted computing environment. As long as the sum of the computational complexity of the encryption operation and the second operation is less than the computational complexity of the target operation, the computational complexity within the trusted computing environment can be reduced with the help of non-trusted computing devices, thereby improving computing efficiency and reducing computing costs.
[0061] Figure 3 The following is a flowchart schematically showing a trusted processing method according to another embodiment of the present disclosure.
[0062] like Figure 3 As shown, the method includes operations S210, S230, S240 and S310-S340. That is, the method further includes S320 and S330 on the basis of the above-mentioned embodiment, and the operation S220 of the above-mentioned embodiment is implemented as operation S310, and S250 is implemented as operation S340. Operations S210, S230, and S240 are the same as the above-mentioned embodiment, and will not be repeated here.
[0063] In operation S310, an encryption operation is performed on user data using a first encryption parameter and a second encryption parameter to obtain encrypted data.
[0064] In operation S320, the first encryption parameter is sent so that the first encryption parameter performs a third operation outside the trusted computing device to generate a third operation result.
[0065] In operation S330 , a third operation result is received.
[0066] In operation S340, a second operation is performed on the first operation result, the third operation result, and the second encryption parameter to obtain a second operation result.
[0067] According to the disclosed embodiment, the first encryption parameter is disclosed to the outside of the trusted computing environment, and the second encryption parameter is kept secret outside the trusted computing environment. The outside world cannot crack the encrypted data based on the first encryption parameter alone, and the trusted computing environment can use the processing result of the first encryption parameter by the outside world, that is, the third operation result, to restore the first operation result to obtain the second operation result equivalent to executing the target operation. In this way, the amount of calculation inside the trusted computing environment is further reduced, the calculation efficiency is improved, and the calculation cost is reduced.
[0068] According to the embodiments of the present disclosure, operation S220 can adopt a variety of encryption algorithms. To improve security, random encryption parameters can be generated for encryption during each calculation process. The following will be combined with Figure 4 , to illustrate one possible encryption algorithm.
[0069] Figure 4 Schematically shows a flowchart of the encryption operation according to the embodiments of the present disclosure.
[0070] As Figure 4 shown, operation S220 may include operations S410 - S430. Figure 4 That is, it is a sub - flowchart of operation S220.
[0071] In operation S410, a random matrix, a random number seed, and noise are generated. Among them, the random matrix is publicly disclosed outside the trusted computing environment.
[0072] In operation S420, pseudo - random numbers linearly related to the random matrix, the random number seed, and the noise are generated.
[0073] In operation S430, the user data is encrypted using the pseudo - random numbers to obtain encrypted data.
[0074] According to the embodiments of the present disclosure, by performing an encryption operation on user data through a linear combination of a publicly disclosed random matrix, a confidential random number seed, and noise to obtain encrypted data, a difficult problem resistant to quantum computing can be constructed. Even if the encrypted data and the random matrix are known to the outside world, it is difficult to infer the user data or the random number seed, increasing the difficulty of cracking and improving data security.
[0075] For example, the pseudo - random number can be determined by , where A is the random matrix, is the random number seed, is the noise. The noise has a dimension of n, and only r×n elements in the n - dimensional vector are non - zero, and the other elements are all zero. That is, the Hamming weight of the noise is where r is called the noise rate, 0 < r ≤ 1. The noise vector can be very sparse, that is, r is much less than 1.
[0076] According to the embodiments of the present disclosure, even if the pseudo - random number and the random matrix A are known, the random number seed cannot be inferred, and the encrypted data For example, it can be determined by . When only the encrypted data In the case of the random matrix A and the random number seed, it is extremely difficult to infer the user data. and the random number seed are both extremely difficult.
[0077] According to the embodiments of the present disclosure, the user data may include an n-dimensional vector The target operation may include an operation of multiplying the user data by a target matrix M of m×n, where both m and n are positive integers. That is, the target operation is The target matrix M may be a parameter matrix of an artificial intelligence model.
[0078] Most of the calculations in artificial intelligence model inference can be decomposed into matrix addition and multiplication, and vector and matrix multiplication. Since the complexity of matrix addition is relatively low (n 2 complexity), while the complexity of matrix multiplication is relatively high (n 3 complexity), and matrix multiplication can be further decomposed into vector and matrix multiplication, the embodiments of the present disclosure only take the multiplication of a vector and a matrix as an example, and analyze the amount of calculation in terms of the number of scalar multiplications to be completed.
[0079] According to the embodiments of the present disclosure, performing an encryption operation on the user data to obtain encrypted data includes generating an n×k encryption matrix A, a k-dimensional encryption vector and an n-dimensional noise vector The noise vector The number of non-zero elements in is r×n, 0 < r ≤ 1, and k < mn(1 - r) / (m + n) is satisfied. If the method described below in the embodiments of the present disclosure is followed, when k satisfies the above conditions, the amount of calculation in the trusted computing environment can be reduced. For example, when m = n = 10000 and r = 0.01, the value range of k is a natural number between [1, 4949]. The smaller k is, the greater the effect on reducing the amount of calculation in the trusted computing environment, but since the encryption complexity is reduced, the probability of being cracked may increase. Those skilled in the art can select an appropriate k value according to needs.
[0080] According to the embodiments of the present disclosure, using the encryption matrix A, the encryption vector and the noise vector to perform an encryption operation on the user data to obtain encrypted data, including subtracting the product of the encryption matrix A and the encryption vector from the user data, and then subtracting the noise vector to obtain the encrypted data to obtain the encrypted data where Since the pseudo-random number is difficult to crack, encrypting the user data with this difficult-to-crack number is also difficult to crack. As an equivalent method, it is also possible to set Alternatively, other difficult-to-crack numbers may be selected to encrypt user data.
[0081] According to an embodiment of the present disclosure, the encryption step is performed within a trusted computing environment, including The operation requires n×k multiplication operations, and addition operations are negligible.
[0082] According to the embodiment of the present disclosure, the first operation result Calculate the target matrix M and the encrypted data outside the trusted computing device The product of is produced. For example, This step requires m×n multiplication operations, but is performed outside the trusted computing device.
[0083] According to an embodiment of the present disclosure, before executing the second operation, the method further includes receiving a third operation result M′ calculated outside the trusted computing device, where the third operation result M′ is generated by calculating the product of the target matrix M and the encrypted matrix A. For example, M′=M×A. This step requires m×n×k times of multiplication operations, but is performed outside the trusted computing device. Moreover, in multiple calculations of the same model, this step only needs to be completed once, so its computational cost can be amortized by multiple model calculations.
[0084] According to an embodiment of the present disclosure, a second operation is performed on the first operation result to obtain a second operation result, including determining that the third operation result M′ and the encryption vector The first product determines the target matrix M and the noise vector The second product of the first product, the second product and the first operation result Sum and generate the second operation result For example, Among them, but in, m×k multiplication operations are required. It requires m×n multiplication operations, but because the noise vector Very sparse, that is, r is much less than 1, so only m×n×r multiplication operations are actually required. Addition operations are negligible.
[0085] By the method described above, the second operation result can be verified. Equivalent to
[0086]
[0087] And the user data in the calculation process It is never leaked outside the trusted computing environment and is safe.
[0088] In summary, outside the trusted computing environment, each model calculation requires m×n multiplication operations. Inside the trusted computing environment, each model calculation requires m×k + m×n×r + n×k multiplication operations. Compared with directly calculating all inside the trusted computing environment for the required m×n multiplications, by selecting parameters, it is possible to make m×k + m×n×r + n×k < m×n, that is, k < mn(1 - r) / (m + n), so as to reduce the amount of calculation inside the trusted computing environment and transfer most of the calculations to external electronic devices such as GPUs outside the trusted computing environment, in order to efficiently utilize the cheap computing power of external electronic devices without sacrificing security. For example, under the premise of ensuring security, k << n, k << m, and r << 1 can be selected to satisfy the above inequality.
[0089] According to the embodiments of the present disclosure, processing is performed in a nested algorithm manner to further reduce the amount of calculation inside the trusted computing environment. Referring to the embodiments described above, through the amount of calculation inside the trusted computing environment can be reduced from m×n to m×k + m×n×r + n×k. In the case where r is much smaller than 1 and can be ignored, the reduction ratio of the amount of calculation inside the trusted computing environment is approximately k / m + k / n. This can be regarded as constructing a layer of proxy calculation to obtain the calculation amount benefit. If another layer of proxy is added, the amount of calculation inside the trusted computing environment can be further reduced.
[0090] For example, a k-dimensional encrypted vector can be generated in the following manner Generate a matrix A' of k×k', a vector of k' dimensions and a vector of k dimensions where k' < k; according to the product of the matrix A' and the vector and the sum of the vector to determine the encrypted vector where In this way, a new proxy layer is formed, making the dimension k of further reduced to k', then the reduction ratio of the amount of calculation inside the trusted computing environment can reach approximately
[0091] According to the embodiments of the present disclosure, since external electronic devices (such as GPUs) outside the trusted computing environment are untrusted hardware, it cannot be confirmed whether the electronic device performs calculations as required (such as ) and sends the correct result to the inside of the trusted computing environment. The embodiments of the present disclosure also provide a verification method for the above problems.
[0092] Figure 5Flowchart of a trusted processing method schematically showing another embodiment of the present disclosure.
[0093] As Figure 5 shown, on the basis of Figure 2 , the method may further include operations S510 - S530.
[0094] In operation S510, perform a transformation operation on the user data to obtain transformed data.
[0095] In operation S520, perform a verification operation on the transformed data at least partially by an electronic device other than the trusted computing device to obtain verification data.
[0096] In operation S530, use the verification data to verify the second operation result to generate a verification result.
[0097] For example, in operation S510, a random number d may be generated within the trusted computing environment, and let Then, in operation S520, calculate with reference to the method of calculating above, that is, require an external electronic device to calculate and send it back into the trusted computing environment, combined with the calculated within the trusted computing environment. Finally, calculate which is the verification data. At this time, in operation S530, the trusted computing environment may check that is, is always equal to If the above equation does not hold, it indicates that there is an error in the calculation of the external electronic device, thus realizing the supervision of the external electronic device.
[0098] According to the embodiments of the present disclosure, since it is necessary to additionally calculate and its computational amount within the trusted computing environment is the same as , in order to reduce the computational amount within the trusted computing environment, it may be necessary to increase the restrictions on the parameters involved in the algorithm. For example, for the above - described embodiment, the additional computational amount is m×k + m×n×r + n×k. Therefore, it is required that 2(m×k + m×n×r + n×k) < m×n, that is, In this way, the computational amount within the trusted computing environment can still be reduced. Of course, if it is not necessary to verify each calculation, for example, perform a verification operation every certain number of times, the value range of k can be appropriately relaxed.
[0099] Figure 6 Flowchart of a trusted processing method schematically showing an embodiment of the present disclosure.
[0100] As Figure 6 shown, the method may be performed, for example, by Figure 1The method is performed by the electronic device 106 shown, and includes operations S610-S640.
[0101] In operation S610, target data is obtained. The target data may be, for example, the target matrix M as described above, such as a parameter matrix of an artificial intelligence model.
[0102] In operation S620, encrypted data is received from a trusted computing device, such as the encrypted data described above.
[0103] In operation S630, a first operation is performed on the encrypted data and the target data to obtain a first operation result.
[0104] According to the embodiment of the present disclosure, the encrypted data may be an n-dimensional vector The target data may be an m×n matrix M, where m and n are positive integers. Performing a first operation on the encrypted data and the target data to obtain a first operation result may include multiplying the target data by the encrypted data to obtain the first operation result. For example, as described above
[0105] In operation S640, the first operation result is sent to the trusted computing device so that the trusted computing device generates a second operation result based on the first operation result, such as the one described above.
[0106] The method of the embodiment of the present disclosure can help the trusted computing environment share the computing burden, save computing costs, and improve computing efficiency.
[0107] Figure 7 A flowchart schematically illustrating a trusted processing method according to another embodiment of the present disclosure;
[0108] like Figure 7 As shown, this method Figure 6 Based on the illustrated embodiment, operations S710 - S730 may also be included.
[0109] In operation S710 , a first encryption parameter, such as the encryption matrix A described above, is received from a trusted computing device.
[0110] In operation S720, a third operation is performed on the first encryption parameter to generate a third operation result.
[0111] According to an embodiment of the present disclosure, the first encryption parameter may include an n×k encryption matrix A, and the target data may be an m×n matrix M, where m, n, and k are positive integers. Performing a third operation on the first encryption parameter to generate a third operation result may include multiplying the target data by the encryption matrix to obtain a third operation result M′. For example, M′=M×A described above.
[0112] In operation S730, the third operation result is sent to the trusted computing device so that the trusted computing device generates a second operation result based on the first operation result and the third operation result, such as the one described above.
[0113] Figure 8 The structure diagram of a computer system suitable for implementing the trusted processing method and apparatus of the embodiment of the present disclosure is schematically shown.
[0114] like Figure 8 As shown, the computer system 800 includes a processor 801, which can perform various processes in the above-mentioned embodiments according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0115] The following components are connected to the I / O interface 805: an input part 806 including a keyboard, a mouse, etc.; an output part 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part 808 including a hard disk, etc.; and a communication part 809 including a network interface card such as a LAN card, a modem, etc. The communication part 809 performs communication processing via a network such as the Internet. The drive 810 is also connected to the I / O interface 805 as needed. Removable media 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive 810 as needed, so that the computer program read therefrom is installed into the storage part 808 as needed. Among them, the processor 801 can be implemented as a processing unit such as a CPU, a GPU, a TPU, an FPGA, and an NPU.
[0116] In particular, according to an embodiment of the present disclosure, the method described above can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes a program code for executing the above method. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 809, and / or installed from a removable medium 811.
[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0118] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or programmable hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0119] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system in the above-mentioned embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method of the embodiment of the present disclosure.
[0120] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A trusted processing method, characterized in that: The method comprises: Obtain user data; Performing encryption operation on the user data to obtain encrypted data; Sending the encrypted data so that the encrypted data performs a first operation outside the trusted computing environment to generate a first operation result; receiving the first operation result; and Perform a second operation on the first operation result to obtain a second operation result, wherein the second operation result is equivalent to the operation result of performing a target operation on the user data, wherein the sum of the operations of the encryption operation and the second operation is less than the operation of the target operation.
2. The method according to claim 1, characterized in that The performing encryption operation on the user data to obtain encrypted data includes: Perform encryption operation on the user data using the first encryption parameter and the second encryption parameter to obtain encrypted data, Before performing the second operation, the method further includes: Sending the first encryption parameter so that the first encryption parameter performs a third operation outside the trusted computing device to generate a third operation result; receiving the third operation result, The performing a second operation on the first operation result to obtain a second operation result includes: A second operation is performed on the first operation result, the third operation result, and the second encryption parameter to obtain a second operation result.
3. The method according to claim 1, characterized in that The performing encryption operation on the user data to obtain encrypted data includes: generating a random matrix, a random number seed, and noise, wherein the random matrix is disclosed outside the trusted computing environment; Generate pseudo-random numbers that are linearly related to the random matrix, the random number seed, and the noise; An encryption operation is performed on the user data using the pseudo-random number to obtain encrypted data.
4. The method according to claim 1, characterized in that: The user data includes an n-dimensional vector The target operation includes an operation of multiplying the user data by an m×n target matrix M, where m and n are both positive integers.
5. The method according to claim 4, characterized in that The performing encryption operation on the user data to obtain encrypted data includes: Generate an n×k encrypted matrix A, a k-dimensional encrypted vector and an n-dimensional noise vector The number of non-zero elements in the noise vector is r×n, where 0 < r ≤ 1, and k < mn(1 - r) / (m + n) is satisfied; Using the encryption matrix A, encryption vector and the noise vector Perform encryption operation on the user data to obtain encrypted data, including converting the user data Subtract the encryption matrix A from the encryption vector The product of Get encrypted data in, 6. The method according to claim 5, characterized in that Generate k-dimensional encrypted vector include: Generate k×k ′ The matrix A ′ , k ′ Dimensional vector and k-dimensional vector Among them, k ′ <k; According to the matrix A ′ and vector The product of and vector The sum determines the encryption vector in, 7. The method according to claim 4, characterized in that The first operation result The target matrix M and the encrypted data are calculated outside the trusted computing device. The product of is produced; among them, 8. The method according to claim 5, characterized in that Before executing the second operation, the method further includes receiving a third operation result M calculated outside the trusted computing device. ′ , the third operation result M ′ It is generated by calculating the product of the target matrix M and the encryption matrix A; wherein, M ′ =M×A.
9. The method according to claim 8, characterized in that The performing of a second operation on the first operation result to obtain a second operation result includes: determining a third operation result M ′ With encryption vector The first product determines the target matrix M and the noise vector and performing the multiplication of the first product, the second product and the first operation result. Sum and generate the second operation result in, 10. The method according to any one of claims 1 to 8, characterized in that: Also includes: Performing a transformation operation on the user data to obtain transformed data; performing a verification operation on the transformed data at least in part by an electronic device other than the trusted computing device to obtain verification data; The second operation result is verified using the verification data to generate a verification result.
11. A trusted processing method, characterized in that: include: Obtain target data; receiving encrypted data from a trusted computing device; Performing a first operation on the encrypted data and the target data to obtain a first operation result; as well as The first operation result is sent to the trusted computing device so that the trusted computing device generates a second operation result based on the first operation result.
12. The method according to claim 11, characterized in that The encrypted data is an n-dimensional vector The target data is an m×n matrix M, where m and n are positive integers, and performing a first operation on the encrypted data and the target data to obtain a first operation result includes: Multiply the target data by the encrypted data to obtain a first operation result in, 13. The method according to claim 11, characterized in that Also includes: receiving a first encryption parameter from a trusted computing device; performing a third operation on the first encryption parameter to generate a third operation result; The third operation result is sent to the trusted computing device so that the trusted computing device generates the second operation result based on the first operation result and the third operation result.
14. The method according to claim 13, characterized in that The first encryption parameter includes an n×k encryption matrix A, the target data is an m×n matrix M, where m, n, and k are positive integers, and performing a third operation on the first encryption parameter to generate a third operation result includes: The target data is multiplied by the encryption matrix to obtain a third operation result M ′ ; Among them, M ′ =M×A.
15. A trusted computing device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
16. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 11 to 14.
17. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the instructions are executed by a processor, the processor executes the method according to any one of claims 1 to 14.