Lattice password accelerator construction method, device and equipment and computer readable medium

By extracting the unified operation paradigm of grid cryptographic operators and building a unified hardware architecture, the problem of low computing efficiency of privacy computing grid cryptographic accelerator under different parameters and solutions is solved, and higher computing efficiency and universality is achieved.

CN119070989APending Publication Date: 2024-12-03中科鉴芯(北京)科技有限责任公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411014442.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing privacy computing grid password accelerator has low computing efficiency when facing grid password operations with different parameters and different schemes, which is mainly due to the waste of performance caused by data transfer between operators and the problem of mismatch between computing load and computing resources.

Method used

The target operation paradigm covering all grid password operations is extracted from the preset grid password operator set, and a general unified hardware architecture is built according to this paradigm, including multiplication, addition and modulus operation arrays, and data exchange is realized through a fully connected network. Adjust the operation configuration to meet the needs of different operators.

Benefits of technology

The computing efficiency of the grid cryptographic accelerator is improved, and the mismatch between the computing load and computing power resources caused by operator solidification and a large amount of performance waste caused by data transfer between the computing modules is solved, thus achieving higher versatility and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119070989A_ABST
    Figure CN119070989A_ABST
Patent Text Reader

Abstract

The invention relates to a lattice password accelerator construction method, device and equipment and a computer readable medium. The method comprises the steps that a target operation normal form covering all lattice cryptographic operations is extracted from a preset lattice cryptographic operator set, the preset lattice cryptographic operator set comprises a plurality of lattice cryptographic polynomial operators, and the target operation normal form is used for representing all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; and according to the target operation normal form, constructing a universal unified hardware architecture for each lattice cipher polynomial operator to obtain a target lattice cipher accelerator. According to the method, the unified operation normal form is extracted from the lattice cipher polynomial operator set, and then unified hardware architecture design is carried out on the unified operation normal form, so that a higher lattice cipher acceleration effect is realized; the technical problems of mismatching of operation load and calculation power resources caused by operator solidification and waste of a large amount of performance caused by data transportation between operator modules are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital circuit design technology, and in particular to a method, device, equipment and computer-readable medium for constructing a lattice cryptographic accelerator. Background Art

[0002] The lattice cryptographic algorithms used for privacy computing mainly include three operators: Number Theory Transform (NTT) for polynomial multiplication, fast basis conversion (RNS Basis Conversion, BConv) for large integer decomposition operations, and decomposed polynomial multiplication (DecompPolyMult). Since the operation process of these three operators is complex and has their own unique computing-memory access mode, the existing accelerator design directly solidifies the operators for these three operators, that is, multiple operation modules are formed on the accelerator, and unified or distributed storage modules are matched to perform privacy computing lattice cryptographic operations through space division multiplexing scheduling strategies. Specifically, assuming that there is a BConv-NTT-DecompPolyMult operation flow, the data is first transmitted from the storage module to the BConv operation module, and then transmitted to the NTT operation module after the operation is completed, and then transmitted to the DecompPolyMult operation module. Then it is transmitted back to the storage module. It should be emphasized that in the hardware accelerator, the computing resources of each module are fixed, and the processing power is unchanged.

[0003] However, the existing privacy computing lattice cryptography accelerator architecture will significantly reduce its computing efficiency when faced with lattice cryptographic operations with different parameters and different schemes. The reduction in computing efficiency mainly comes from two aspects: First, data transfer between different operators leads to performance waste: Since the ciphertext and key scale of the privacy computing lattice cryptography algorithm is extremely large, and there is data dependence between operators, transferring data between different operator modules will cause a lot of practical overhead; Second, the computing load of different operators does not match the computing resources: In the lattice cryptography operations of different schemes and different parameters, the computing overhead ratios of the three operators NTT, BConv, and DecompPolyMult are different (specifically, in the privacy computing lattice cryptography scheme TFHE, NTT accounts for more than 80%, DecompPolyMult accounts for 16%, and there is no BConv operation. In another privacy computing lattice cryptography scheme CKKS, when the operation depth is 24, NTT accounts for about 58% of the operation, BConv accounts for about 34%, and DecompPolyMult accounts for about 8%). In this case, using any parameter ratio to configure the resources of the operation module will face the phenomenon of mismatch between computing load and computing resources under other parameters or schemes. However, due to the large size of keys and ciphertexts, and the data dependencies between operators, computing tasks are difficult to pipeline or process in parallel. Ultimately, the mismatch between computing load and computing resources leads to a significant performance drop when the accelerator runs lattice cryptographic operations under different schemes or parameters.

