Fuzzy test method and device for fully homomorphic encryption and electronic equipment

By introducing a noise-aware feedback mechanism and equivalent expression transformation technology, the problem that existing fuzz testing tools cannot effectively test fully homomorphic encryption libraries is solved, and efficient and systematic vulnerability discovery and automatic judgment of calculation results are achieved.

CN121996545APending Publication Date: 2026-05-08TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TSINGHUA UNIVERSITY
Filing Date
2025-12-29
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing fuzzing tools cannot effectively test the core functionality of fully homomorphic encryption libraries and lack an understanding of the noise mechanisms unique to fully homomorphic encryption, resulting in low testing efficiency and insufficient code coverage.

Method used

By introducing a noise-aware feedback mechanism and equivalent expression transformation technology, test cases that can deeply probe the core computational logic of the program are generated, and a reliable test oracle is established to automatically determine the correctness of the calculation results.

Benefits of technology

It significantly improves code coverage and vulnerability discovery capabilities, and can efficiently and systematically generate test cases that can deeply probe the core computational logic of the program, and automatically judge the correctness of the calculation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121996545A_ABST
    Figure CN121996545A_ABST
Patent Text Reader

Abstract

The invention provides a fuzzy test method and device for fully homomorphic encryption and electronic equipment, and relates to the technical field of computer program vulnerability detection.The method comprises the steps that a test seed and a basic expression are obtained based on a seed corpus, variation processing is executed on the basic expression based on a variator, and a variation expression is obtained; performing algebraic transformation on the variation expression to obtain a plurality of equivalent expressions, and generating a test case based on the plurality of equivalent expressions and the test seeds; and inputting the test case into an executor for execution, and judging whether a vulnerability exists or not based on an execution result. According to the fuzz testing method and device for fully homomorphic encryption and the electronic equipment provided by the invention, the equivalent expression transformation technology is introduced, and the basic principle of fuzz testing is combined, so that the test case capable of deeply detecting program core calculation logic can be efficiently and systematically generated; and a reliable test oracle machine is established to automatically judge the correctness of a calculation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer program vulnerability detection technology, and in particular to a fuzzing method, apparatus and electronic device for fully homomorphic encryption. Background Technology

[0002] With the rapid development of cloud computing, big data, and artificial intelligence technologies, data privacy and security issues are becoming increasingly prominent. Fully homomorphic encryption, as a cutting-edge cryptographic technique, allows for arbitrarily complex computations on encrypted data without decryption, enabling the processing of sensitive information in untrusted environments (e.g., cloud servers). Fuzz testing is a widely used and effective vulnerability discovery technique. It discovers potential security vulnerabilities by providing a target program with a large number of automatically or semi-automatically generated unexpected inputs and monitoring for anomalies during program execution (such as crashes, assertion failures, etc.).

[0003] However, due to the extreme complexity of fully homomorphic encryption schemes, their security depends not only on the difficulty of the underlying mathematical problems, but also on the correctness and robustness of the software library engineering implementation. Fuzzing tools in related technologies cannot be directly applied to fully homomorphic encryption.

[0004] Therefore, there is an urgent need for an automated testing method that can understand and adapt to the core mechanism of fully homomorphic encryption and systematically and efficiently uncover deep vulnerabilities in its computational logic. Summary of the Invention

[0005] The purpose of this application is to provide a fuzzing method, apparatus, and electronic device for fully homomorphic encryption. By introducing equivalent expression transformation technology and combining it with the basic principles of fuzzing, it can efficiently and systematically generate test cases that can deeply probe the core computational logic of a program, and establish a reliable test oracle to automatically determine the correctness of the calculation results.

[0006] This application provides a fuzzing method for fully homomorphic encryption, including: Test seeds and basic expressions are obtained from a seed corpus. A mutant is used to mutate the basic expressions to obtain mutated expressions. Algebraic transformations are performed on the mutated expressions to obtain multiple equivalent expressions. Test cases are generated based on these equivalent expressions and the test seeds. Each equivalent expression is equivalent to the mutated expressions but has a different computational structure. The test cases are then input into an executor for execution, and the execution results are used to determine if any vulnerabilities exist.

