Data encryption method and device, data decryption method and device, equipment and computer storage medium

The data is lexically and semantically analyzed through the LLVM framework and compiled into an LLVM IR encryption statement in the form of a static single assignment. It is not converted into an SMT formula during the transmission process, which solves the problem of secure key transfer and complex key management in a multi-user environment. It achieves high security of data transmission and flexible decoding system.

CN118802229APending Publication Date: 2024-10-18CHINA MOBILE GROUP ANHUI +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311468886.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-02
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In existing data encryption technology, there are loopholes in the secure transmission of keys, resulting in low security in the encryption and decryption process. Especially in multi-user environments, key management is complex, scalability is poor, and key leaks are prone to occur.

Method used

The initial data is lexically and semantically analyzed based on the LLVM project framework, converted into an abstract syntax tree, and compiled into an LLVM IR encrypted statement in the form of a static single assignment. It is not converted into an SMT formula during the transmission process, and is only format converted at the receiving end. and decoding to achieve asymmetric encryption or one-way encryption to prevent key theft and information interception.

Benefits of technology

It improves the security of data transmission, prevents key leaks and information interception, forms a unique decoding system for users, facilitates data security management and personalized customization, and has high commercial value and market prospects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118802229A_ABST
    Figure CN118802229A_ABST
Patent Text Reader

Abstract

The invention discloses a data encryption method and device, a data decryption method and device, equipment and a computer storage medium. The data encryption method applied to a sending end comprises the following steps: performing lexical and semantic analysis on a source code of initial data based on an LLVM project framework to obtain an analysis result; converting an analysis result into an abstract syntax tree, wherein the abstract syntax tree is used for performing code optimization on the source code; compiling the source code after code optimization into an LLVMIR encrypted statement in a static single assignment form; and sending the LLVMIR encrypted statement to a receiving end in communication connection with the sending end. According to the embodiment of the invention, on the basis of the LLVMIR encrypted statement without the decompilation attribute, Trojan horses and scripts of a sending end can be effectively prevented from stealing source information in the transmission process, and hackers can be effectively prevented from intercepting the information during forwarding of a base station or a server, so that the security during information command transmission is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of data encryption and decryption, and in particular, relates to a data encryption and decryption method, device, equipment and computer-readable storage medium. Background Art

[0002] With the development of Internet technology, more and more data information is transmitted through the network, and the issue of information protection is becoming increasingly prominent. The transmission of confidential information is particularly important.

[0003] Symmetric encryption is generally used to encrypt data in the existing technology. During the communication process, the data sender divides the original data into blocks of fixed size, encrypts them one by one using the key and encryption algorithm, and sends them to the receiver. After receiving the ciphertext, the receiver uses the same key to decrypt the combination in combination with the decryption algorithm to obtain the original data. In the above process, since the encryption and decryption algorithms are public, the secure transmission of the key becomes a crucial matter.

[0004] The key is usually negotiated between the two parties and delivered to the other party in a physical way, or through a third-party platform. Once the key is leaked during this process, criminals can intercept and decrypt the encrypted transmission content with the corresponding algorithm. At the same time, the scalability of this technology is also poor. Each pair of communicating users needs to negotiate a key. A group of n users needs to negotiate n*(n-1) / 2 different keys, which is not easy to manage. If the same key is used, the probability of the key being leaked will increase greatly, and encryption will lose its meaning. Therefore, the current encryption and decryption methods are relatively low in security. Summary of the invention

[0005] The embodiments of the present application provide a data encryption and decryption method, apparatus, device and computer-readable storage medium to solve the problem of low data transmission security in the current method of encrypting and decrypting data information through keys.

[0006] In a first aspect, an embodiment of the present application provides a data encryption method, which is applied to a sending end, and the method includes:

[0007] Based on the LLVM project framework, the source code of the initial data is subjected to lexical and semantic analysis to obtain the analysis results;

[0008] Convert the analysis result into an abstract syntax tree, wherein the abstract syntax tree is used to optimize the source code;

[0009] Compile the optimized source code into LLVM IR encrypted statements in static single assignment form;

[0010] The LLVM IR encrypted statement is sent to a receiving end that is communicatively connected to the sending end.

[0011] In a second aspect, an embodiment of the present application provides a data decryption method, which is applied to a receiving end, and the method includes:

[0012] Receiving an LLVM IR encrypted statement sent by a sending end that is communicatively connected to the receiving end;

[0013] Convert the LLVM IR encrypted statement into an SMT formula;

[0014] Input the SMT formula into the SMT solver and output a binary encoding table;

[0015] The binary code table is compared with a preset comparison code table to decrypt and obtain initial data.

[0016] In a third aspect, an embodiment of the present application provides a data encryption device, which is applied to a sending end, and the device includes:

[0017] The code analysis module is used to perform lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain the analysis results;

[0018] A code optimization module, used for converting the analysis result into an abstract syntax tree, wherein the abstract syntax tree is used for optimizing the source code;

[0019] The code compilation module is used to compile the optimized source code into LLVM IR encrypted statements in the form of static single assignment;

[0020] A data sending module is used to send the LLVM IR encrypted statement to a receiving end that is communicatively connected to the sending end.

[0021] In a fourth aspect, an embodiment of the present application provides a data decryption device, which is applied to a receiving end, and the device includes:

[0022] A data receiving module, used for receiving an LLVM IR encrypted statement sent by a sending end that is in communication connection with the receiving end;

[0023] A formula conversion module, used for converting the LLVM IR encrypted statement into an SMT formula;

[0024] A formula solving module, used for inputting the SMT formula into an SMT solver to output a binary coding table;

[0025] The coding comparison module is used to compare the binary coding table with a preset comparison code table to decrypt and obtain initial data.

[0026] In a fifth aspect, an embodiment of the present application provides a terminal device, the device comprising: a processor and a memory storing computer program instructions;

[0027] When the processor executes the computer program instructions, it implements the data encryption method of the first aspect, or implements the data decryption method of the second aspect.

[0028] In a sixth aspect, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the data encryption method of the first aspect is implemented, or the data decryption method of the second aspect is implemented.

[0029] In the seventh aspect, an embodiment of the present application provides a computer program product, characterized in that when the instructions in the computer program product are executed by the processor of the terminal device, the terminal device executes the data encryption method as in the first aspect, or implements the data decryption method as in the second aspect.