[0004] There is currently no effective solution to the problems of mismatch between computing load and computing resources caused by operator solidification and large performance waste caused by data transfer between operator modules. Summary of the invention

[0005] The present application provides a method, device, equipment and computer-readable medium for constructing a lattice cryptographic accelerator to solve the technical problem of low computing efficiency of existing accelerators.

[0006] According to one aspect of an embodiment of the present application, the present application provides a method for constructing a lattice cryptographic accelerator, comprising: extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes multiple lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; building a general unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

[0007] Optionally, extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set includes: searching for multiplication operations, modulo operations and addition operations in the arithmetic space of the lattice cryptographic polynomial operators, wherein the arithmetic space of each of the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set consists of the multiplication operations, the modulo operations and the addition operations; adjusting the calling order of the multiplication operations, the modulo operations and the addition operations of each of the lattice cryptographic polynomial operators to obtain the target operation paradigm through unified transformation.

[0008] Optionally, the target operation paradigm includes: (multiplication-addition) n-module; wherein n is a dynamic parameter representing the number of multiplication and addition operations in the lattice cryptographic polynomial operator, and the target operation paradigm is used to represent the continuous execution of n multiplication operations and addition operations, and after the execution is completed, a module operation is performed on the generated result.

[0009] Optionally, building a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator includes: building corresponding multiplication arrays, addition arrays and modulo arrays according to the calling order of multiplication operations, addition operations and modulo operations in the target operation paradigm to obtain an operation core; connecting the operation core to a local cache to obtain an operation unit; placing multiple parallel operation units on a chip so that the local caches of different operation units receive the lattice cryptographic polynomials with different coefficients, so that the operation core accelerates the calculation of the lattice cryptographic polynomial according to the target operation paradigm; and constructing a fully connected network between all the operation units to obtain the target lattice cryptographic accelerator, so that the operation units in the target lattice cryptographic accelerator perform fully connected data exchange through the fully connected network.

[0010] Optionally, the method further includes: determining an operation array combination equivalent to the modulo array, wherein the operation array combination includes a multiplication array, an addition array, and a shift array; and using the operation array combination to replace the modulo array in the operation core.

[0011] Optionally, the method further includes: upon receiving a lattice cryptographic polynomial to be calculated, allocating coefficients of the lattice cryptographic polynomial to the local cache of the operation unit according to an item index, wherein the range of the item index corresponding to different local caches is different, and the item index is used to indicate the order of each item in the lattice cryptographic polynomial; determining the number of executions of multiplication and addition operations in the target operation paradigm, denoted as n; performing multiplication and addition operations respectively from the first moment to the nth moment, and accumulating the calculation results to obtain a first accumulated result; and The modulo operation is entered at the nth moment, wherein the modulo operation includes: shifting the first accumulated result at the nth moment to obtain a first shift result, and storing the first shift result; performing a multiplication operation on the first shift result at the n+1th moment, and then shifting the operation result to obtain a second shift result; performing a multiplication operation on the second shift result at the n+2th moment, and then adding the operation result to the stored first shift result to obtain a modulo result, and storing the modulo result as an output as a calculation result of the lattice cipher polynomial.

[0012] Optionally, the method further includes: constructing a transposed matrix; connecting each of the operation units in the target lattice cryptographic accelerator to the transposed matrix to convert the fully connected data exchange into a matrix exchange.

[0013] According to another aspect of an embodiment of the present application, the present application provides a lattice cryptographic accelerator construction device, including: an operation paradigm extraction module, used to extract a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes multiple lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; a hardware architecture construction module, used to build a general unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

[0014] According to another aspect of an embodiment of the present application, the present application provides an electronic device, including a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, the memory and the processor communicate through the communication bus and the communication interface, and the steps of the above method are implemented when the processor executes the computer program.

[0015] According to another aspect of an embodiment of the present application, the present application also provides a computer-readable medium having a non-volatile program code executable by a processor, and the program code enables the processor to execute the above method.