[0007] Optionally, the mutant includes a low-noise mutant and a high-noise mutant; the computational complexity of generating the mutant expression by the high-noise mutant is greater than that of generating the mutant expression by the low-noise mutant; the step of performing mutation processing on the basic expression based on the mutant to obtain the mutant expression includes: obtaining noise feedback information obtained in the previous round of testing, and selecting a target mutant from the low-noise mutant and the high-noise mutant based on the noise feedback information; and performing mutation processing on the basic expression using the target mutant to obtain the mutant expression.

[0008] Optionally, the step of selecting a target mutant from the low-noise mutants and the high-noise mutants based on the noise feedback information includes: determining the high-noise mutant as the target mutant when the noise feedback information indicates that the noise budget consumption in the previous test round is less than a first preset threshold; and determining the low-noise mutant as the target mutant when the noise feedback information indicates that the noise budget consumption in the previous test round is greater than or equal to the first preset threshold.

[0009] Optionally, performing an algebraic transformation on the mutated expression to obtain multiple equivalent expressions includes: performing an algebraic transformation on the mutated expression to transform it into a factorization form or a Horner form, thereby obtaining the multiple equivalent expressions.

[0010] Optionally, the executor includes: a native executor and a fully homomorphic executor; the step of inputting the test case into the executor for execution and determining whether a vulnerability exists based on the execution result includes: using the native executor to calculate the basic expression to obtain a truth value calculation result, and using the fully homomorphic encryption executor to encrypt the plaintext data in the test case, and performing homomorphic calculation sequences of standard, factorization, and Horner form on the encryption result respectively to obtain multiple corresponding fully homomorphic encryption calculation results; one homomorphic calculation sequence corresponds to one fully homomorphic encryption calculation result; comparing the multiple fully homomorphic encryption calculation results with the truth value calculation result respectively, and comparing the multiple fully homomorphic encryption calculation results; if the comparison result indicates that there is an inconsistency in the calculation results, then a vulnerability is determined to exist.

[0011] Optionally, after inputting the test case into the executor for execution and determining whether a vulnerability exists based on the execution result, the method further includes: obtaining the remaining noise information after performing fully homomorphic encryption, and calculating the complexity of the test case based on the remaining noise information and the expression in the current test process; determining noise level information based on the complexity of the test case, and generating noise feedback information based on the noise level information.

[0012] Optionally, after determining the noise level information based on the complexity of the test cases, the method further includes: calculating the value of the test cases based on the noise level information, and determining the test seed as a high-value seed if the value of the test cases exceeds a second preset threshold; wherein the high-value seed is used to update the seed corpus.

[0013] This application also provides a fuzz testing apparatus for fully homomorphic encryption, comprising: The module includes an acquisition module for obtaining test seeds and basic expressions based on a seed corpus; a mutation module for performing mutation processing on the basic expressions using a mutant to obtain mutated expressions; a generation module for performing algebraic transformations on the mutated expressions to obtain multiple equivalent expressions, and generating test cases based on the multiple equivalent expressions and the test seeds; the equivalent expressions are expressions that are equivalent to the mutated expressions but have different computational structures; and a testing module for inputting the test cases into an executor for execution, and determining whether vulnerabilities exist based on the execution results.

[0014] Optionally, the mutant includes a low-noise mutant and a high-noise mutant; the computational complexity of generating the mutant expression by the high-noise mutant is greater than that of generating the mutant expression by the low-noise mutant; the mutation module is specifically used to obtain noise feedback information obtained in the previous round of testing, and to select a target mutant from the low-noise mutant and the high-noise mutant based on the noise feedback information; the mutation module is further specifically used to perform mutation processing on the basic expression using the target mutant to obtain the mutant expression.

[0015] Optionally, the mutation module is specifically configured to determine the high-noise mutant as the target mutant when the noise feedback information indicates that the noise budget consumption in the previous test is less than a first preset threshold; the mutation module is also specifically configured to determine the low-noise mutant as the target mutant when the noise feedback information indicates that the noise budget consumption in the previous test is greater than or equal to the first preset threshold.

[0016] Optionally, the generation module is specifically used to perform an algebraic transformation on the mutated expression, transforming the mutated expression into a factorization form or a Horner form, to obtain the plurality of equivalent expressions.