[0030] The data encryption method applied to the sending end provided in the embodiment of the present application performs lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain the analysis result; converts the analysis result into an abstract syntax tree, and the abstract syntax tree is used to optimize the source code; compiles the optimized source code into an LLVM IR encryption statement in the form of a static single assignment; and sends the LLVM IR encryption statement to the receiving end connected to the communication with the sending end. In the embodiment of the present application, the data in the transmission process between the sending end and the receiving end is an LLVM IR statement that has not been converted into an SMT formula. The statement has an irreversible property from the source code conversion, and the format conversion is performed only after it is transmitted to the target receiving end, and the decoding operation is verified. It has excellent confidentiality and interception invalidation functions. The present application uses an asymmetric encryption or a one-way encryption method for the source code, which can effectively prevent the Trojan horse and script at the sending end from stealing the source information during the transmission process, and the hacker from intercepting the information when the base station or server forwards, thereby ensuring the security of information command transmission. In addition, based on this application, a user-specific decoding system can be formed, and the specific decoding content can be edited by the user. While improving data security, it also facilitates users to manage and personalize data security, and has high commercial value and market prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0032] Figure 1 It is a schematic diagram of the framework structure that can implement the data encryption and decryption method provided in the embodiment of the present application;

[0033] Figure 2It is a flowchart of a data encryption method applied to a sending end provided in an embodiment of the present application;

[0034] Figure 3 It is a flowchart of a data decryption method applied to a receiving end provided in an embodiment of the present application;

[0035] Figure 4 This is a simplified schematic diagram of the entire process provided by the embodiment of the present application;

[0036] Figure 5 This is a schematic diagram of the source code provided in the embodiment of the present application being optimized by the LLVM component;

[0037] Figure 6 It is a CFG directed graph provided in an embodiment of the present application;

[0038] Figure 7 is another CFG directed graph provided in an embodiment of the present application;

[0039] Figure 8 It is a tree diagram based on a C language applet provided in an embodiment of the present application;

[0040] Fig. 9 It is a control flow graph based on a C language applet provided in an embodiment of the present application;

[0041] Fig.10 It is a structural diagram of a data encryption device applied to a sending end provided in an embodiment of the present application;

[0042] Fig.11 is a structural diagram of a data decryption device applied to a receiving end provided in an embodiment of the present application;

[0043] Fig.12 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0045] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0046] In order to solve the problems of the prior art, the embodiments of the present application provide a data encryption and decryption method, device, equipment and computer storage medium. The following first illustrates an example framework of the data encryption and decryption method provided by the embodiments of the present application.

[0047] like Figure 1 As shown, the framework may include a server / base station 20 and a terminal device 10, wherein the terminal device 10 includes a transmitting end and a receiving end, and may be, for example, a mobile terminal, a personal computer or a wearable device, etc., which is not specifically limited here.

[0048] The terminal device 10 may have a communication module, wherein the communication module may be a 5G, 4G or WiFi type communication module, which may be used to realize communication between the terminal device 10 and the server / base station 20 and communication between the transmitting end and the receiving end.

[0049] The terminal device 10 can communicate with the server / base station 20. For example, the sending end in the terminal device 10 can send the LLVM IR encrypted statement to the server / base station 20, and then the server / base station 20 forwards it to the receiving end in the terminal device 10.

[0050] The server / base station 20 may receive and process data sent by the terminal device 10. For example, the server / base station 20 may forward the LLVM IR encrypted statement sent by the terminal device 10 as the sending end to the corresponding terminal device 10 as the receiving end.

[0051] The following first introduces the data encryption method provided in the embodiment of the present application.

[0052] Figure 2 FIG. 1 is a flow chart of a data encryption method provided by an embodiment of the present application. The data encryption method can be applied to a terminal device as a sending end, such as Figure 2As shown, the method includes:

[0053] Step 201, performing lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain analysis results;

[0054] Step 202, converting the analysis result into an abstract syntax tree, wherein the abstract syntax tree is used to optimize the source code;

[0055] Step 203, compile the optimized source code into a static single assignment form of LLVM IR encrypted statement;

[0056] Step 204: Send the LLVM IR encrypted statement to a receiving end that is communicatively connected to the sending end.

[0057] As shown above, the terminal device can be a mobile terminal, a personal computer or a wearable device, etc., which is not specifically limited here. The terminal device can be divided into a sending end and a receiving end.

[0058] In step 201, the sending end performs lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain analysis results.

[0059] The LLVM project refers to a collection of modular and reusable compiler and toolchain technologies. More specifically, LLVM is a compiler framework system written in C++, which is used to optimize the compile time, link time, run time, and idle time of programs written in any programming language. It is open to developers and compatible with existing scripts.

[0060] The source code can be written first. During the source code writing stage, the data to be encrypted is given the form of source code. The source code here can use C language code to write the initial command line, such as outputting the security key randomly generated by the confidential database; it can also be written in other programming languages, such as Fortran, Haskell, etc. This is only an example and does not limit the programming language for writing the source code.

[0061] Based on the existing LLVM project framework, lexical and syntactic analysis can be performed on the written source code to obtain analysis results, which is the basic function of LLVM.

[0062] Specifically, during the source code optimization phase, please refer to Figure 5 ;

[0063] You can use the Clang component in LLVM (the "LLVM native" C / C++ / Objective-C compiler) to perform lexical analysis and semantic analysis on source code written in C language to obtain analysis results.

[0064] You can also use the GCC compiler in LLVM to perform lexical analysis and semantic analysis on the source code written in Fortran language to obtain analysis results.

[0065] You can also use the GHC compiler in LLVM to perform lexical analysis and semantic analysis on the source code written in the Haskell language to obtain analysis results.

[0066] In step 202, the sending end further converts the analysis result into an abstract syntax tree, and the abstract syntax tree is used to perform code optimization on the source code.

[0067] It is preferred to use the Clang compiler, which is used as an example for explanation. The written source code is passed through the LLVM component Clang to perform lexical analysis and semantic analysis on the source program, convert the analysis results into AST (abstract syntax tree, AST, abstract syntax tree), and parse and preliminarily optimize the source code.

[0068] It should be noted that in LLVM, the code is represented as an abstract syntax tree (AST). AST is an abstract representation of the code, which ignores the details of the specific language syntax and only retains the useful information in the code. The abstract syntax tree can save computing resources and make code parsing and optimization more efficient.

[0069] In step 203, the sending end may compile the code-optimized source code into LLVMIR encrypted statements in a static single assignment form.

[0070] The LLVM subproject Clang compiler is called to compile the source code, convert the sorted optimized block statements, generate an intermediate representation that is independent of the platform and language, and then analyze the intermediate representation through the subproject Opt optimizer to selectively optimize the intermediate representation. At this time, the intermediate representation generated by the Clang compiler is not in the complete SSA (static single assignment) form. The optimization strategy can be used to promote memory variables to register variables, thereby obtaining LLVM IR encrypted statements in the static single assignment form.

[0071] It should be noted that the definition of static single assignment is as follows:

[0072] All and any variables can only be defined once; variables can be used multiple times but the use and definition of the variables must satisfy their dominance relationship. Note: When the same variable is assigned multiple times, they should be distinguished by renaming the variable to prevent multiple definitions.

[0073] The dominance relationship refers to the order relationship of the paths actually executed between the nodes in the control flow graph, and has the properties of reflexivity, antisymmetry and transmission. Its dual is the post-dominance relationship, and they all belong to control dependency relationships. The processed LLVM IR is statically assigned and converted into SSA FORM (static single assignment form) to keep the data flow and control flow of the program, so that the variables are defined before use and assigned once, which can be conveniently defined in SSA mode. SSAFROM is a form of representing the source of program variables. In this form, variables can be defined by a single instruction. Therefore, the following instruction sequence, which only uses the variable z: z = x = 5, z = z + 2, is converted into the following instruction sequence: z1 = x + 5, z2 = z1 + 2. This processing is essential and allows variables to not change value during program execution. Bitcode LLVM is in SSA form, and this form will easily provide different states of variables by a program with one variable.

[0074] In step 204, the sending end sends the LLVM IR encrypted statement to the receiving end connected to the sending end.

[0075] The sender can send LLVM IR encrypted statements to the receiver through the base station / server, or directly send LLVM IR encrypted statements to the receiver.

[0076] During the encrypted information sending and receiving stage, the processed and optimized LLVM IR intermediate statements (also called intermediate representations, i.e. encrypted statements) are sent. At this time, the encrypted command line no longer has the decompilation attribute and can only be analyzed and decoded through the read instruction set of the target client (receiving end), and the information is securely sent to the target user.

[0077] The data encryption method applied to the sending end provided in the embodiment of the present application performs lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain the analysis result; converts the analysis result into an abstract syntax tree, and the abstract syntax tree is used to optimize the source code; compiles the optimized source code into an LLVM IR encryption statement in the form of a static single assignment; and sends the LLVM IR encryption statement to the receiving end connected to the communication with the sending end. In the embodiment of the present application, the data in the transmission process between the sending end and the receiving end is an LLVM IR statement that has not been converted into an SMT formula. The statement has an irreversible property from the source code conversion, and the format conversion is performed only after it is transmitted to the target receiving end, and the decoding operation is verified. It has excellent confidentiality and interception invalidation functions. The present application uses an asymmetric encryption or a one-way encryption method for the source code, which can effectively prevent the Trojan horse and script at the sending end from stealing the source information during the transmission process, and the hacker from intercepting the information when the base station or server forwards, thereby ensuring the security of information command transmission. In addition, based on this application, a user-specific decoding system can be formed, and the specific decoding content can be edited by the user. While improving data security, it also facilitates users to manage and personalize data security, and has high commercial value and market prospects.

[0078] Optionally, the step 204 performs lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain analysis results, including:

[0079] The Clang compiler in the LLVM project framework is called to perform lexical and semantic analysis on the source code of the initial data to obtain the analysis results.

[0080] In this embodiment, the Clang compiler is preferably used to perform lexical and semantic analysis on source code written in C, C++, or Objective-C because of some advantages of Clang itself:

[0081] 1. Fast compilation and less memory usage; with diagnostic function; compatible with GCC;

[0082] 2. Infrastructure module library; can meet various customer needs (code refactoring, dynamic analysis, code generation, etc.); allows integration into various IDEs; uses LLVM'BSD' protocol;

[0083] 3. A non-portable code base; a non-universal grammar parser designed for C, Objective-C, C++, and Objective-C++; highly consistent with C / C++ / Objective-C and their derivative languages.

[0084] Optionally, the step 203, compiling the code-optimized source code into a static single assignment form of LLVM IR encrypted statements, includes:

[0085] Calling the Clang compiler to compile the optimized source code into the original LLVM IR intermediate statement;

[0086] The original LLVM IR intermediate statement is statically assigned to obtain a static single assignment form of LLVM IR encrypted statement.

[0087] As mentioned above, the intermediate representation generated by the Clang compiler is not in full SSA form. Through optimization strategies, memory variables can be promoted to register variables, the read and write operations of memory variables can be eliminated, and some redundant intermediate representations can be deleted, so as to achieve static assignment of LLVM IR intermediate statements and obtain LLVM IR encrypted statements in static single assignment form. That is, the processed LLVM IR is converted into SSA FORM for static assignment to keep the data flow and control flow of the program, so that variables are defined and assigned once before use, and can be conveniently defined in SSA mode. SSA FORM is a form of representing program variable sources. In this form, variables can be defined by a single instruction.

[0088] Optionally, the statically assigning the original LLVM IR intermediate statement includes:

[0089] Convert the memory variables corresponding to the original LLVM IR intermediate statements into register variables and insert phi nodes at the preset positions.

[0090] The intermediate representation generated by the Clang compiler is not in complete SSA form. Through optimization strategies, memory variables are promoted to register variables, the read and write operations of memory variables are eliminated, some redundant intermediate representations are deleted, and phi nodes are inserted at appropriate locations.

[0091] LLVM's intermediate representation is based on a static single assignment representation. Most variables do not need to consider the control flow information of the program, but only need to implement data flow information. However, when multiple definitions of the same variable arrive in a basic block, the phi function is introduced to ensure that the static single assignment form of the intermediate representation is not destroyed. At the same time, there is a hidden problem that the specific value of the phi instruction variable depends on the control flow information of the program, that is, the specific execution path of the program.

[0092] The verification system constructed by the control dependency relationship adopted in this embodiment aims to avoid directly constructing and encoding the control flow information, but obtains the judgment conditions of the path branch jump through the control dependency relationship, and indirectly represents the control flow information. This method can not only correctly represent the control flow information of the program, but also greatly reduce the variable overhead required to construct the control flow information, simplify the constraint formula, and reduce the complexity and scale of the formula.

[0093] Optionally, the statically assigning the original LLVM IR intermediate statement includes:

[0094] The Opt optimizer of the LLVM project framework is used to inline the calling function in the original form of the LLVM IR intermediate statement into the main function.

[0095] The intermediate representation (the original form of the LLVM IR intermediate statement) is inlined by LLVM's optimizer Opt, the called function code is inlined into the main function, and the memory variable promotion optimization strategy is used to obtain the intermediate representation based on the static single assignment form.

[0096] There are many function calls in the program. Integrate the called functions into the main function to reduce the function calls of the program, eliminate the formal parameter variable overhead and the stack memory overhead corresponding to the function call, and integrate the program into the main function. Although the main program becomes larger, it is easier to optimize and parse.

[0097] like Figure 3 As shown, the embodiment of the present application also provides a data decryption method, which is applied to a receiving end in a terminal device, and the method includes:

[0098] Step 301, receiving an LLVM IR encrypted statement sent by a sending end that is in communication connection with the receiving end;