[0016] The above technical solution provided by the embodiment of the present application has the following advantages compared with the related art:

[0017] The present application provides a method for constructing a lattice cryptographic accelerator, including: extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes multiple lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; building a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator. The present application achieves a higher lattice cryptographic acceleration effect by extracting a unified operation paradigm from a lattice cryptographic polynomial operator set, and then designs a unified hardware architecture for the unified operation paradigm, thereby solving the technical problems of the mismatch between the operation load and computing power resources caused by operator solidification and the large amount of performance waste caused by data transfer between operator modules. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0020] Figure 1 A schematic flow chart of an optional lattice cryptographic accelerator construction method provided according to an embodiment of the present application;

[0021] Figure 2 An optional unified operation paradigm extraction schematic diagram provided according to an embodiment of the present application;

[0022] Figure 3 A schematic diagram of an optional unified hardware architecture provided according to an embodiment of the present application;

[0023] Figure 4 A schematic diagram of an optional computing core design and time-division multiplexing strategy provided according to an embodiment of the present application;

[0024] Figure 5 A schematic diagram of an optional data exchange method replacement provided according to an embodiment of the present application;

[0025] Figure 6 A block diagram of an optional lattice cryptographic accelerator construction device provided according to an embodiment of the present application;

[0026] Figure 7A schematic diagram of an optional electronic device structure provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0028] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.

[0029] In order to solve the problem mentioned in the background technology, according to one aspect of the embodiments of the present application, an embodiment of a method is provided, such as Figure 1 As shown, the method may include the following steps:

[0030] Step S102, extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes a plurality of lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set;

[0031] Step S104, building a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

[0032] The inventors of this application discovered during the research process that the fundamental reason for the poor versatility and insufficient performance of the existing lattice cryptography accelerator architecture is that a variety of high-level operators are directly solidified into different hardware modules. This architectural design leads to the mismatch between computing load and hardware computing power and numerous data communication problems between hardware modules, which ultimately reduces the performance of the accelerator and its versatility for different schemes. In this regard, the inventors proposed the idea of ​​extracting a unified computing paradigm for all key operators from the bottom layer of the lattice cryptography algorithm, and designing a unified hardware architecture based on this unified computing paradigm, aiming to solve the existing accelerators when facing lattice cryptography operations with different parameters and schemes. The computing load and computing power resources are mismatched due to operator solidification, and a large amount of performance waste caused by data transfer between operator modules is explained below.

[0033] In the embodiment of the present application, the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set include NTT, BConv, and DecompPolyMult operators, and their arithmetic spaces are all composed of multiplication, modulo, and addition.

[0034] In the embodiment of the present application, the target operation paradigm refers to the common calculation mode or rule extracted from all key operators (such as NTT, BConv, DecompPolyMult, etc.). This paradigm can cover the core operation steps of all operators, so that different operators are consistent at the operation level.

[0035] In the embodiment of the present application, the hardware architecture designed based on the unified computing paradigm no longer designs independent hardware modules for specific operators, but uses a common hardware module to perform different operator operations. The unified hardware architecture can dynamically adjust its configuration to execute different operators according to the current computing requirements.

[0036] Through steps S102 to S104, the present application achieves a higher lattice cryptography acceleration effect by extracting a unified operation paradigm from the lattice cryptography polynomial operator set, and then designs a unified hardware architecture for the unified operation paradigm, thereby solving the technical problems of the mismatch between the computing load and computing power resources caused by operator solidification and the large amount of performance waste caused by data transfer between operator modules.

[0037] In an optional embodiment, extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set includes:

[0038] Step 1, searching for multiplication operations, modulo operations, and addition operations in the arithmetic space of the lattice cryptographic polynomial operator, wherein the arithmetic space of each of the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set consists of the multiplication operations, the modulo operations, and the addition operations;

[0039] Step 2, adjusting the calling order of the multiplication operation, the modulus operation and the addition operation of each of the lattice cipher polynomial operators to obtain the target operation paradigm through unified transformation.