[0017] Optionally, the executor includes a native executor and a fully homomorphic executor; the testing module is specifically used to calculate the basic expression using the native executor to obtain a truth value calculation result, and to encrypt the plaintext data in the test case using the fully homomorphic encryption executor, and to perform homomorphic calculation sequences of standard, factorization, and Horner forms on the encryption results respectively to obtain multiple corresponding fully homomorphic encryption calculation results; one homomorphic calculation sequence corresponds to one fully homomorphic encryption calculation result; the testing module is further specifically used to compare the multiple fully homomorphic encryption calculation results with the truth value calculation result respectively, and to compare the multiple fully homomorphic encryption calculation results, and if the comparison result indicates that there is an inconsistency in the calculation results, then a vulnerability is determined to exist.

[0018] Optionally, the device further includes: a calculation module and a feedback module; the calculation module is used to obtain the remaining noise information after performing fully homomorphic encryption, and calculate the complexity of the test case based on the remaining noise information and the expression in the current test process; the feedback module is used to determine the noise level information based on the complexity of the test case, and generate noise feedback information based on the noise level information.

[0019] Optionally, the calculation module is further configured to calculate the value of the test case based on the noise level information, and determine the test seed as a high-value seed if the value of the test case exceeds a second preset threshold; wherein the high-value seed is used to update the seed corpus.

[0020] This application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the fuzzing method for fully homomorphic encryption as described above.

[0021] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the fuzzing method for fully homomorphic encryption as described above.

[0022] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the fuzzing method for fully homomorphic encryption as described above.

[0023] The fuzzing method, apparatus, and electronic device for fully homomorphic encryption provided in this application first obtain test seeds and basic expressions based on a seed corpus, and then perform mutation processing on the basic expressions using a mutant to obtain mutated expressions. Next, perform algebraic transformations on the mutated expressions to obtain multiple equivalent expressions, and generate test cases based on these equivalent expressions and the test seeds. The equivalent expressions are expressions that are equivalent to the mutated expressions but have different computational structures. Finally, input the test cases into an executor for execution, and determine whether vulnerabilities exist based on the execution results. Thus, by introducing equivalent expression transformation technology and combining it with the basic principles of fuzzing, test cases that can deeply probe the core computational logic of a program can be generated efficiently and systematically, and a reliable test oracle can be established to automatically determine the correctness of the calculation results. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0025] Figure 1 This is a schematic diagram of the basic computational process of the fully homomorphic encryption technology provided in this application; Figure 2 This is one of the flowcharts illustrating the fuzzing method for fully homomorphic encryption provided in this application; Figure 3 This is the second flowchart of the fuzzing method for fully homomorphic encryption provided in this application; Figure 4 This is a schematic diagram of the fuzz testing device for fully homomorphic encryption provided in this application; Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] The terms "first," "second," etc., used in this application's specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.

[0028] In related technologies, fuzzing tools for traditional cryptographic libraries (such as OpenSSL), such as Cryptofuzz ​​and CLFuzz, have achieved significant results. These tools are typically adept at generating structured inputs (such as keys, initialization vectors, and data to be encrypted) that meet the requirements of cryptographic algorithm interfaces, and discovering implementation inconsistencies through methods such as differential testing (comparing the processing results of different libraries on the same input).

[0029] However, directly applying these existing cryptographic fuzzing tools to fully homomorphic encryption libraries faces two major challenges. First, existing tools cannot effectively test the core functionality of homomorphic computation. The essence of fully homomorphic encryption lies in performing continuous computational operations (such as addition and multiplication) on ciphertext, requiring testing tools to generate valid "arithmetic expressions" or "computation sequences" as input. Existing tools primarily test single cryptographic operations and lack the ability to generate and mutate complex computational logic. Second, existing tools are completely unaware of the "noise" mechanism unique to fully homomorphic encryption. For example... Figure 1 As shown, in fully homomorphic encryption, each ciphertext contains an initial "noise budget," and each homomorphic computation (especially multiplication) consumes a portion of this budget. When the noise exceeds a threshold, the computation result will fail to decrypt correctly. A "noise-insensitive" fuzz tester will randomly generate a large number of computationally overly complex test cases, causing noise to overflow rapidly. This results in these test cases failing to execute early due to decryption failures, preventing in-depth exploration of the library's deep computational logic and severely limiting testing efficiency and code coverage.

[0030] Furthermore, the significant differences in parameter settings, noise management strategies, and interface designs among various fully homomorphic encryption libraries make cross-library differential testing, which is effective in traditional encryption testing, difficult to implement. Therefore, establishing a reliable test oracle within a single library implementation to determine the correctness of computation results has become a pressing technical challenge. In summary, existing technologies lack an automated testing method that can understand and adapt to the core mechanism of fully homomorphic encryption and systematically and efficiently uncover deep vulnerabilities in its computational logic.