[0099] Step 302, converting the LLVM IR encrypted statement into an SMT formula;

[0100] Step 303, input the SMT formula into the SMT solver, and output a binary coding table;

[0101] Step 304: compare the binary code table with a preset comparison code table to decrypt and obtain initial data.

[0102] In this embodiment, after receiving the LLVM IR encrypted statement sent by the sending end, the receiving end decodes the LLVM IR encrypted statement. The decoding method can use the semantics of the control flow and program statements to topologically sort the LLVM IR, convert the static single assignment form, and represent the program as an SMT formula (an extension of the SAT formula). Use the SMT solver to solve, so as to obtain the satisfiability of the formula. Finally, the satisfiability of the SMT formula (or SAT formula) can be used to determine whether the program statement sequence is a statement sequence that can be executed, thereby realizing the proof of conditions such as code assertions. The true proposition definition output is 1, and the false proposition definition output is 0, thereby obtaining a binary encoding table, and then a customizable preset comparison code table (such as an ASCLL code table) is used to compare with the above binary encoding table to obtain the original data to be transmitted.

[0103] The SMT solver in this embodiment may be Z3 and / or Math SMT, or other solvers may be selected as needed, which are only used as examples.

[0104] Z3 provides great functionality for software analysis and verification tools. Several common software constructs can be directly mapped to supported theories. It can be used in many scenarios, such as software / hardware testing, constraint solving, hybrid system analysis, security, biological (drug design), and geometric problems. Z3 is a low-level tool that is best applied as a component to other tools that need to solve logical formulas. For ease of use, z3 provides many APIs. The languages ​​supported by these APIs are C, NET, and OCaml. Of course, z3 can also be executed through the command line. The input format of Z3 is an extension of the SMT-LIB2.0 standard. A Z3 script is a sequence of commands. You can use the "help" command to view a list of available commands. The echo command is used to display messages. Z3 maintains a stack internally, which saves formulas and statements (constants and functions) entered by the user. The declare const command is used to declare a constant of a given type, and the declare fun command is used to declare a function. Sometimes when solving some similar problems, you want to reuse some definitions and assertions. z3 provides push and pop commands to achieve this function. As mentioned above, z3 maintains a global stack where definitions and assertions are stored. The Push command creates a scope by saving the current stack size. The Pop command removes all assertions and declarations between matching pushes. Z3 is a state-of-the-art theorem prover from Microsoft Research. It can be used to check the satisfiability of a logical formula on one or more theories.

[0105] MathSMT is implemented in C++, using an object-oriented paradigm. One of the most important aspects of the implementation is the use of several special variants of general-purpose data structures (such as vectors, stacks, queues, hash tables), which are specialized for critical parts of the code, which means that the overall performance of the parser can be effectively improved. The main reason for this is memory management. In particular, the custom data structures and algorithms are designed to reduce the overhead caused by excessive memory allocation / deallocation and take advantage of the availability of dedicated allocators to ensure cache-friendly layout of data in memory. MathSMT SMT solver, is an advanced SMT solver. MathSMT handles several useful theories: combination of equations and uninterpreted functions, differential logic, linear algorithms, and bit vector theory. It is explicitly designed for formal verification, providing features that extend the applicability of SMT in this context. In particular: model generation (for counterexample reconstruction), model enumeration (for predicate abstraction), incremental interface (for BMC), and computing unsatisfiable kernels and Craig interpolation (for abstraction). The default input format for MathSMT is SMT-Lib v2. The solver also accepts SMT-Lib v1.2 and DIMACS. The input format can be changed using the -input command line argument. In all cases the input problem must be given on standard input.

[0106] The data encryption method applied to the receiving end provided in the embodiment of the present application receives the LLVM IR encrypted statement sent by the sending end connected to the receiving end; converts the LLVM IR encrypted statement into an SMT formula; inputs the SMT formula into the SMT solver, outputs a binary code table; compares the binary code table with the preset reference code table to decrypt and obtain the initial data. In the embodiment of the present application, the receiving end receives the LLVM IR encrypted statement. Since the statement has an irreversible property from the source code conversion, the format conversion can only be performed when it reaches the designated receiving end, and the decoding operation is verified, which can effectively prevent the Trojan horse and script at the sending end from stealing the source information during the transmission process and the hacker from intercepting the information when the base station or server forwards, thereby ensuring the security of the information command transmission. In addition, based on this application, a user-specific decoding system can be formed, and the specific decoding content can be edited by the user. While improving data security, it is also convenient for users to manage and customize data security, and has high commercial value and market prospects.

[0107] Optionally, step 302, converting the LLVM IR encrypted statement into an SMT formula, includes:

[0108] Topologically sorting the LLVM IR encrypted statements using semantic analysis and control flow information of the LLVM IR encrypted statements;

[0109] Convert the LLVM IR encrypted statement into an SMT formula.

[0110] Among them, LLVM IR encrypted statements are often referred to as programs, including data flow information and control flow information (i.e. control flow graph, CFG).

[0111] The bounded model detection method can be used to perform loop unrolling on the optimized LLVM IR encrypted statements. Then, the LLVM IR encrypted statements are analyzed through the interface provided by LLVM to generate the corresponding main tree and subsequent main trees, and the basic block list of the LLVM IR encrypted statements is analyzed according to the existing topological sorting algorithm to generate the topological sequence blocking of the corresponding main tree.

[0112] Furthermore, the LLVM IR encrypted statements can be converted into SMT-lib2 specification formulas, namely SMT formulas, through semantic analysis.

[0113] More specifically, according to the block order of the LLVM IR encrypted statements, the program is represented as an SMT formula, and the LLVM compiler defaults to storing variables of the source program. Therefore, each playback variable needs to call an instruction to load it into memory, and each entry in the variable needs to call a storage instruction. After converting the original LLVM IR into SSA FORM in the previous step, it meets the requirement that variables can be defined by a single instruction. Finally, the theorem solver is used to judge the obtained SMT formula and obtain the result.

[0114] All generated formula sets that conform to the SMT-lib2 specification are input and passed to the SMT solver. The SMT solver can also convert the formula set into SMT formulas and then call the SMT solver for verification. In this way, the initial data is obtained.

[0115] Optionally, the topological sorting of the LLVM IR encrypted statements by using semantic analysis and control flow information of the LLVM IR encrypted statements includes:

[0116] Expanding the loop of the LLVM IR encrypted statement through semantic analysis and the control flow information of the LLVM IR encrypted statement, and converting the control flow information of the LLVM IR encrypted statement into a directed acyclic graph;

[0117] The directed acyclic graph is solved by using a preset topological sorting rule, and the LLVM IR encrypted statements are topologically sorted.