[0040] In the present application embodiment, Figure 2As shown, the operation space of lattice cryptographic polynomial operators, such as NTT (Number Theoretic Transform), BConv (Batch Convolution), DecompPolyMult (Polynomial Multiplication Decomposition), etc., is composed of multiplication, modulo, and addition. The only difference is that the calling order of these operations in their respective operation processes is different. In view of this, the present application searches the arithmetic space, and by adjusting and transforming the calling order of multiplication, addition, and modulo operations in the lattice cryptographic polynomial operators, the unified operation paradigm of "(multiplication-addition) n-modulo" can be obtained. This operation paradigm can represent all lattice cryptographic operation operators such as NTT, BConv, and DecompPolyMult.

[0041] In an optional embodiment, if Figure 2 As shown, the target operation paradigm includes:

[0042] (Multiply-Add) n-module;

[0043] Among them, n is a dynamic parameter, which represents the number of multiplication and addition operations in the lattice cipher polynomial operator, and the target operation paradigm is used to represent the continuous execution of n multiplication operations and addition operations, and the modulo operation is performed on the generated results after the execution is completed.

[0044] In the embodiment of the present application, the dynamic parameter n is dynamically adjusted according to actual calculations and computing power.

[0045] In an optional embodiment, building a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator includes:

[0046] Step 1, according to the calling order of multiplication operation, addition operation and modulus operation in the target operation paradigm, build the corresponding multiplication array, addition array and modulus array to obtain the operation core;

[0047] Step 2, connecting the computing core to the local cache to obtain a computing unit;

[0048] Step 3, placing a plurality of parallel computing units on a chip, so that the local caches of different computing units receive the lattice cryptographic polynomials with different coefficients, and the computing core accelerates the calculation of the lattice cryptographic polynomial according to the target computing paradigm;

[0049] Step 4: construct a fully connected network between all the operation units to obtain the target lattice cryptographic accelerator, so that the operation units in the target lattice cryptographic accelerator perform fully connected data exchange through the fully connected network.

[0050] In an embodiment of the present application, a general unified hardware architecture construction method for lattice cryptographic polynomial operators (such as NTT, BConv, DecompPolyMult, etc.) is provided, and the final result is a target lattice cryptographic accelerator. The target lattice cryptographic accelerator is built according to the target operation paradigm of "(multiplication-addition) n-module", including key components such as multiplication array, addition array, modulus array, local cache and fully connected network. Among them, the multiplication array is a hardware component specifically used to perform multiplication operations. The addition array is a hardware component specifically used to perform addition operations. The modulus array is a hardware component specifically used to perform modulus operations. The local cache is connected to the operation core for storing and transmitting data to reduce data access latency. The fully connected network allows the operation units in the accelerator to perform efficient data exchange and communication.

[0051] Unified hardware architecture such as Figure 3 As shown, in an embodiment of the present application, the present application designs corresponding multiplication arrays, addition arrays and modulo arrays according to the calling order of multiplication, addition and modulo operations in the "(multiply-add) n-modulo" target operation paradigm, and connects these arrays in the order of the target operation paradigm to form a complete operation core. The operation core is connected to the local cache. The local cache is used to store data related to the current operation unit to reduce the number of times data is read from the main memory. Multiple parallel operation units, such as 128, are placed on the chip. Each operation unit includes an operation core and a local cache. Through different local caches, each operation unit can receive and process different lattice cryptographic polynomials. A fully connected network is constructed between all operation units. This network allows data exchange between any two operation units, and data exchange can be achieved through message passing, direct memory access (DMA) or other efficient data transmission mechanisms.

[0052] This application builds a hardware architecture according to a unified target operation paradigm, which allows the accelerator to support a variety of different lattice cryptographic polynomial operators without having to design independent hardware for each operator. Placing multiple computing units in parallel can process multiple lattice cryptographic polynomials in parallel, improving overall computing efficiency. Using local cache can reduce the latency of computing units when accessing external memory and increase computing speed. Through a fully connected network, computing units in the accelerator can quickly exchange data and support data dependencies in complex lattice cryptographic algorithms.

[0053] In an optional embodiment, the method further includes:

[0054] Step 1, determining a calculation array combination equivalent to the modulo array, wherein the calculation array combination includes a multiplication array, an addition array, and a shift array;

[0055] Step 2: Use the operation array combination to replace the modulo array in the operation core.

[0056] In an embodiment of the present application, the modulo operation can be implemented using the Barrett reduction algorithm. Since the Barrett reduction algorithm contains two multiplications, two additions and a shift operation, the present application proposes a fine-grained decomposition of the modulo operation, and decomposes the modulo operation (Barrett reduction algorithm) into multiplication, addition, and shift in the operation core, and finally uses basic multiplication, addition, and shift arrays to implement the operation module.