[0031] To address the aforementioned technical problems in related technologies, this application provides a fuzz testing method for fully homomorphic encryption. This method introduces a noise-aware feedback mechanism and an equivalent expression transformation technique, combined with the basic principles of fuzz testing, to efficiently and systematically generate test cases that can deeply probe the core computational logic of a program, and to establish a reliable test oracle to automatically determine the correctness of the calculation results.

[0032] Specifically, to construct test cases capable of effectively probing deep computational paths, this invention no longer treats test case generation as stateless random mutation, but rather tightly couples it with noise consumption during homomorphic computation. After executing a test case, the method actively monitors and quantifies the remaining noise budget in the ciphertext of the result, using this noise value as a key feedback signal to guide the generation strategy for the next round of test cases. When the remaining noise is high, the system employs a more aggressive mutation strategy to construct more complex arithmetic expressions to explore deeper program logic; when the remaining noise approaches a critical value of depletion, the system switches to a more refined mutation strategy to carefully probe the boundaries of computational power. Through this dynamic closed-loop feedback, this invention can continuously generate high-quality test cases located at the boundary of "effective computation," significantly improving code coverage and vulnerability discovery capabilities.

[0033] Furthermore, to address the problem of difficulty in determining the correctness of computation results due to the lack of external benchmarks, this invention proposes an internal consistency verification method based on equivalent expression transformation as a test oracle. This invention automatically transforms an initial arithmetic expression into several mathematically equivalent but structurally different representations (such as standard form, factorization form, Horner form, etc.). These structurally different expressions, when translated into specific homomorphic computation interface call sequences, will pass through different code execution paths, exerting varying pressures on the library. By executing these equivalent expressions within the same library and comparing their respective decryption results, any inconsistencies clearly indicate computational defects or logical vulnerabilities in the library. This method thus achieves reliable automated vulnerability determination without cross-library comparison.

[0034] The fuzzing method for fully homomorphic encryption provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0035] like Figure 2 As shown in the embodiment of this application, a fuzz testing method for fully homomorphic encryption is provided, which may include the following steps 201 to 203: Step 201: Obtain test seeds and basic expressions based on the seed corpus, and perform mutation processing on the basic expressions based on the mutant to obtain mutated expressions.

[0036] For example, before the fuzzing process begins, the system first performs initialization operations to establish a stable and consistent fully homomorphic encryption runtime environment. Figure 3 As shown, it specifically includes: 1. Parameter Selection: Based on the supported schemes of the library under test (such as BGV, CKKS, etc.), select a set of effective cryptographic parameters, such as polynomial modulus, ciphertext modulus, plaintext modulus, etc. This set of parameters determines the security level of encryption and the supported computational depth (i.e., the initial noise budget).

[0037] 2. Key Generation: Based on the selected parameters, generate a complete set of keys required for subsequent encryption, decryption, and homomorphic computation, including public key, private key, and relinearization key.

[0038] After initialization, the system either retrieves previously stored high-value test seeds directly from the seed corpus or generates initial test seeds. This corpus is a dynamically maintained collection that stores arithmetic or logical expressions used as the basis for mutation. These expressions can be pre-defined in simple forms or continuously supplemented with "high-value" seeds identified by a feedback mechanism during subsequent tests.

[0039] For example, after seed selection is completed, noise-aware test case construction can be performed to generate test cases for testing.

[0040] For example, the above-mentioned mutants include: a low-noise mutant and a high-noise mutant; the computational complexity of generating the mutant expression by the high-noise mutant is greater than the computational complexity of generating the mutant expression by the low-noise mutant.

[0041] Specifically, step 201 above, which involves performing mutation processing on the basic expression based on the mutant to obtain the mutated expression, may further include the following steps 201a and 201b: Step 201a: Obtain the noise feedback information obtained in the previous round of testing, and select the target mutant from the low-noise mutant and the high-noise mutant based on the noise feedback information.

[0042] Specifically, step 201a above may also include the following steps 201a1 and 201a2: Step 201a1: If the noise feedback information indicates that the noise budget consumption is less than the first preset threshold during the previous test, the high-noise mutant is identified as the target mutant.