[0118] The topological order of the program nodes corresponding to the LLVM IR encrypted statements indicates the execution order between the program nodes. Before calculating the topological order of the program nodes, it is necessary to expand the program loop, convert its corresponding control flow graph (control flow information) into a directed acyclic graph, and then solve a set of ordered node ordering through the topological sorting algorithm (preset topological sorting rules).

[0119] The topological order can be defined as follows:

[0120] ① Directed acyclic graph;

[0121] ② Each vertex appears and only appears once;

[0122] ③If vertex A comes before vertex B in the sequence, there is no path from vertex B to vertex A in the graph.

[0123] In the process of analyzing the basic block (BB) of the program, it is necessary to frequently traverse the basic block list, and the list needs to be arranged in the order of program execution. Therefore, it is necessary to first obtain the ordered queue of the basic blocks of the LLVM IR encrypted statements through topological sorting.

[0124] For more details, please refer to Figure 6 , for LLVM's control flow graph topological sorting implementation: A common question about LLVM that comes up on Stack Overflow is how to build a control flow graph (CFG) for a function and then topologically sort it, or some variation of it. Basic blocks (BBs) are already organized in the CFG, there is no need to build a new graph in order to run interesting analysis. Each BB has a list of successor BBs to which control flow can transfer from this BB. This can be easily obtained by looking at the terminator instruction of the BB (by definition, a BB has a terminator).

[0125] Consider AA, BB, CC, and DD as different basic blocks. During the recursive search, vertices are marked as "grey" when they are first encountered and "black" when they are retrimmed. A completed vertex is a vertex whose outgoing edges have all been explored. A topological sort is a list of all vertices sorted by completion time from last to first (this is also called "reverse post sort"). In the specific example, a basic block is a vertex and the links to its successors are edges. For this Figure 6 The CFG in the topological order can be obtained:

[0126] AA

[0127] BB

[0128] CC

[0129] DD

[0130] However, there is one caveat. Topological order is only defined for acyclic directed graphs. While the basic block graph is directed, it is not necessarily acyclic. In fact, any cycle in the code is converted to a cycle in the BB graph. The above code detects this and reports an error, refusing to provide an ordering when a cycle is found. For example, referring to Figure 7 , consider this CFG containing some loops:

[0131] Since topological sorting is in reverse order, if such an order is really needed, consider coming from the same class. However, neither of these methods can detect cycles. In the presence of cycles, these iterators will produce some traversals, but this is not a topological order because it is undefined in this case. If you want a tool to detect cycles, there is FindFunctionBackedges in llvm. It actually runs the same DFS shown above, although using an iterative algorithm and an explicit stack instead of recursion.

[0132] In order to further understand the control flow information of LLVM IR encrypted statements, in a specific implementation use case:

[0133] A simple C language program is cited as the source code. The following test cases and plots are based on the following source code:

[0134] int foo(intx, inty)①

[0135] {

[0136] If(x>5)②

[0137] {

[0138] if(y>5)③

[0139] y=x+y;

[0140] else④

[0141] y = xy;

[0142] }

[0143] else⑤

[0144] {

[0145] if(y>5)⑥

[0146] y=x+y;

[0147] else⑦

[0148] y = xy;

[0149] }

[0150] return y;⑧

[0151] }

[0152] Number the above code segments 1-8 and make a tree diagram as follows Figure 8 shown.

[0153] Based on the C language program code, the control flow graph can be obtained as follows Fig. 9 shown.

[0154] Reference Fig. 9 , and explain this:

[0155] Starting from the first block (basic block, hereinafter referred to as block), we number them from BB1-10. From this, we can write a coding formula based on discrete mathematics to facilitate the generation of the final SMT formula and explain it (underscores are used to indicate non-integers):

[0156] 1. From BB1, we can know that the variable is x. To successfully run to BB1, the prefix must be true. Then the following is to judge the variable x. Enter entry and judge the condition sgt. It can be obtained that when x>5, the output is true to BB2. When it is not satisfied, the output is false to BB3. Therefore, the code at this time can be written as: BB1∩cmp->BB2,BB1∩cmp->BB3.

[0157] 2. From BB2, we can know that BB2 is obtained from BB1, so the precondition is BB1∩cmp->BB2. At this time, the variable cmp1 is judged, and the input is then=BB1∩cmp. The judgment condition is slt. It can be obtained that when y<5, the output is true to BB4, when it is not satisfied, the output is false to BB5, so the encoding can be written as: (BB1∩cmp)∩cmp1->BB4, (BB1∩cmp)∩cmp1->BB5.

[0158] 3. From BB3, we can know that the variable is y, and BB3 is obtained from BB1, so the precondition is BB1∩cmp->BB3. At this time, the variable cmp4 is judged, and the input is else3=BB1∩cmp. The judgment condition is sgt. It can be obtained that when y>5, the output is true to BB6, and when it is not satisfied, the output is false to BB7. At this time, the encoding can be written as: (BB1∩cmp)∩cmp4->BB6, (BB1∩cmp)∩cmp4->BB7.

[0159] 4. From BB8, we can see that when any output of BB4 or BB5 is true, BB8 can be obtained. At this time, the precondition is (BB1∩cmp)∩cmp1 or (BB1∩cmp)∩cmp1. At this time, the encoding can be written as [(BB1∩cmp)∩cmp1]∪[(BB1∩cmp)∩cmp1]->BB8.

[0160] 5. From BB9, we can see that when any output of BB6 or BB7 is true, BB9 can be obtained. At this time, the precondition is (BB1∩cmp)∩cmp4 or (BB1∩cmp)∩cmp4. At this time, the encoding can be written as [(BB1∩cmp)∩cmp4]∪[(BB1∩cmp)∩cmp4]->BB9.

[0161] 6. From BB10, we can know that when any of BB8 and BB9 outputs true, BB10 can be obtained. At this time, the precondition is [(BB1∩cmp)∩cmp1]∪[(BB1∩cmp)∩cmp1] or [(BB1∩cmp)∩cmp4]∪[(BB1∩cmp)∩cmp4]. At this time, the encoding can be written as {[(BB1∩cmp)∩cmp1]∪[(BB1∩cmp)∩cmp1]}∪{[(BB1∩cmp)∩cmp4]∪[(BB1∩cmp)∩cmp4]}->BB10

[0162] In summary, the set of discrete mathematical implied formulas that can be obtained is as follows:

[0163] 1)BB1∩cmp->BB2

[0164] 2)BB1∩cmp->BB3

[0165] 3)(BB1∩cmp)∩cmp1->BB4

[0166] 4)(BB1∩cmp)∩cmp1->BB5

[0167] 5)(BB1∩cmp)∩cmp4->BB6

[0168] 6)(BB1∩cmp)∩cmp4->BB7