[0057] The inventor discovered during the research that when designing hardware based on the unified operation paradigm of "(multiplication-accumulation) n-modulo", since n is a dynamic parameter, directly implementing a modulo unit behind the multiplication-accumulation unit will result in a phenomenon in which Barrett modulo is only run once after n consecutive beats, resulting in low utilization of the modulo unit. Since n is dynamically adjusted, it is difficult to optimize this problem by expansion and other methods. In this regard, a method is proposed to further decompose the modulo unit into a combination of multiplication, addition, and shift operations. The hardware operation module only needs to retain the multiplication, addition, and shift arrays.

[0058] In the embodiment of the present application, the calculation task that originally required the entire modulus unit to complete can now be completed by calling the corresponding multiplication, addition and shift arrays. Since these arrays are basic and universal, the flexibility and efficiency of the calculation module can be significantly improved.

[0059] In an optional embodiment, the method further includes:

[0060] Step 1, when receiving a lattice cryptographic polynomial to be calculated, allocating coefficients of the lattice cryptographic polynomial to the local cache of the operation unit according to the item index, wherein the range of the item index corresponding to different local caches is different, and the item index is used to indicate the order of each item in the lattice cryptographic polynomial;

[0061] Step 2, determining the number of executions of multiplication and addition operations in the target operation paradigm, recorded as n;

[0062] Step 3, performing multiplication operations and addition operations respectively from the first moment to the nth moment, and accumulating the calculation results to obtain a first accumulation result;

[0063] Step 4, entering the modulo operation at the nth time, wherein the modulo operation includes: shifting the first accumulated result at the nth time to obtain a first shift result, and storing the first shift result; performing a multiplication operation on the first shift result at the n+1th time, and then shifting the operation result to obtain a second shift result; performing a multiplication operation on the second shift result at the n+2th time, and then adding the operation result to the stored first shift result to obtain a modulo result, and storing the modulo result as an output as the calculation result of the lattice cipher polynomial.

[0064] During the research, the inventors found that different memory access modes would be generated when using a unified computing paradigm to implement different operations. Therefore, in order to efficiently manage data and reduce redundant data storage, distributed data management is adopted. All data is divided according to a unified coefficient and allocated to different parallel computing cores. Specifically, all lattice cryptographic polynomials (including different groups and different channels) can be uniformly allocated to the local buffers of all 128 computing units according to the item index. The entire allocation scheme is as follows: Figure 4 As shown in part (a) of FIG. 1 , the term index refers to the order of each term in the polynomial in the lattice cipher polynomial, where the term index of the first term is 0, the term index of the second term is 1, and so on.

[0065] In the embodiment of the present application, when receiving the lattice cipher polynomial to be calculated, the system first distributes the coefficients to the local cache of each operation unit according to the term index of the polynomial (i.e., the order of each term in the polynomial). Different local caches correspond to different ranges of term indexes, ensuring that coefficients with the same term index are distributed to the same local cache. Figure 4 As shown in part (a), coefficients 0-127 of all polynomials are allocated to Buffer 0 (the local cache in the first operation unit), coefficients 128-255 are allocated to local Buffer 1 (the local cache in the second operation unit), and so on, until all coefficients are allocated to the corresponding local caches.

[0066] In the embodiment of the present application, in order to efficiently support the unified operation paradigm of "(multiply-add) n-mode", the present application is based on Figure 4 The operation core design shown in part (b) adopts Figure 4 The time-division multiplexing scheduling strategy shown in part (c) can efficiently implement the operation paradigm "(multiplication-addition) n-module" with arbitrary parameter n, and ultimately support all operations of lattice cipher.