[0043] Step 201a2: If the noise feedback information indicates that the noise budget consumption in the previous test round is greater than or equal to the first preset threshold, the low-noise mutant is determined as the target mutant.

[0044] Step 201b: Perform mutation processing on the base expression using the target mutant to obtain the mutated expression.

[0045] For example, such as Figure 3 As shown, the system first selects a base expression from the seed corpus, and then feeds this expression into the mutant unit. The mutant contains at least two strategies: a low-noise mutant and a high-noise mutant. The system dynamically selects a mutation strategy based on feedback signals from subsequent noise processing units. For example, if previous testing indicates minimal noise budget consumption, a high-noise mutant will be used to increase the computational complexity of the expression (e.g., increasing multiplication depth, expanding coefficients); conversely, if noise is nearly exhausted, a low-noise mutant will be used for finer adjustments.

[0046] Step 202: Perform algebraic transformation on the mutation expression to obtain multiple equivalent expressions, and generate test cases based on the multiple equivalent expressions and the test seed.

[0047] The equivalent expression is an expression that is equivalent to the variant expression but has a different computational structure.

[0048] Specifically, step 202 above, which involves performing algebraic transformations on the mutated expression to obtain multiple equivalent expressions, may further include the following step 202a: Step 202a: Perform an algebraic transformation on the mutated expression to transform it into a factorization form or a Horner form, thereby obtaining the plurality of equivalent expressions.

[0049] For example, the mutated new expression is passed to the equivalent expression unit. This unit is the core of constructing the test oracle of this invention. Figure 3As shown, it transforms a single, standard arithmetic expression using algebraic transformations to generate two or more other mathematically equivalent forms, but with different computational structures, such as factorization and Horner forms. Finally, these equivalent expressions together constitute a complete test case and are sent to the execution phase.

[0050] Step 203: Input the test cases into the executor for execution, and determine whether there are vulnerabilities based on the execution results.

[0051] For example, the executors mentioned above include: native executors and fully homomorphic executors. Native executors: In an unencrypted plaintext environment, they directly compute the value of the basic expression, and the result serves as the "baseline truth value" for judging the correctness of subsequent fully homomorphic computations. Fully homomorphic encrypted executors: They call the interface of the library under test to encrypt the plaintext data, and then execute the homomorphic computation sequences corresponding to the standard, factorization, and Horner forms of the three equivalent expressions, respectively.

[0052] Specifically, step 203 above may also include the following steps 203a1 and 203a2: Step 203a1: Calculate the basic expression using the native executor to obtain the truth value calculation result, and encrypt the plaintext data in the test case using the fully homomorphic encryption executor, and perform standard, factorization, and Horner form homomorphic calculation sequences on the encryption result to obtain multiple corresponding fully homomorphic encryption calculation results.

[0053] One homomorphic computation sequence corresponds to one fully homomorphic encryption computation result.

[0054] Step 203a2: Compare the multiple fully homomorphic encryption calculation results with the truth value calculation results respectively, and compare the multiple fully homomorphic encryption calculation results. If the comparison results indicate that there is an inconsistency in the calculation results, then it is determined that there is a vulnerability.

[0055] For example, such as Figure 3 As shown, during execution, the result comparison unit inside the executor compares the decryption result of the fully homomorphic encryption executor with the baseline truth value of the native executor, and also verifies the consistency between the three fully homomorphic encryption calculation results. Any program crash or inconsistency in calculation results during execution will be identified as a potential vulnerability, and a vulnerability report will be generated and sent to the vulnerability analyzer for recording and archiving.

[0056] Optionally, in the embodiments of this application, after the test is completed, noise perception can be performed on the fuzz test, and the noise perception result can be used as feedback to guide the construction of test cases in the next round of testing.

[0057] For example, after step 203 above, the fuzz testing method for fully homomorphic encryption provided in this application embodiment may further include steps 204 and 205: Step 204: Obtain the remaining noise information after performing fully homomorphic encryption, and calculate the complexity of the test case based on the remaining noise information and the expression in the current test process.

[0058] Step 205: Determine the noise level information based on the complexity of the test cases, and generate noise feedback information based on the noise level information.