[0169] 7)[(BB1∩cmp)∩cmp1]∪[(BB1∩cmp)∩cmp1]->BB8

[0170] 8)[(BB1∩cmp)∩cmp4]∪[(BB1∩cmp)∩cmp4]->BB9

[0171] 9){[(BB1∩cmp)∩cmp1]∪[(BB1∩cmp)∩cmp1]}∪{[(BB1∩cmp)∩cmp4]∪[(BB1∩cmp)∩cmp4]}->BB10.

[0172] Optionally, the step of converting the LLVM IR encrypted statement into an SMT formula comprises:

[0173] In the process of traversing the LLVM IR encrypted statement for the first time, all non-termination instructions in each basic block of the LLVM IR encrypted statement are read in sequence, and a variable declaration formula is constructed according to the bit length of the instruction variable of the LLVM IR encrypted statement, wherein the variable declaration formula belongs to the SMT-lib2 specification;

[0174] In the process of traversing the LLVM IR encrypted statement for the second time, converting the LLVM IR encrypted statement into a semantically equivalent variable constraint formula through semantic analysis, wherein the variable constraint formula belongs to the SMT-lib2 specification;

[0175] The judgment condition in the input assertion function is inverted and converted into a semantically equivalent assertion formula, which belongs to the SMT-lib2 specification.

[0176] Furthermore, the SMT formula set consisting of the variable declaration formula, the variable constraint formula and the assertion formula can be input into the SMT solver for verification, and a binary coding table can be output; the SMT solver can also be called to convert the SMT formula set into a SAT formula set, and the SAT formula set can be input into the SAT solver for verification, and a binary coding table can be output.

[0177] In this embodiment, LLVM instructions mainly include binary operation instructions, comparison instructions, phi instructions and termination instructions, etc. Although the optimized LLVM IR encryption statement form is a static single assignment, the specific assignment of the phi instruction variable depends on the same variables in the basic block, so it is necessary to combine the control flow information to correctly represent the phi instruction variable. The termination instruction contains basic block migration information, that is, control flow information rather than data flow information, so there is no need to specially construct variables related to the control flow, and such instructions can be skipped directly. Binary operation instructions and comparison instructions based on the static single assignment form have only unique variable definitions, and there is no need to consider the control flow information of such instructions. They are directly converted into semantically equivalent SMT-lib2 specification constraint formulas through semantic analysis.

[0178] The SMT solver requires variables to be defined before use, so the declaration formula of the variable definition and the constraint formula of the variable usage are completed by traversing the optimized intermediate representation twice. During the first traversal of the intermediate representation, all non-termination instructions in each basic block are read in turn, and the corresponding SMT-lib2 standard variable declaration formula is constructed according to the bit length of the instruction variable. Although the termination instruction contains control flow information but not data flow information, there is no need to add additional variable overhead for this.

[0179] The assertion function call instruction is manually added to the function by the developer to check whether the program meets the constraints at the current time. Therefore, the judgment condition in the assertion function is reversed, converted into a semantically equivalent SMT-lib2 specification formula, and passed to the SMT solver for verification. All variables of the program are represented in static single assignment form. If the global control dependency is not added as a constraint, the SMT solver may give a set of solutions that violate the assertion, and the actual execution path will not pass through the assertion function call instruction. The data flow information and control flow information of the assertion function call instruction are composed of the static single assignment form and the global control dependency, which ensures the accuracy of the attribute constraint detection and avoids false positives.

[0180] All the generated formula sets that conform to the SMT-lib2 specification are input and passed to the SMT solver. The SMT solver can then convert the formula sets into SAT formulas and call the SAT solver for verification.

[0181] In a specific implementation example, when the above tree diagram, control flow graph and the encoding of discrete mathematics implication conditions (discrete mathematics implication formula set) are obtained, the LLVM IR encrypted statement can be easily converted into an SMT formula:

[0182] 1.(assert$Sentry)

[0183] 2.(assert(=>$entry(=$cmp(bvsgt$x(_bv532)))))

[0184] 3.(assert(and(=(and$entry$cmp)$entry_if.then)(=(and$entry(not$cmp))$entry if.else4)))

[0185] 4.(assert(=$if.then$entry_if.then))

[0186] 5.(assert(=>$if.then(=$cmp 1(bvsgt$y(_bv532)))))

[0187] 6.(assert(and(=(and$if.then$cmpl)$if.then_if.then2)(=(and$if.then(not$cmp 1))$if.then_if.else)))

[0188] 7.(assert(=$if.then2$if.then_if.then2))

[0189] 8.(assert(=>$if.then2(=$add(bvadd$x$y))))

[0190] 9.(assert(=$if.then2$if.then2_if.end))

[0191] 10.(assert(=$if.else$if.then if.else))

[0192] 11.(assert(=>$if.else(=$sub(bvsub$x$y))))

[0193] 12.(assert(=$if.else$if.else_if.end))

[0194] 13.(assert(=$if.end(or$if.else_if.end$if.then2_if.end)))

[0195] 14.(assert(=>$if.end(=$y.0(ite$if.then2 if.end$add$sub))))

[0196] 15.(assert(=$if.end$if.end_if.end 10))

[0197] 16.(assert(=$if.else3$entry_if.else4))

[0198] 17.(assert(=>$if.else3(=$cmp4(bvsgt$y(_bv532)))))

[0199] 18. (assert (and (= (and $if.else3 $cmp4) $if.else3_if.then5) (= (and $if.else3 (not $cmp4)) $if.else3_if.else7)))

[0200] 19. (assert (= $if.then5 $if.else3_if.then5))

[0201] 20. (assert (= >$if.then5 (= $add6 (bvadd $x $y))))

[0202] 21. (assert (= $if.then5 $if.then5_if.end9))

[0203] 22. (assert (= $if.else7 $if.else3_if.else7))

[0204] 23. (assert (= >$if.else7 (= $sub8 (bvsub $x $y))))

[0205] 24. (assert (= $if.else7 $if.else7_if.end9))

[0206] 25. (assert (= $if.end9 (or $if.else7_if.end9 $if.then5_if.end9)))

[0207] 26. (assert (= >$if.end9 (= $y.1 (ite $if.then5 if.end9 $add6 $sub8))))

[0208] 27. (assert (= $if.end9 $if.end9_if.end 10))

[0209] 28. (assert (= $if.endl0 (or $if.end9 if.endl0 $if.end_if.endl0)))

[0210] 29. (assert (= >$if.end 10 (= $y.2 (ite $if.end_if.endl0 $y.0 $y.1))))