[0067] In the embodiment of the present application, the time division multiplexing scheduling strategy is a method for sharing limited resources between multiple tasks or signals. The basic principle is to divide time into several time slots, each of which is allocated to different tasks or signals. In the present application, specifically, the number of executions of multiplication and addition operations in the target operation paradigm is first determined, recorded as n, and then the time slot division is performed, such as Figure 4 As shown in part (c), from the first moment to the nth moment, the system performs multiplication and addition operations in the order of operation, and accumulates the results of each operation to obtain the first accumulated result. At the nth moment, the system enters the modulo operation stage. This process includes three main steps: at the nth moment, the first accumulated result is shifted to obtain the first shift result, and the result is stored. At the n+1th moment, the first shift result is multiplied, and the operation result is shifted again to obtain the second shift result. At the n+2th moment, the second shift result is added to the previously stored first shift result to obtain the final modulo result. The modulo result will be stored and output as the calculation result of the lattice cipher polynomial. Through time-division multiplexing scheduling, it is possible to support all different operations while maintaining high hardware utilization.

[0068] In the embodiment of the present application, by allocating coefficients of the same item index to the same local cache, the locality of data access can be greatly improved, cache misses can be reduced, and thus the operation efficiency can be improved. Through the design of the operation core with fine-grained modular operation splitting and the time-division multiplexing scheduling strategy, the target lattice cryptography accelerator designed in the present application can efficiently implement the operation paradigm "(multiplication-addition) n-module" with arbitrary parameters n, and ultimately support all operations of lattice cryptography.

[0069] In an optional embodiment, the method further includes:

[0070] Step 1, construct a transposed matrix;

[0071] Step 2: Connect each of the operation units in the target lattice cryptographic accelerator to the transposed matrix to convert the fully connected data exchange into a matrix exchange.

[0072] During the research, the inventors also found that when the degree of parallelism is high, the complexity of the on-chip interconnect network for inter-core communication is too high, resulting in large hardware area and low performance, and the fully connected data exchange method may cause data to move frequently between computing units, thereby increasing computing delays and power consumption. In response to this, the present application further proposes to decompose the complete operation into multiple sub-operations based on the two-dimensional decomposition of the algorithm, so that the fully connected data exchange relationship in the lattice cryptographic operation is replaced by a fixed transposed exchange between sub-operations. Finally, the accelerator's fully connected on-chip network is replaced with a transposed array, which greatly reduces the hardware complexity. Save area and improve performance.

[0073] The core idea of ​​the two-dimensional decomposition of the algorithm is to decompose the originally complex fully connected data exchange relationship into multiple sub-operations through algorithm-level optimization, and establish a fixed transposition exchange relationship between the sub-operations. In this way, the data that originally needed to be frequently exchanged between all operation units now only needs to be exchanged within a fixed set of sub-operations, thereby greatly reducing the complexity of data exchange.

[0074] The transpose array is a hardware structure used to implement efficient transposition exchange between sub-operations. The transpose array can quickly transfer the output result of one sub-operation to the input of another sub-operation while completing the data transposition operation.

[0075] like Figure 5 As shown in the figure, by replacing the fully connected on-chip network of the accelerator with a transposed array, the hardware complexity can be significantly reduced. The fully connected on-chip network needs to support data exchange between any two computing units, so its design complexity is high and the hardware area is large. The transposed array only needs to process fixed-mode transposed exchanges, so its design can be simpler and the hardware area is smaller.

[0076] In an embodiment of the present application, data and operation units can be organized into a matrix form. Each operation unit can be regarded as an element of a matrix, and the data is distributed in the matrix. By transposing the matrix, the original fully connected data exchange can be converted into a matrix exchange. Since the transposed array can efficiently handle the transposed exchange between sub-operations, the performance of the lattice cryptographic operation can be significantly improved. Compared with a fully connected on-chip network, the transposed array can reduce the delay of data exchange, increase the bandwidth of data transmission, and thus speed up the operation.

[0077] The present application provides a method for constructing a lattice cryptographic accelerator, including: extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes multiple lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; building a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator. The present application achieves a higher lattice cryptographic acceleration effect by extracting a unified operation paradigm from a lattice cryptographic polynomial operator set, and then designs a unified hardware architecture for the unified operation paradigm, thereby solving the technical problems of the mismatch between the operation load and computing power resources caused by operator solidification and the large amount of performance waste caused by data transfer between operator modules.

[0078] According to another aspect of the embodiment of the present application, Figure 6 As shown, a lattice cryptographic accelerator construction device is provided, comprising:

[0079] An operation paradigm extraction module 601 is used to extract a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes a plurality of lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set;

[0080] The hardware architecture building module 603 is used to build a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