[0059] For example, such as Figure 3 As shown, after the fully homomorphic encryption executor completes its computation, the residual noise information contained in its final ciphertext result is extracted and transmitted to the noise monitor. The noise monitor then quantifies the residual noise using its internal noise evaluator and analyzes the complexity of the current test case using an expression classifier. The analyzed noise level information is assigned to the noise processor. This processor determines the value of the current test case based on a preset threshold and generates a guidance signal.

[0060] For example, after determining the noise level information based on the complexity of the test cases in step 205 above, the fuzz testing method for fully homomorphic encryption provided in this application embodiment may further include the following step 206: Step 206: Calculate the value of the test case based on the noise level information, and determine the test seed as a high-value seed if the value of the test case exceeds a second preset threshold.

[0061] The high-value seeds are used to update the seed corpus.

[0062] For example, such as Figure 3 As shown, the guidance signals and high-value seeds generated by the noise processor are fed back to the test case construction phase as feedback information, which are used to guide the mutation strategy selection and update the seed corpus, respectively.

[0063] The fuzzing method for fully homomorphic encryption provided in this application first obtains a test seed and a basic expression based on a seed corpus, and then performs mutation processing on the basic expression using a mutant to obtain a mutated expression. Next, it performs an algebraic transformation on the mutated expression to obtain multiple equivalent expressions, and generates test cases based on these equivalent expressions and the test seed. The equivalent expressions are expressions that are equivalent to the mutated expressions but have different computational structures. Finally, the test cases are input into an executor for execution, and the existence of vulnerabilities is determined based on the execution results. Thus, by introducing equivalent expression transformation technology and combining it with the basic principles of fuzzing, test cases that can deeply probe the core computational logic of a program can be generated efficiently and systematically, and a reliable test oracle can be established to automatically determine the correctness of the calculation results.

[0064] It should be noted that the fuzzing method for fully homomorphic encryption provided in this application embodiment can be executed by a fuzzing device for fully homomorphic encryption, or by a control module within that fuzzing device for fully homomorphic encryption that executes the fuzzing method for fully homomorphic encryption. This application embodiment uses the execution of the fuzzing method for fully homomorphic encryption by a fuzzing device for fully homomorphic encryption as an example to illustrate the fuzzing device for fully homomorphic encryption provided in this application embodiment.

[0065] It should be noted that, in the embodiments of this application, the fuzzing methods for fully homomorphic encryption shown in the accompanying drawings are all illustrated using one accompanying drawing from one of the embodiments of this application as an example. In specific implementation, the fuzzing methods for fully homomorphic encryption shown in the accompanying drawings can also be implemented in conjunction with any other accompanying drawings illustrated in the above embodiments, which will not be elaborated here.

[0066] The fuzzing apparatus for fully homomorphic encryption provided in this application is described below. The fuzzing method for fully homomorphic encryption described below can be referred to in correspondence with the fuzzing method for fully homomorphic encryption described above.

[0067] Figure 4 This is a schematic diagram of the fuzz testing device for fully homomorphic encryption provided in an embodiment of this application, as shown below. Figure 4 As shown, it specifically includes: The module includes an acquisition module for obtaining test seeds and basic expressions based on a seed corpus; a mutation module for performing mutation processing on the basic expressions using a mutant to obtain mutated expressions; a generation module for performing algebraic transformations on the mutated expressions to obtain multiple equivalent expressions, and generating test cases based on the multiple equivalent expressions and the test seeds; the equivalent expressions are expressions that are equivalent to the mutated expressions but have different computational structures; and a testing module for inputting the test cases into an executor for execution, and determining whether vulnerabilities exist based on the execution results.

[0068] Optionally, the mutant includes a low-noise mutant and a high-noise mutant; the computational complexity of generating the mutant expression by the high-noise mutant is greater than that of generating the mutant expression by the low-noise mutant; the mutation module is specifically used to obtain noise feedback information obtained in the previous round of testing, and to select a target mutant from the low-noise mutant and the high-noise mutant based on the noise feedback information; the mutation module is further specifically used to perform mutation processing on the basic expression using the target mutant to obtain the mutant expression.

[0069] Optionally, the mutation module is specifically configured to determine the high-noise mutant as the target mutant when the noise feedback information indicates that the noise budget consumption in the previous test is less than a first preset threshold; the mutation module is also specifically configured to determine the low-noise mutant as the target mutant when the noise feedback information indicates that the noise budget consumption in the previous test is greater than or equal to the first preset threshold.