[0211] A brief description of the generation of the above SMT formula is as follows Fig. 9As shown, the input proposition is entry, and in order for the control flow to proceed, the premise of the first BB block must be true, that is (assert$Sentry). Combining the tree diagram and the implied formula based on discrete mathematics, all the control flow information here can be easily understood. Traverse the control flow graph according to the rules: when BB1->BB2, the input variable name is cmp. When cmp meets the conditions, the control flow graph meets the conditions and reaches BB2. The condition that the variable cmp meets the proposition is sgt$x (that is, sgt i32%x,5). When x>5, the condition is met, and traverse from BB1 to BB2. The output SMT formula is (assert(=>$entry(=$cmp(bvsgt$x(_bv532))))). In summary, the SMT formula for traversing the control flow graph is shown above.

[0212] The SMT-lib2 specification requires that all variables must be defined before the related variables are used in subsequent formulas. In the SMT solver, each SMT formula is connected together, so if all SMT formulas are true, the SMT solver will only give a set of basic block entries as entries of the program, so that the basic block variable $entry is true. The state constraint formulas of the basic block variables are shown in the formulas in lines 4, 7, and 9 above. The state constraint formulas of the state transfer variables of the basic block are shown in the formulas in lines 3, 6, and 18. The constraint formulas for the phi instruction variables are shown in lines 14, 26, and 29. At the same time, SMT formulas for four operation instructions and comparison instructions are also included.

[0213] Finally, after the converted SMT formula of the source command line is input into the solver, two variables are obtained: correct or incorrect. The correct output is defined as 1, and the incorrect output is defined as 0. After the transmission of information data, it can be regarded as binary encoding. Taking the ASCLL code table as an example, a user-specific decoding system can be established.

[0214] In addition, refer to Figure 4 , briefly summarize the entire data encryption and decryption process of this application:

[0215] The sender writes the source code of the initial data through the sending end, performs lexical analysis and semantic analysis on it through the LLVM component Clang, and converts the analysis results into AST. After optimization, it compiles and generates a platform-independent and language-independent intermediate representation (here refers to the original form of LLVM IR intermediate statement), and sends the LLVM IR intermediate statement that has been statically assigned to SSA FORM (that is, encrypted statement without decompilation attribute) to the target client (receiving end). On the target client, the LLVM IR (encrypted statement) is topologically sorted and statically single-assigned using the control flow and program statement semantics, so that the program is represented as an SMT formula, and then the SMT solver is called for verification (the satisfiability of the SMT formula is used to determine whether the program statement sequence is a statement sequence that can be executed, and the true proposition definition output is 1, and the false proposition definition output is 0). Finally, the SMT solver is used to obtain a custom binary encoding table, and it is compared with the code table to obtain the data to be transmitted (initial data).

[0216] With the development of new technologies such as big data, cloud, and the Internet of Things, more and more information is transmitted through the network, and the information security protection during the transmission process is extremely important. Therefore, the application prospects of this proposal are very broad and have great commercial value. With the rapid development of Internet transmission technology, encryption and decryption technology can be widely used in various industries:

[0217] 1. This proposal can be effectively embedded in various industry applications, making full use of Internet technologies, and on this basis, it can help the development and deeper integration of the company's Internet application industry, and provide Internet companies with a new, safe and effective encryption and decryption method.

[0218] 2. Encryption and decryption technology is not limited to the network, but can also be applied to databases, software, hardware, etc., and can be effectively mixed with existing technologies to provide safer and more effective protection.

[0219] 3. In the context of the Internet industry vigorously developing big data cloud computing, the Internet of Things, etc., this proposal can effectively realize the rational and safe use of data, and assist enterprises in their information security measures by analyzing the calculation results, thereby enhancing their own market competitiveness.

[0220] like Fig.10 As shown, the embodiment of the present application further provides a data encryption device 500, which is applied to a sending end in a terminal device. The data encryption device 500 includes:

[0221] A code analysis module 501 is used to perform lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain analysis results;

[0222] A code optimization module 502, used for converting the analysis result into an abstract syntax tree, wherein the abstract syntax tree is used for optimizing the source code;

[0223] A code compiling module 503 is used to compile the optimized source code into a static single assignment form of LLVM IR encrypted statement;

[0224] The data sending module 504 is used to send the LLVM IR encrypted statement to the receiving end that is communicatively connected to the sending end.

[0225] Optionally, the code analysis module 501 includes:

[0226] The component calling unit is used to call the Clang compiler in the LLVM project framework to perform lexical and semantic analysis on the source code of the initial data to obtain the analysis results.

[0227] Optionally, the code compilation module 503 includes:

[0228] An initial compilation unit, used to call the Clang compiler to compile the code-optimized source code into an original form of LLVM IR intermediate statement;

[0229] The form conversion unit is used to statically assign the original LLVM IR intermediate statement to obtain the LLVM IR encrypted statement in the static single assignment form.

[0230] The form conversion unit is also used to convert the memory variables corresponding to the original form of the LLVM IR intermediate statement into register variables and insert phi nodes at preset positions.

[0231] The form conversion unit is also used to utilize the Opt optimizer of the LLVM project framework to inline the call function in the original form of the LLVM IR intermediate statement into the main function.

[0232] It should be noted that the data encryption device 500 is a device corresponding to the above-mentioned data encryption method applied to the terminal device. All implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.

[0233] like Fig.11 As shown, the embodiment of the present application further provides a data decryption device 600, which is applied to a receiving end in a terminal device. The data decryption device 600 includes:

[0234] The data receiving module 601 is used to receive the LLVM IR encrypted statement sent by the sending end that is communicatively connected to the receiving end;

[0235] A formula conversion module 602, used to convert the LLVM IR encrypted statement into an SMT formula;

[0236] A formula solving module 603, used for inputting the SMT formula into an SMT solver to output a binary coding table;

[0237] The coding comparison module 604 is used to compare the binary coding table with a preset comparison code table to decrypt and obtain initial data.

[0238] Optionally, the formula conversion module 602 is further used for:

[0239] Topologically sorting the LLVM IR encrypted statements using semantic analysis and control flow information of the LLVM IR encrypted statements;

[0240] Convert the LLVM IR encrypted statement into an SMT formula.

[0241] Optionally, the formula conversion module 602 is further used for:

[0242] Expanding the loop of the LLVM IR encrypted statement through semantic analysis and the control flow information of the LLVM IR encrypted statement, and converting the control flow information of the LLVM IR encrypted statement into a directed acyclic graph;

[0243] The directed acyclic graph is solved by using a preset topological sorting rule, and the LLVM IR encrypted statements are topologically sorted.

[0244] Optionally, the formula conversion module 602 is further used for:

[0245] In the process of traversing the LLVM IR encrypted statement for the first time, all non-termination instructions in each basic block of the LLVM IR encrypted statement are read in sequence, and a variable declaration formula is constructed according to the bit length of the instruction variable of the LLVM IR encrypted statement, wherein the variable declaration formula belongs to the SMT-lib2 specification;