[0081] It should be noted that the operation paradigm extraction module 601 in this embodiment can be used to execute step S102 in the embodiment of the present application, and the hardware architecture construction module 603 in this embodiment can be used to execute step S104 in the embodiment of the present application.

[0082] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be implemented by software or hardware.

[0083] Optionally, the operation paradigm extraction module is specifically used to: search for multiplication operations, modulo operations and addition operations in the arithmetic space of the lattice cryptographic polynomial operator, wherein the arithmetic space of each of the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set is composed of the multiplication operations, the modulo operations and the addition operations; adjust the calling order of the multiplication operations, the modulo operations and the addition operations of each of the lattice cryptographic polynomial operators to obtain the target operation paradigm through unified transformation.

[0084] Optionally, the target operation paradigm includes: (multiplication-addition) n-module; wherein n is a dynamic parameter representing the number of multiplication and addition operations in the lattice cryptographic polynomial operator, and the target operation paradigm is used to represent the continuous execution of n multiplication operations and addition operations, and after the execution is completed, a module operation is performed on the generated result.

[0085] Optionally, the hardware architecture building module is specifically used to: build corresponding multiplication arrays, addition arrays and modulo arrays according to the calling order of multiplication operations, addition operations and modulo operations in the target operation paradigm to obtain an operation core; connect the operation core to a local cache to obtain an operation unit; place multiple parallel operation units on a chip so that the local caches of different operation units receive lattice cryptographic polynomials with different coefficients, so that the operation core accelerates the calculation of the lattice cryptographic polynomial according to the target operation paradigm; construct a fully connected network between all the operation units to obtain the target lattice cryptographic accelerator, so that the operation units in the target lattice cryptographic accelerator perform fully connected data exchange through the fully connected network.

[0086] Optionally, the hardware architecture building module is also used to: determine an operation array combination equivalent to the modulo array, wherein the operation array combination includes a multiplication array, an addition array and a shift array; and use the operation array combination to replace the modulo array in the operation core.

[0087] Optionally, the lattice cryptographic accelerator construction device also includes a calculation module, which is specifically used to: when receiving a lattice cryptographic polynomial to be calculated, distribute the coefficients of the lattice cryptographic polynomial to the local cache of the operation unit according to the item index, wherein the range of the item index corresponding to different local caches is different, and the item index is used to indicate the order of each item in the lattice cryptographic polynomial; determine the number of executions of multiplication and addition operations in the target operation paradigm, denoted as n; perform multiplication and addition operations respectively from the first moment to the nth moment, and accumulate the calculation results to obtain a first accumulation result; and entering a modulo operation at the nth time, wherein the modulo operation includes: shifting the first accumulation result at the nth time to obtain a first shift result, and storing the first shift result; performing a multiplication operation on the first shift result at the n+1th time, and then shifting the operation result to obtain a second shift result; performing a multiplication operation on the second shift result at the n+2th time, and then adding the operation result to the stored first shift result to obtain a modulo result, and storing the modulo result as an output as a calculation result of the lattice cipher polynomial.

[0088] Optionally, the hardware architecture building module is further used to: construct a transposed matrix; connect each of the computing units in the target lattice cryptographic accelerator to the transposed matrix to convert the fully connected data exchange into a matrix exchange.

[0089] According to another aspect of the embodiments of the present application, the present application provides an electronic device, such as Figure 7As shown, it includes a memory 701, a processor 703, a communication interface 705 and a communication bus 707. The memory 701 stores a computer program that can be run on the processor 703. The memory 701 and the processor 703 communicate through the communication interface 705 and the communication bus 707. When the processor 703 executes the computer program, the steps of the above method are implemented.

[0090] The memory and processor in the above electronic device communicate via a communication bus and a communication interface. The communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc.

[0091] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0092] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0093] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any of the above embodiments.

[0094] Optionally, in an embodiment of the present application, the computer-readable medium is configured to store program codes for the processor to perform the following steps:

[0095] Extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes a plurality of lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set;

[0096] A universal unified hardware architecture for each of the lattice cryptographic polynomial operators is constructed according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

[0097] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0098] When the embodiments of the present application are specifically implemented, reference may be made to the above-mentioned embodiments, which have corresponding technical effects.

[0099] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.