[0070] Optionally, the generation module is specifically used to perform an algebraic transformation on the mutated expression, transforming the mutated expression into a factorization form or a Horner form, to obtain the plurality of equivalent expressions.

[0071] Optionally, the executor includes a native executor and a fully homomorphic executor; the testing module is specifically used to calculate the basic expression using the native executor to obtain a truth value calculation result, and to encrypt the plaintext data in the test case using the fully homomorphic encryption executor, and to perform homomorphic calculation sequences of standard, factorization, and Horner forms on the encryption results respectively to obtain multiple corresponding fully homomorphic encryption calculation results; one homomorphic calculation sequence corresponds to one fully homomorphic encryption calculation result; the testing module is further specifically used to compare the multiple fully homomorphic encryption calculation results with the truth value calculation result respectively, and to compare the multiple fully homomorphic encryption calculation results, and if the comparison result indicates that there is an inconsistency in the calculation results, then a vulnerability is determined to exist.

[0072] Optionally, the device further includes: a calculation module and a feedback module; the calculation module is used to obtain the remaining noise information after performing fully homomorphic encryption, and calculate the complexity of the test case based on the remaining noise information and the expression in the current test process; the feedback module is used to determine the noise level information based on the complexity of the test case, and generate noise feedback information based on the noise level information.

[0073] Optionally, the calculation module is further configured to calculate the value of the test case based on the noise level information, and determine the test seed as a high-value seed if the value of the test case exceeds a second preset threshold; wherein the high-value seed is used to update the seed corpus.

[0074] The fuzzing testing apparatus for fully homomorphic encryption provided in this application first obtains a test seed and a basic expression based on a seed corpus, and then performs mutation processing on the basic expression using a mutant to obtain a mutated expression. Next, it performs an algebraic transformation on the mutated expression to obtain multiple equivalent expressions, and generates test cases based on these equivalent expressions and the test seed. The equivalent expressions are expressions that are equivalent to the mutated expressions but have different computational structures. Finally, the test cases are input into an executor for execution, and the existence of vulnerabilities is determined based on the execution results. Thus, by introducing equivalent expression transformation technology and combining it with the basic principles of fuzzing, test cases capable of deeply probing the core computational logic of a program can be generated efficiently and systematically, and a reliable test oracle can be established to automatically determine the correctness of the computation results.

[0075] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a fuzzing method for fully homomorphic encryption. This method includes: first, obtaining a test seed and a basic expression based on a seed corpus, and performing mutation processing on the basic expression based on a mutant to obtain a mutated expression; then, performing an algebraic transformation on the mutated expression to obtain multiple equivalent expressions, and generating test cases based on the multiple equivalent expressions and the test seed; the equivalent expressions are expressions equivalent to the mutated expressions but with different computational structures; finally, inputting the test cases into an executor for execution, and determining whether a vulnerability exists based on the execution result. Thus, by introducing equivalent expression transformation technology and combining it with the basic principles of fuzz testing, test cases that can deeply probe the core computational logic of a program can be generated efficiently and systematically, and a reliable test oracle can be established to automatically determine the correctness of the calculation results.

[0076] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0077] On the other hand, this application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can execute the fuzzing method for fully homomorphic encryption provided by the above methods. This method includes: first, obtaining a test seed and a basic expression based on a seed corpus, and performing mutation processing on the basic expression based on a mutant to obtain a mutated expression; then, performing an algebraic transformation on the mutated expression to obtain multiple equivalent expressions, and generating test cases based on the multiple equivalent expressions and the test seed; the equivalent expression is an expression equivalent to the mutated expression but with a different computational structure; finally, inputting the test cases into an executor for execution, and determining whether a vulnerability exists based on the execution result. Thus, by introducing equivalent expression transformation technology and combining it with the basic principles of fuzzing, test cases that can deeply probe the core computational logic of a program can be generated efficiently and systematically, and a reliable test oracle can be established to automatically determine the correctness of the calculation results.

[0078] Furthermore, this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, this computer program is implemented to perform the aforementioned fuzzing methods for fully homomorphic encryption. The method includes: first, obtaining a test seed and a basic expression based on a seed corpus, and performing mutation processing on the basic expression using a mutant to obtain a mutated expression; then, performing an algebraic transformation on the mutated expression to obtain multiple equivalent expressions, and generating test cases based on the multiple equivalent expressions and the test seed; the equivalent expressions are expressions equivalent to the mutated expressions but with different computational structures; finally, inputting the test cases into an executor for execution, and determining whether a vulnerability exists based on the execution result. Thus, by introducing equivalent expression transformation technology and combining it with the basic principles of fuzzing, test cases capable of deeply probing the core computational logic of a program can be generated efficiently and systematically, and a reliable test oracle can be established to automatically determine the correctness of the computational results.