[0246] In the process of traversing the LLVM IR encrypted statement for the second time, converting the LLVM IR encrypted statement into a semantically equivalent variable constraint formula through semantic analysis, wherein the variable constraint formula belongs to the SMT-lib2 specification;

[0247] The judgment condition in the input assertion function is inverted and converted into a semantically equivalent assertion formula, which belongs to the SMT-lib2 specification.

[0248] It should be noted that the data decryption device 600 is a device corresponding to the above-mentioned data decryption method applied to the terminal device. All implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.

[0249] Fig.12 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application is shown.

[0250] The terminal device may include a processor 701 and a memory 702 storing computer program instructions.

[0251] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0252] The memory 702 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 702 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 702 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 702 is a non-volatile solid-state memory.

[0253] In certain embodiments, the memory 702 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage media device, an optical storage media device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0254] The processor 701 implements any one of the data encryption methods and data decryption methods in the above embodiments by reading and executing computer program instructions stored in the memory 702 .

[0255] In one example, the terminal device may further include a communication interface 703 and a bus 710. Figure 7As shown, the processor 701, the memory 702, and the communication interface 703 are connected via a bus 710 and communicate with each other.

[0256] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0257] Bus 710 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SMTA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 710 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.

[0258] In addition, in combination with the data encryption and decryption methods in the above embodiments, the embodiments of the present application may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the data encryption methods and data decryption methods in the above embodiments is implemented.

[0259] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0260] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0261] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0262] Aspects of the present disclosure are described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data encryption device to produce a machine so that these instructions executed by the processor of the computer or other programmable data encryption device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0263] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A data encryption method, applied to the sending end, It is characterized in that The method comprises: Based on the LLVM project framework, the source code of the initial data is subjected to lexical and semantic analysis to obtain the analysis results; Convert the analysis result into an abstract syntax tree, wherein the abstract syntax tree is used to optimize the source code; Compile the optimized source code into LLVM IR encrypted statements in static single assignment form; The LLVM IR encrypted statement is sent to a receiving end that is communicatively connected to the sending end.

2. The method according to claim 1, It is characterized in that The lexical and semantic analysis of the source code of the initial data is performed based on the LLVM project framework to obtain the analysis results, including: The Clang compiler in the LLVM project framework is called to perform lexical and semantic analysis on the source code of the initial data to obtain the analysis results.

3. The method according to claim 2, It is characterized in that The step of compiling the optimized source code into a static single assignment form of LLVM IR encrypted statements includes: Calling the Clang compiler to compile the optimized source code into the original LLVM IR intermediate statement; The original LLVM IR intermediate statement is statically assigned to obtain a static single assignment form of LLVM IR encrypted statement.

4. The method according to claim 3, It is characterized in that The static assignment of the original LLVM IR intermediate statement includes: Convert the memory variables corresponding to the original LLVM IR intermediate statements into register variables and insert phi nodes at the preset positions.

5. The method according to claim 3, It is characterized in that The static assignment of the original LLVM IR intermediate statement includes: The Opt optimizer of the LLVM project framework is used to inline the calling function in the original form of the LLVM IR intermediate statement into the main function.

6. A data decryption method, applied to a receiving end, It is characterized in that The method comprises: Receiving an LLVM IR encrypted statement sent by a sending end that is communicatively connected to the receiving end; Convert the LLVM IR encrypted statement into an SMT formula; Input the SMT formula into the SMT solver and output a binary encoding table; The binary code table is compared with a preset comparison code table to decrypt and obtain initial data.

7. The method according to claim 6, It is characterized in that The converting the LLVM IR encrypted statement into an SMT formula comprises: Topologically sorting the LLVM IR encrypted statements using semantic analysis and control flow information of the LLVM IR encrypted statements; Convert the LLVM IR encrypted statement into an SMT formula.

8. The method according to claim 7, It is characterized in that The topological sorting of the LLVM IR encrypted statements by using semantic analysis and control flow information of the LLVM IR encrypted statements comprises: Expanding the loop of the LLVM IR encrypted statement through semantic analysis and the control flow information of the LLVM IR encrypted statement, and converting the control flow information of the LLVM IR encrypted statement into a directed acyclic graph; The directed acyclic graph is solved by using a preset topological sorting rule, and the LLVM IR encrypted statements are topologically sorted.

9. The method according to claim 7, It is characterized in that The step of converting the LLVM IR encrypted statement into an SMT formula comprises: In the process of traversing the LLVM IR encrypted statement for the first time, all non-termination instructions in each basic block of the LLVM IR encrypted statement are read in sequence, and a variable declaration formula is constructed according to the bit length of the instruction variable of the LLVM IR encrypted statement, wherein the variable declaration formula belongs to the SMT-lib2 specification; In the process of traversing the LLVM IR encrypted statement for the second time, converting the LLVM IR encrypted statement into a semantically equivalent variable constraint formula through semantic analysis, wherein the variable constraint formula belongs to the SMT-lib2 specification; The judgment condition in the input assertion function is inverted and converted into a semantically equivalent assertion formula, which belongs to the SMT-lib2 specification.

10. A data encryption device, used at a sending end, It is characterized in that The device comprises: The code analysis module is used to perform lexical and semantic analysis on the source code of the initial data based on the LLVM project framework to obtain the analysis results; A code optimization module, used for converting the analysis result into an abstract syntax tree, wherein the abstract syntax tree is used for optimizing the source code; The code compilation module is used to compile the optimized source code into LLVM IR encrypted statements in the form of static single assignment; A data sending module is used to send the LLVM IR encrypted statement to a receiving end that is communicatively connected to the sending end.

11. A data decryption device, used at a receiving end, It is characterized in that The device comprises: A data receiving module, used for receiving an LLVM IR encrypted statement sent by a sending end that is in communication connection with the receiving end; A formula conversion module, used for converting the LLVM IR encrypted statement into an SMT formula; A formula solving module, used for inputting the SMT formula into an SMT solver to output a binary coding table; The coding comparison module is used to compare the binary coding table with a preset comparison code table to decrypt and obtain initial data.

12. A terminal device, It is characterized in that The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the data encryption method as described in any one of claims 1-5, or implements the data decryption method as described in any one of claims 6-9.

13. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the data encryption method according to any one of claims 1 to 5 is implemented, or the data decryption method according to any one of claims 6 to 9 is implemented.

14. A computer program product, It is characterized in that When the instructions in the computer program product are executed by the processor of the terminal device, the terminal device executes the data encryption method as described in any one of claims 1 to 5, or implements the data decryption method as described in any one of claims 6 to 9.

Citation Information

Cited By

  • Encrypted network traffic classification method based on structured state space dual model

    CN120067803A