[0100] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0101] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0102] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0103] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0104] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0105] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0106] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk. It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0107] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A method for constructing a lattice cryptographic accelerator, characterized in that: include: Extracting a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes a plurality of lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; A universal unified hardware architecture for each of the lattice cryptographic polynomial operators is constructed according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

2. The method according to claim 1, characterized in that The target operation paradigm that covers all lattice cryptographic operations is extracted from the preset lattice cryptographic operator set includes: Searching for a multiplication operation, a modulo operation, and an addition operation in the arithmetic space of the lattice cryptographic polynomial operator, wherein the arithmetic space of each of the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set consists of the multiplication operation, the modulo operation, and the addition operation; The calling order of the multiplication operation, the modulus operation and the addition operation of each of the lattice cipher polynomial operators is adjusted to obtain the target operation paradigm through uniform transformation.

3. The method according to any one of claims 1 or 2, characterized in that: The target operation paradigms include: (Multiply-Add) n-module; Among them, n is a dynamic parameter, which represents the number of multiplication and addition operations in the lattice cipher polynomial operator, and the target operation paradigm is used to represent the continuous execution of n multiplication operations and addition operations, and the modulo operation is performed on the generated results after the execution is completed.

4. The method according to claim 1, characterized in that: The process of building a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target computing paradigm to obtain a target lattice cryptographic accelerator includes: According to the calling order of multiplication operation, addition operation and modulo operation in the target operation paradigm, corresponding multiplication array, addition array and modulo array are constructed to obtain the operation core; Connecting the operation core to the local cache to obtain an operation unit; Placing a plurality of parallel computing units on a chip so that the local caches of different computing units receive the lattice cryptographic polynomials with different coefficients, and the computing core accelerates the calculation of the lattice cryptographic polynomial according to the target computing paradigm; A fully connected network is constructed between all the operation units to obtain the target lattice cryptographic accelerator, so that the operation units in the target lattice cryptographic accelerator perform fully connected data exchange through the fully connected network.

5. The method according to claim 4, characterized in that The method further comprises: Determine a calculation array combination equivalent to the modulo array, wherein the calculation array combination includes a multiplication array, an addition array, and a shift array; The modulo array in the operation core is replaced by the operation array combination.

6. The method according to claim 5, characterized in that The method further comprises: When receiving a lattice cryptographic polynomial to be calculated, allocating coefficients of the lattice cryptographic polynomial to the local cache of the operation unit according to an item index, wherein the range of the item index corresponding to different local caches is different, and the item index is used to indicate the order of each item in the lattice cryptographic polynomial; Determine the number of times multiplication and addition operations are performed in the target operation paradigm, recorded as n; Performing multiplication operations and addition operations respectively from the first moment to the nth moment, and accumulating the calculation results to obtain a first accumulation result; Entering the modulo operation at the nth moment, wherein the modulo operation includes: shifting the first accumulated result at the nth moment to obtain a first shift result, and storing the first shift result; performing a multiplication operation on the first shift result at the n+1th moment, and then shifting the operation result to obtain a second shift result; performing a multiplication operation on the second shift result at the n+2th moment, and then adding the operation result to the stored first shift result to obtain a modulo result, and storing the modulo result as an output as a calculation result of the lattice cipher polynomial.

7. The method according to claim 4, characterized in that The method further comprises: Construct the transposed matrix; Each of the operation units in the target lattice cryptographic accelerator is connected to the transposed matrix to convert the fully connected data exchange into a matrix exchange.

8. A lattice cryptographic accelerator construction device, characterized in that: include: An operation paradigm extraction module, used to extract a target operation paradigm covering all lattice cryptographic operations from a preset lattice cryptographic operator set, wherein the preset lattice cryptographic operator set includes a plurality of lattice cryptographic polynomial operators, and the target operation paradigm is used to represent all the lattice cryptographic polynomial operators in the preset lattice cryptographic operator set; The hardware architecture building module is used to build a universal unified hardware architecture for each of the lattice cryptographic polynomial operators according to the target operation paradigm to obtain a target lattice cryptographic accelerator.

9. An electronic device, comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, and the memory and the processor communicate through the communication bus and the communication interface, characterized in that: When the processor executes the computer program, the lattice cryptographic accelerator construction method described in any one of claims 1 to 7 is implemented.

10. A computer readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the lattice cryptographic accelerator construction method described in any one of claims 1 to 7.