[0079] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0080] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A fuzz testing method for fully homomorphic encryption, characterized in that, include: Test seeds and basic expressions are obtained from the seed corpus, and mutation processing is performed on the basic expressions based on the mutant to obtain mutated expressions; The mutation expression is subjected to algebraic transformation to obtain multiple equivalent expressions, and test cases are generated based on the multiple equivalent expressions and the test seed; The equivalent expression is an expression that is equivalent to the variant expression but has a different computational structure; The test cases are input into the executor for execution, and the existence of vulnerabilities is determined based on the execution results.

2. The method according to claim 1, characterized in that, The mutants include: a low-noise mutant and a high-noise mutant; the computational complexity of generating the mutant expression by the high-noise mutant is greater than that of generating the mutant expression by the low-noise mutant. The mutation process performed on the base expression based on the mutant to obtain the mutated expression includes: Obtain noise feedback information from the previous test, and select the target mutant from the low-noise mutant and the high-noise mutant based on the noise feedback information; The target mutant is used to perform mutation processing on the base expression to obtain the mutated expression.

3. The method according to claim 2, characterized in that, The step of selecting the target mutant from the low-noise mutants and the high-noise mutants based on the noise feedback information includes: If the noise feedback information indicates that the noise budget consumption in the previous test was less than a first preset threshold, the high-noise mutant is identified as the target mutant. If the noise feedback information indicates that the noise budget consumption in the previous test was greater than or equal to the first preset threshold, the low-noise mutant is identified as the target mutant.

4. The method according to claim 1, characterized in that, The algebraic transformation of the mutated expression yields multiple equivalent expressions, including: The mutated expression is subjected to an algebraic transformation to transform it into a factorization form or a Horner form, thereby obtaining the plurality of equivalent expressions.

5. The method according to claim 1, characterized in that, The actuators include: native actuators and fully homomorphic actuators; The step of inputting the test cases into the executor for execution and determining whether vulnerabilities exist based on the execution results includes: The native executor is used to calculate the basic expression to obtain the truth value calculation result. The fully homomorphic encryption executor is used to encrypt the plaintext data in the test case. The encryption result is then subjected to standard, factorization, and Horner form homomorphic calculation sequences to obtain multiple corresponding fully homomorphic encryption calculation results. One homomorphic calculation sequence corresponds to one fully homomorphic encryption calculation result. The multiple fully homomorphic encryption calculation results are compared with the truth value calculation results, and the multiple fully homomorphic encryption calculation results are compared. If the comparison results indicate that there is an inconsistency in the calculation results, then a vulnerability is determined to exist.

6. The method according to claim 1, characterized in that, After inputting the test cases into the executor for execution and determining whether a vulnerability exists based on the execution results, the method further includes: Obtain the remaining noise information after performing fully homomorphic encryption, and calculate the complexity of the test case based on the remaining noise information and the expression in the current test process; The noise level information is determined based on the complexity of the test cases, and noise feedback information is generated based on the noise level information.

7. The method according to claim 6, characterized in that, After determining the noise level information based on the complexity of the test cases, the method further includes: The value of the test case is calculated based on the noise level information, and if the value of the test case exceeds a second preset threshold, the test seed is identified as a high-value seed. The high-value seeds are used to update the seed corpus.

8. A fuzz testing device for fully homomorphic encryption, characterized in that, The device includes: The acquisition module is used to obtain test seeds and basic expressions based on the seed corpus; The mutation module is used to perform mutation processing on the base expression based on the mutant to obtain the mutated expression; A generation module is used to perform algebraic transformations on the mutation expression to obtain multiple equivalent expressions, and generate test cases based on the multiple equivalent expressions and the test seed; the equivalent expressions are expressions that are equivalent to the mutation expression but have different computational structures. The testing module is used to input the test cases into the executor for execution and to determine whether vulnerabilities exist based on the execution results.

9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the fuzzing method for fully homomorphic encryption as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the fuzzing method for fully homomorphic encryption as described in any one of claims 1 to 7.