Relay protection security chip password service module and its hash algorithm unit
By designing a hash algorithm unit for synchronous operation in the relay protection security chip, and using encryption and decryption calculation circuits to process encryption and decryption data respectively, the problem of low efficiency in traditional technology is solved and efficient hash value calculation is achieved.
Patent Information
- Application Number
- CN202111240571.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-25
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-10-25
AI Technical Summary
The traditional relay protection security chip password service module and its hash algorithm unit have low operating efficiency when calculating encryption hash values and decryption hash values at the same time, because only encryption or decryption hash values can be performed at the same time. Operation.
A relay protection security chip cryptographic module is designed. Its hash algorithm unit realizes the synchronous operation of encryption hash value and decryption hash value by configuring different data transmission paths and calculation circuits, including encryption calculation circuit and decryption calculation circuit. , used to process the data to be encrypted and the data to be decrypted respectively, improving the overall operating efficiency.
By separately configuring the encryption and decryption calculation circuits, the synchronous calculation of the encryption hash value and the decryption hash value is realized, which improves the calculation efficiency of the relay protection security chip and improves the overall performance of the system.
Smart Images

Figure CN113961979B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of relay protection, and in particular to a cryptographic service module for a relay protection security chip and its hash algorithm unit. Background Art
[0002] Relay protection devices are commonly used components in power systems. Their operational status directly affects the entire power system, bearing the crucial mission of protecting its safe and stable operation. Relay protection devices typically incorporate safety chips to ensure their safety.
[0003] Traditional relay protection safety chip cryptographic service modules and their hash algorithm units are configured to perform encryption and decryption hash value calculations. When it is necessary to calculate the encryption hash value and the decryption hash value of the data to be encrypted and decrypted simultaneously, they are processed sequentially according to the timing of the calculation requests. That is, traditional relay protection safety chip cryptographic service modules and their hash algorithm units can only perform encryption or decryption hash value calculations at a time, resulting in low operating efficiency. Summary of the Invention
[0004] Therefore, it is necessary to provide a high-efficiency relay protection security chip cryptographic service module and its hash algorithm unit to address the above-mentioned technical problems.
[0005] A hash algorithm unit in the cryptographic module of a relay protection security chip includes a first interface, a first register, a first controller, an encryption calculation circuit, a decryption calculation circuit, a memory, and a second interface;
[0006] The first register is connected to the first interface, the first controller, and the encryption calculation circuit; the encryption calculation circuit is connected to the first controller and the memory; the decryption calculation circuit is connected to the first controller and the memory; the memory is also connected to the second interface; the first interface and the second interface are used to connect encryption and decryption algorithm units;
[0007] The first register is used to obtain hash value calculation parameters through the first interface;
[0008] The first controller is used to extract the hash value calculation parameters from the first register, and according to the hash value calculation parameters, control the encryption calculation circuit to perform hash value calculation on the data to be encrypted, obtain the encrypted hash value and write it into the memory, or control the decryption calculation circuit to perform hash value calculation on the data to be decrypted, obtain the decrypted hash value and write it into the memory; the data to be encrypted reaches the encryption calculation circuit sequentially through the first interface and the first register; the data to be decrypted reaches the decryption calculation circuit sequentially through the second interface and the memory.
[0009] In one embodiment, the encrypted computing circuit includes a multiplication circuit, a shift register, and a result register, wherein the shift register is connected to the multiplication circuit and the result register; the multiplication circuit is connected to the first controller and the first register; and the result register is connected to the memory.
[0010] A cryptographic module for a relay protection security chip includes an encryption / decryption algorithm unit, a true random number generation unit, and a hash algorithm unit as described above. The encryption / decryption algorithm unit is connected to the relay protection security chip, the true random number generation unit, and the hash algorithm unit.
[0011] In one embodiment, the encryption / decryption algorithm unit includes a symmetric algorithm component and an asymmetric algorithm component; the symmetric algorithm component is connected to the relay protection security chip, the true random number generation unit, and the hash algorithm unit; the asymmetric algorithm component is connected to the relay protection security chip, the true random number generation unit, and the hash algorithm unit.
[0012] In one embodiment, the symmetric algorithm component includes a bus interface, a second register, a second controller, and a symmetric algorithm operation circuit; the bus interface is used to connect the relay protection safety chip, the true random number generation unit, the hash algorithm unit, the second register, and the symmetric algorithm operation circuit; the second controller is used to connect the second register and the symmetric algorithm operation circuit.
[0013] In one embodiment, the asymmetric algorithm component includes a register interface, and an AHB (Advanced High Performance Bus) Slave interface, a main operation circuit, a basic operation circuit, a data path circuit, and an SRAM (Static Random-Access Memory) interface connected to the register interface; the main operation circuit is connected to the basic operation circuit and the data path circuit; the basic operation circuit and the data path circuit are connected, and the data path circuit is connected to the SRAM interface;
[0014] The AHB Slave interface is used to connect the hash algorithm unit and the true random number generation unit, and the SRAM interface is used to connect the relay protection safety chip.
[0015] In one embodiment, the asymmetric algorithm component includes an elliptic curve algorithm component; the elliptic curve algorithm component is connected to the relay protection safety chip, the true random number generation unit, and the hash algorithm unit.
[0016] In one embodiment, the elliptic curve algorithm component includes a multiplication circuit and a processor; the multiplication circuit is connected to the true random number generation unit, the hash algorithm unit, and the processor; the processor is connected to the relay protection safety chip.
[0017] The processor is used to acquire user configuration information and data to be encrypted sent by the relay protection safety chip, determine the initial coordinates of the elliptic function, the public key and encryption parameters according to the user configuration information, and send the initial coordinates of the elliptic function, the public key, the encryption parameters and the data to be encrypted to the multiplication circuit;
[0018] The multiplication circuit is used to receive the true random number generated by the true random number generation unit, and based on the true random number, the initial coordinates of the elliptic function, the public key, the encryption parameters and the data to be encrypted, to obtain the first multiplier and the second multiplier and send them to the processor, and to obtain the hash value calculation parameters and send them to the hash algorithm unit.
[0019] The processor is also configured to receive a cryptographic hash value, and combine the cryptographic hash value, the first multiplier, and the second multiplier to generate ciphertext data and output it.
[0020] In one embodiment, the true random number generation unit includes an energy conversion circuit, an amplification circuit, and an analog-to-digital conversion circuit: the amplification circuit is connected to the energy conversion circuit and the analog-to-digital conversion circuit; the analog-to-digital conversion circuit is connected to the encryption / decryption algorithm unit.
[0021] In one embodiment, the true random number generation unit further includes a detection circuit connected to the analog-to-digital conversion circuit and the encryption / decryption algorithm unit.
[0022] The aforementioned relay protection safety chip cryptographic service module and its hash algorithm unit are configured with a first interface to obtain data to be encrypted, a second interface to obtain data to be decrypted, and an encryption calculation circuit for calculating the encryption hash value and a decryption calculation circuit for calculating the decryption hash value. That is, different data transmission paths and calculation circuits are configured for the calculation of the encryption hash value and the decryption hash value, respectively, which can realize the synchronous operation of the encryption hash value and the decryption hash value, and is conducive to improving the overall operating efficiency. Attached Figure Description
[0023] Figure 1 This is a block diagram of the composition of a hash algorithm unit in one embodiment;
[0024] Figure 2 This is a block diagram of the encryption computing circuit in one embodiment;
[0025] Figure 3This is a block diagram of the cryptographic module of a relay protection security chip in one embodiment;
[0026] Figure 4 This is a block diagram of the components of a symmetric algorithm in one embodiment;
[0027] Figure 5 This is a control principle diagram of a symmetric algorithm component in one embodiment;
[0028] Figure 6 This is a control principle diagram of an asymmetric algorithm component in one embodiment;
[0029] Figure 7 This is a block diagram of the elliptic curve algorithm component in one embodiment;
[0030] Figure 8 This is a block diagram of the true random number generation unit in one embodiment. Detailed Implementation
[0031] To facilitate understanding of this application, a more complete description will be provided below with reference to the accompanying drawings, which illustrate embodiments of the present application. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of this application will be thorough and complete.
[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
[0033] It should be noted that when one element is considered to be "connected" to another element, it can be directly connected to the other element or connected to the other element through an intermediary element. Furthermore, in the following embodiments, "connection" should be understood as "electrical connection," "communication connection," etc., if there is transmission of electrical signals or data between the connected objects.
[0034] When used herein, the singular forms of “a,” “an,” and “the” may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising,” “including,” or “having,” etc., specify the presence of the stated feature, whole, step, operation, component, part, or combination thereof, but do not preclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof.
[0035] In the first aspect of this application, such as Figure 1As shown, a hash algorithm unit in the cryptographic module of a relay protection safety chip is provided, including a first interface 110, a first register 120, a first controller 130, an encryption calculation circuit 140, a decryption calculation circuit 150, a memory 160, and a second interface 170. The first register 120 is connected to the first interface 110, the first controller 130, and the encryption calculation circuit 140; the encryption calculation circuit 140 is connected to the first controller 130 and the memory 160; the decryption calculation circuit 150 is connected to the first controller 130 and the memory 160; the memory 160 is also connected to the second interface 170; the first interface 110 and the second interface 170 are used to connect the encryption and decryption algorithm units. The first register 120 is used to obtain hash value calculation parameters through the first interface 110. The first controller 130 is used to extract the hash value calculation parameters in the first register, and according to the hash value calculation parameters, control the encryption calculation circuit 140 to perform hash value calculation on the data to be encrypted, obtain the encrypted hash value and write it into the memory 160, or control the decryption calculation circuit 150 to perform hash value calculation on the data to be decrypted, obtain the decrypted hash value and write it into the memory 160; the data to be encrypted reaches the encryption calculation circuit 140 sequentially through the first interface 110 and the first register 120; the data to be decrypted reaches the decryption calculation circuit 150 sequentially through the second interface 170 and the memory 160.
[0036] The interface types of the first interface 110 and the second interface 170 are not unique; for example, they can be bus interfaces or serial ports. The bus interface can be an AHB interface or a PCI (Peripheral Component Interconnect) interface. The first register 120 is a basic register, specifically a data register or a segment register. The first controller 130 can be a hardware module containing various processing chips and their peripheral circuits, possessing logical operation functions. This processing chip can be a microcontroller, a DSP (Digital Signal Processing) chip, or an FPGA (Field Programmable Gate Array) chip. The memory 160 can be SRAM or DRAM (Dynamic Random Access Memory). In one embodiment, the memory 160 is SRAM, which is beneficial for improving data read / write speed, thereby improving the operating efficiency of the hash algorithm unit.
[0037] Specifically, the encryption / decryption algorithm unit sends hash value calculation parameters to the first register 120 through the first interface 110. These hash value calculation parameters are related to the data to be processed and are required to calculate the hash value of the data to be processed, such as encryption / decryption command information and intermediate hash calculation values. On the other hand, depending on the type of the data to be processed, it selects different interfaces to send the data to the hash algorithm unit: if the data to be processed is data to be encrypted, it is sent to the first register 120 through the first interface 110; if the data to be processed is data to be decrypted, it is sent to the first register 120 through the second interface 170. The first controller 130 extracts the hash value calculation parameters from the first register 120, determines the hash value calculation type based on the hash value calculation parameters, and then controls the corresponding calculation circuit to perform hash value calculation. In one embodiment, the first controller 130 selects the calculation circuit through a binary bit enable signal. The hash value calculation includes both encryption hash value calculation and decryption hash value calculation. Specifically, the encryption calculation circuit 140 performs hash value calculation on the data to be encrypted, obtains the encryption hash value, and writes it into the memory 160. The decryption calculation circuit 150 performs hash value calculation on the data to be decrypted, obtains the decryption hash value, and writes it into the memory 160. Finally, the encryption / decryption algorithm unit retrieves the corresponding hash value from the memory 160 for subsequent encryption / decryption processing.
[0038] It should be noted that the specific algorithm for hash value calculation is not unique; for example, it could be the SM2, SM3, or SM4 algorithm. Furthermore, depending on the specific algorithm, the specific operation type and hash value calculation process are also not unique. For example, specific operation types include multiplication, dot product, transpose, or hash value calculation. In one embodiment, the encryption calculation circuit 140 can generate the final encrypted hash value by iteratively processing the data to be encrypted through padding, expansion, and compression, and then write the encrypted hash value back to the memory 160. In addition, the memory 160 can also be used to store the data length, initialization vector, and intermediate results of hash value calculation. To ensure that the memory 160 can be shared by the entire system and facilitate data interaction between different modules within the system, the memory 160 can be divided into different areas to store the encrypted hash value, decrypted hash value, intermediate results, and data to be decrypted, respectively.
[0039] Furthermore, the paths for transmitting the encrypted hash value and the decrypted hash value to the encryption / decryption algorithm unit can be the same or different. For example, the encrypted hash value can be transmitted to the encryption / decryption algorithm unit sequentially via memory 160, first register 120, and first interface 110, while the decrypted hash value can be transmitted to the encryption / decryption algorithm unit sequentially via memory 160 and second interface 170; alternatively, both the encrypted hash value and the decrypted hash value can be transmitted to the encryption / decryption algorithm unit sequentially via memory 160 and second interface 170.
[0040] The aforementioned hash algorithm unit is configured with a first interface 110 to acquire data to be encrypted, a second interface 170 to acquire data to be decrypted, and an encryption calculation circuit 140 for calculating the encryption hash value and a decryption calculation circuit 150 for calculating the decryption hash value. That is, different data transmission paths and calculation circuits are configured for the calculation of the encryption hash value and the decryption hash value, respectively, which can realize the synchronous operation of the encryption hash value and the decryption hash value, and is conducive to improving the overall operating efficiency.
[0041] Furthermore, the encryption calculation circuit 140 and the decryption calculation circuit 150 can be logic controllers or control chips that include corresponding encryption and decryption hash algorithms and can directly perform logical operations, or they can be circuit structures that include one or more circuit modules such as arithmetic circuits and memory, and perform logical operations based on each hardware circuit.
[0042] In one embodiment, the encryption calculation circuit 140 and the decryption calculation circuit 150 are circuit modules fabricated using very large-scale integrated circuit manufacturing technology. For example... Figure 2 As shown, the encryption calculation circuit 140 includes a multiplication circuit 141, a shift register 142, and a result register 143. The shift register 142 is connected to the multiplication circuit 141 and the result register 143; the multiplication circuit 141 is connected to the first controller 130 and the first register 120; and the result register 143 is connected to the memory 160. Specifically, the encryption hash value calculation process uses the middle square method. For ease of understanding, a 32-bit integer is used as an example. For a 32-bit integer 'a', the encryption hash value is the middle 10 bits of 'a*a'. The process is as follows: the multiplication circuit 141 calculates the value of 'a*a', stores the result in the shift register 142, removes the lower 11 bits of the value to obtain the middle value, and sends the lower 10 bits of this middle value as the encryption hash value of 'a' to the result register 143. The result register 143 then writes the obtained encryption hash value into the memory 160.
[0043] In the above embodiments, using a purely hardware-based approach to calculate hash values can improve the efficiency of hash value calculation, thereby further enhancing the operating efficiency of the hash algorithm unit.
[0044] In one embodiment, such as Figure 3 As shown, a cryptographic module for a relay protection security chip is provided, including an encryption / decryption algorithm unit 200, a true random number generation unit 300, and the aforementioned hash algorithm unit 100. The encryption / decryption algorithm unit 200 is connected to the relay protection security chip, the true random number generation unit 300, and the hash algorithm unit 100.
[0045] In cryptographic systems, random numbers play a crucial role in encrypting text, images, and videos. Existing random numbers are mainly of two types: true random numbers and pseudo-random numbers. Pseudo-random numbers are easy to implement in software, but their security depends on the complexity of the given algorithm and the key seed. While they possess excellent statistical properties, their unpredictability cannot be guaranteed. True random numbers rely on uncertain entropy sources, such as analog phenomena in electronic devices, and exhibit excellent unpredictability. Therefore, for cryptographic systems with high security requirements, true random numbers are a better choice. In this application, the true random number generation unit 300 is a hardware unit that generates true random numbers from physical processes rather than computer programs. For example, it obtains random numbers based on microscopic phenomena that can generate statistically random "noise" signals, such as thermodynamic noise, the photoelectric effect, and quantum phenomena.
[0046] Furthermore, the generation methods for truly random numbers include direct amplification, oscillation sampling, and metastable sampling. Direct amplification amplifies physical noise such as thermal noise in the external environment to achieve greater randomness, and then compares the output with a comparator to obtain a random number sequence. Oscillatory sampling uses an oscillator in the circuit to generate an oscillating signal, ensuring the randomness of the random numbers. The phase jitter of the oscillator is used as the entropy of the random numbers. A low-frequency signal is used to sample the high-frequency oscillation signal, and then a post-processing module is used to obtain a truly random number sequence with higher randomness. Metastable sampling is a method for generating truly random numbers based on digital logic gate circuits. Its random source is the logic gate circuit. A metastable state, where a gate exists between 0 and 1, is a type of unstable logic gate state. It refers to a situation where the flip-flop cannot reach a definable state (0 or 1) within a fixed time period. For example, in a synchronous circuit system, if the time conditions required for the establishment / holding of the flip-flop's state are not met within a certain time period, a metastable state with an indeterminate state will occur. Suppose that for a considerable period after the system clock arrives, the flip-flop output remains in an indeterminate state. Then, when a truly random number needs to be collected at the flip-flop output, it will output a random number 0 or 1, and the output is not necessarily related to the input. In one embodiment, the truly random number generation unit 300 uses an oscillating sampling method to generate truly random numbers, resulting in a simple circuit that can continuously and stably generate truly random numbers.
[0047] Furthermore, the encryption / decryption algorithm unit 200 is specifically connected to the first interface 110 and the second interface 170 in the hash algorithm unit 100. Further, the encryption / decryption algorithm unit 200 is a hardware unit containing a controller or control chip and possessing logical operation functions.
[0048] Specifically, the true random number generation unit 300 provides the encryption / decryption algorithm unit 200 with the random numbers required for the encryption / decryption process. The encryption / decryption algorithm unit 200 obtains the data to be processed and user configuration information from the relay protection safety chip. Based on the user configuration information and the true random numbers, it performs corresponding encryption / decryption preprocessing on the data to be processed, obtains hash value calculation parameters, and sends them to the hash algorithm unit 100. The user configuration information includes encryption / decryption algorithm selection, encryption / decryption algorithm parameter selection, and encryption / decryption command information. The hash algorithm unit 100 then performs corresponding hash value calculation on the data to be processed based on the hash value calculation parameters, obtains the encryption / decryption hash value, and feeds it back to the encryption / decryption algorithm unit 200. Finally, the encryption / decryption algorithm unit 200 performs corresponding encryption / decryption operations on the data to be processed based on the encryption / decryption hash value, obtains encrypted / plaintext information, and outputs it to the relay protection safety chip.
[0049] The aforementioned relay protection safety chip cryptographic module, on the one hand, because its hash algorithm unit 100 is configured with different data transmission paths and calculation circuits for the calculation of encrypted hash values and decrypted hash values, can realize synchronous calculation of encrypted hash values and decrypted hash values, which is conducive to improving the overall operating efficiency; on the other hand, configuring the hardware unit encryption / decryption algorithm unit 200 and the true random number generation unit 300 can simplify the corresponding processing procedures and further improve the operating efficiency.
[0050] In one embodiment, the encryption / decryption algorithm unit includes a symmetric algorithm component and an asymmetric algorithm component; the symmetric algorithm component is connected to the relay protection security chip, the true random number generation unit 300, and the hash algorithm unit 100; the asymmetric algorithm component is connected to the relay protection security chip, the true random number generation unit 300, and the hash algorithm unit 100.
[0051] Both the symmetric and asymmetric algorithm components are specifically connected to the first interface 110 and the second interface 170 in the hash algorithm unit 100. The symmetric and asymmetric algorithm components are circuit components containing a dedicated processor and its peripheral circuitry, capable of performing encryption and decryption operations. Specifically, the symmetric algorithm component is a circuit component that implements encryption and decryption operations based on a symmetric algorithm, such as DES, 3DES, AES, RC4, RC5, or RC6. Correspondingly, the asymmetric algorithm component is a circuit component that implements encryption and decryption operations based on an asymmetric algorithm, such as elliptic curve cryptography, knapsack cryptography, or RSA.
[0052] Furthermore, multiple different symmetric algorithm components can be configured to implement different symmetric algorithms, and multiple different asymmetric algorithm components can be configured to implement different asymmetric algorithms, to match the encryption and decryption requirements of the relay protection security chip. Specifically, the relay protection security chip can select the corresponding algorithm component to send the data to be processed and the user configuration information according to its own needs; alternatively, a dedicated algorithm selection circuit can be configured in the cryptographic module of the relay protection security chip. This algorithm selection circuit connects the relay protection security chip and the encryption / decryption algorithm unit 200, and is used to obtain the data to be processed and the user configuration information sent by the relay protection security chip, determine the target algorithm component in the encryption / decryption algorithm unit 200 according to the user configuration information, and send the data to be processed and the user configuration information to the corresponding target algorithm component, which then performs the corresponding encryption and decryption processing based on a specific algorithm.
[0053] In the above embodiments, different algorithm components are configured to implement encryption and decryption processing of different algorithm types, which can match different user needs and is beneficial to expanding the application scenarios of the cryptographic module of the relay protection security chip.
[0054] In one embodiment, such as Figure 4 As shown, the symmetric algorithm component includes a bus interface 211, a second register 212, a second controller 213, and a symmetric algorithm operation circuit 214. The bus interface 211 is used to connect the relay protection safety chip, the true random number generation unit 300, the hash algorithm unit 100, the second register 212, and the symmetric algorithm operation circuit 214. The second controller 213 is used to connect the second register 212 and the symmetric algorithm operation circuit 214.
[0055] Specifically, bus interface 211 connects to the first interface 110 and the second interface 170 in the hash algorithm unit 100. The type of bus interface 211 is not unique; for example, it could be an AHB interface or a PCI interface. For specific limitations regarding the second register 212 and the second controller 213, please refer to the limitations regarding the first register 120 and the first controller 130 above, respectively; they will not be repeated here. The symmetric algorithm operation circuit 214 is a hardware unit containing a controller or control chip and possessing logical operation functions.
[0056] Specifically, on one hand, the bus interface 211 is used to receive user configuration information sent by the relay protection security chip and send it to the second register 212; then the second controller 213 reads the user configuration information from the second register 212, generates control information based on the user configuration information, and sends it to the symmetric algorithm operation circuit 214. On the other hand, the bus interface 211 is also used to receive the data to be processed (i.e., plaintext / ciphertext) and seed key sent by the relay protection security chip and send them to the symmetric algorithm operation circuit 214. Finally, the symmetric algorithm operation circuit 214 selects the data path of the corresponding algorithm according to the control information, performs encryption / decryption operations on the data to be processed, obtains ciphertext / plaintext information, and outputs it to the relay protection security chip through the bus interface 211.
[0057] Furthermore, the symmetric algorithm operation circuit 214 can include different algorithm circuits, such as the SM4 algorithm circuit and the AES algorithm circuit, and corresponding S-boxes can be configured to implement the nonlinear transformations in different algorithms, such as... Figure 5 As shown, it is also possible to configure only one S-box, and then use the S-box by each algorithm circuit at different times to implement different algorithms and key expansion logic.
[0058] Furthermore, attackers typically target the nonlinear transformation component (S-box) in symmetric encryption algorithms and use several methods to obtain the key: performing correlational power analysis (CPA) or differential power analysis (DPA) on the S-box input and output; performing CPA or DPA on the linear transformation output after the S-box; classifying the S-box input values by Hamming weight, collecting curves, building templates, and then attacking; high-order DPA, targeting masked symmetric encryption algorithms by XORing the outputs of different S-boxes to eliminate the influence of the same mask, and using the Hamming distance as an intermediate value for DPA analysis; and error injection attacks, altering the input plaintext, key, or causing errors in the intermediate calculation process to interfere with the calculation results. To improve the resistance to attacks of symmetric encryption algorithms, symmetric algorithm components employ measures such as masking, error injection prevention checks, clock scrambling, and signal scrambling to eliminate the correlation between energy consumption characteristics and electromagnetic radiation characteristics during encryption and decryption operations and the key or other sensitive information, thereby improving the symmetric encryption algorithm's resistance to correlational power analysis, differential power analysis, and error injection attacks.
[0059] Furthermore, the connection method between the bus interface 211 and the relay protection safety chip is not unique; for example, it can be connected to the bus in the relay protection safety chip.
[0060] The above embodiments provide the specific circuit configuration of the symmetric algorithm component. The symmetric encryption algorithm is implemented by hardware reconstruction, which can facilitate secondary development and expansion by users as needed.
[0061] In one embodiment, such as Figure 6 As shown, the asymmetric algorithm component includes a register interface 221, and an AHB Slave interface 222, a main operation circuit 223, a basic operation circuit 224, a data path circuit 225, and an SRAM interface 226 connected to the register interface 221. The main operation circuit 223 is connected to the basic operation circuit 224 and the data path circuit 225, the basic operation circuit 224 is connected to the data path circuit 225, and the data path circuit 225 is connected to the SRAM interface 226. The AHB Slave interface 222 connects to the hash algorithm unit 100 and the true random number generation unit 300, and the SRAM interface 226 is used to connect to the relay protection safety chip.
[0062] Specifically, such as Figure 6 As shown, the main arithmetic circuit 223 includes a modular exponentiation circuit, a prime number detection circuit, and an ECC (Ellipse Curve Cryptography) point arithmetic circuit. It implements the core steps of the asymmetric encryption algorithm by invoking modular and large integer operations in the basic arithmetic circuit 224. The basic arithmetic circuit 224 is used to implement modular and large integer operations in the finite prime field, and includes a modular multiplication circuit, a modular inverse circuit, a modular addition and subtraction circuit, and a Montgomery modular multiplication circuit. The data path circuit 225 provides hardware resources for the functional implementation of the main arithmetic circuit 223 and the basic arithmetic circuit 224, and includes registers, a counter unit, and an arithmetic unit.
[0063] Furthermore, to improve the anti-attack capability of asymmetric encryption algorithms and ensure that the energy consumption characteristics and electromagnetic radiation characteristics of the relay protection security chip during encryption and decryption operations are not significantly correlated with the key and sensitive information, the following security protection measures are adopted in the asymmetric encryption component: (1) Clock scrambling: the clock scrambling function is enabled during asymmetric encryption and decryption operations to improve the protection capability of the relay protection security chip against side-channel attacks; (2) Protection of elliptic curve parameters: verification measures are adopted to check whether the parameters are changed during the operation of the asymmetric encryption algorithm; (3) Protection of modular addition / subtraction and modular multiplication / inversion: random delay measures are added to mask the time information of asymmetric encryption and decryption operations; (4) Protection of dot product: a secure dot product algorithm is adopted to mask the input data value of dot product before encryption and decryption operations; (5) Protection against error injection: relevant data is backed up, random delays are added, and key data is judged multiple times.
[0064] In the above embodiments, the asymmetric algorithm component adopts a layered hardware architecture combined with software programs to implement the encryption and decryption of the asymmetric encryption algorithm: the basic operation circuit 224 is used to implement modular arithmetic and large integer arithmetic in the finite prime field; the main operation circuit 223 implements the core steps of the asymmetric encryption algorithm by calling the modular arithmetic and large integer arithmetic of the basic operation circuit 224; the register interface 221 is used to implement the control flow and steps with low computational complexity; the data path circuit 225 provides hardware resources for the functional implementation of the main operation circuit 223 and the basic operation circuit 224, so as to maximize the reusability of hardware resources and reduce the use of hardware resources, and ultimately reduce the area of the security chip as much as possible without sacrificing performance.
[0065] In one embodiment, the asymmetric algorithm component includes an elliptic curve algorithm component; this elliptic curve algorithm component is connected to the relay protection security chip, the true random number generation unit 300, and the hash algorithm unit 100. Specifically, the elliptic curve algorithm component is used to perform asymmetric encryption / decryption processing on the data to be processed based on the elliptic curve encryption algorithm. Furthermore, the elliptic curve algorithm component can be connected to the relay protection security chip, the true random number generation unit 300, and the hash algorithm unit 100 via a bus interface or serial port, or via a dedicated register and interface.
[0066] In one embodiment, such as Figure 7 As shown, the elliptic curve algorithm component includes a multiplication circuit 227 and a processor 228. The multiplication circuit 227 is connected to a true random number generation unit 300, a hash algorithm unit 100, and a processor 228. The processor 228 is connected to a relay protection safety chip. The processor 228 is used to acquire user configuration information and data to be encrypted sent by the relay protection safety chip, determine the initial coordinates of the elliptic function, the public key, and encryption parameters based on the user configuration information, and send the initial coordinates of the elliptic function, the public key, the encryption parameters, and the data to be encrypted to the multiplication circuit 227. The multiplication circuit 227 is used to receive true random numbers generated by the true random number generation unit 300, and based on the true random numbers, the initial coordinates of the elliptic function, the public key, the encryption parameters, and the data to be encrypted, obtain the first multiplier and the second multiplier and send them to the processor 228, as well as obtain hash value calculation parameters and send them to the hash algorithm unit 100. The processor 228 is also used to receive encrypted hash values, and combine the encrypted hash values, the first multiplier, and the second multiplier to generate ciphertext data and output it.
[0067] The multiplication circuit 227 is a circuit module that includes multiplication circuits, modular multiplication circuits, and modular inversion circuits, capable of performing corresponding operations. The processor 228 is a hardware module that includes various processing chips and their peripheral circuits, possessing logical operation functions. Specifically, the processor 228 obtains user configuration information and data M to be encrypted sent by the relay protection safety chip, sends the data M to the multiplication circuit 227, determines the elliptic parameters a and b according to the user configuration information, generates an elliptic function, selects a point on the elliptic function, obtains the initial coordinates G(x0,y0) of the elliptic function, and sends it to the multiplication circuit 227. The multiplication circuit 227 receives a true random number k generated by the true random number generation unit 300, and calculates the first multiplier C1 = k * G = (x1,y1) based on the true random number k and the initial coordinates G(x0,y0) of the elliptic function. Furthermore, the processor 228 is also used to determine the public key Pb and encryption parameter t according to the user configuration information and send them to the multiplication circuit 227. The multiplication circuit 227 is also used to perform multiplication operations based on the first multiplier C1 and the public key Pb to obtain hash value calculation parameters x2 and y2, and send them to the hash algorithm unit 100; and to obtain the second multiplier C2 = M based on the data to be encrypted M and the encryption parameter t. t The first multiplier C1 and the second multiplier C2 are both sent to the processor 228. The relationship between x2, y2, the first multiplier C1, and the public key Pb is: C1*Pb = (x2, y2). Then, the hash algorithm unit 100 calculates the hash value of the data to be encrypted M based on the hash value calculation parameters x2 and y2, obtaining the encrypted hash value C3 = hash(x2||M||y2). Finally, the processor 228 combines the encrypted hash value C3, the first multiplier C1, and the second multiplier C2 to generate the ciphertext data C1||C2||C3 and outputs it.
[0068] The above describes the process by which the elliptic curve algorithm component encrypts data based on the elliptic curve algorithm. It can be understood that, based on the same hardware structure, the elliptic curve algorithm can also be used to decrypt data. Specifically, the processor 228 obtains the user configuration information and the data to be decrypted sent by the relay protection safety chip, and extracts the first multiplier C1 and the encryption hash value C3 from the data to be decrypted; it determines the elliptic parameters a and b according to the user configuration information, generates an elliptic function, and determines whether there exists a point G on the elliptic function that satisfies C1 / G = k = y1 / y0 = x1 / x0, where (x0, y0) are the coordinates of point G, and (x1, y1) are the coordinates corresponding to the first multiplier C1. The processor 228 extracts the second multiplier C2 from the data to be decrypted, and determines the public key Pb and encryption parameter t according to the user configuration information, and then sends the first multiplier C1, encryption hash value C3, public key Pb, and encryption parameter t to the multiplication circuit 227. The multiplication circuit 227 performs the multiplication operation C1*Pb=(x2,y2) based on the first multiplier C1 and the public key Pb to obtain the hash value calculation parameters x2 and y2, and obtains the decryption information M=C2 based on the second multiplier C2 and the encryption parameter t. -t The decrypted information M and hash value calculation parameters are sent to the hash algorithm unit 100. The hash value calculation unit 100 calculates the hash value of the decrypted information M based on the hash value calculation parameters x2 and y2, obtaining the decrypted hash value u = hash(x2||M||y2), and feeds it back to the processor 228. Finally, the processor 228 verifies the decrypted hash value u against the encrypted hash value C3. If they are correct, the decrypted information M is output as the decrypted data; if they are incorrect, a decryption failure message is output.
[0069] It should be noted that the processor 228 obtains the encrypted hash value C3 or the decrypted hash value u from the hash algorithm unit 100 either directly from the hash algorithm unit 100 or through the multiplication circuit 227. If the processor 228 obtains the corresponding hash value directly from the hash algorithm unit 100, then the processor 228 also needs to be connected to the hash algorithm unit 100. Furthermore, the output object of the ciphertext data and decrypted data can be a relay protection security chip or a memory connected to the processor 228, such as SRAM.
[0070] The above embodiments provide a specific structure of the asymmetric algorithm component. By configuring the hardware computing circuit, corresponding calculations can be performed during the encryption and decryption process, thereby improving the encryption and decryption processing speed and the overall operating efficiency of the entire relay protection security chip cryptographic module.
[0071] In one embodiment, such as Figure 8As shown, the true random number generation unit 300 includes an energy conversion circuit 310, an amplifier circuit 320, and an analog-to-digital conversion circuit 330: the amplifier circuit 320 is connected to the energy conversion circuit 310 and the analog-to-digital conversion circuit 330; the analog-to-digital conversion circuit 330 is connected to the encryption / decryption algorithm unit 200.
[0072] Specifically, the energy conversion circuit 310 generates random physical effects, detects them, and converts the detection results into electrical signals, which are then output to the amplifier circuit 320. These random physical effects can be circuit noise generated by quantum mechanical noise sources or thermal noise generated by resistors. The amplifier circuit 320 receives this electrical signal, amplifies its amplitude, and outputs a macroscopic-level analog signal to the analog-to-digital converter circuit 330. The analog-to-digital converter circuit 330 converts this analog signal into a digital signal, typically binary 0s and 1s. A series of random numbers can be obtained by repeatedly sampling these random signals.
[0073] In one embodiment, please refer to... Figure 8 The true random number generation unit also includes a detection circuit 340, which is connected to the analog-to-digital conversion circuit 330 and the encryption / decryption algorithm unit 200.
[0074] Specifically, the detection circuit 340 is used to perform statistical verification on the obtained true random numbers based on a preset statistical detection method, and then transmit the true random numbers that pass the verification to the encryption / decryption algorithm unit 200. The preset statistical detection method can be any one of the following methods:
[0075] (1) Bit distribution detection; used to determine whether a random sequence satisfies the uniformity of distribution. It mainly tests the number of 0s and 1s in a sequence of length n bits. Ideally, 0s and 1s are equally distributed. If the probability difference between 0s and 1s is less than the preset value, the test is passed.
[0076] (2) Follow-up characteristic detection (also known as transition detection); The follow-up characteristic of a sequence refers to the occurrence of adjacent elements in the sequence. It is mainly used to test whether the probabilities of 00, 01, 10, and 11 are equal in a sequence of length n bits. The low-frequency sampling measure is beneficial to ensure the follow-up characteristic of the output number; If the probability difference between 00, 01, 10, and 11 is less than the preset difference, the test is passed.
[0077] (3) Run detection; A run is a sequence of consecutive 0s or 1s, and the elements before and after it are different from the elements of the run. When the number of runs is half the length of the sequence, the generated random sequence is better; if the difference between the number of runs and half the length of the sequence is less than the set value, the test passes.
[0078] (4) Collision detection; This detection method is based on the analogy of an abstract probability experiment of ball collision. It is assumed that n balls are randomly thrown into m empty jars, where m >> n. When a ball falls into a non-empty jar, it is considered that a collision has occurred; if a collision occurs, the test is passed.
[0079] (5) Poker detection: The test first divides the sequence to be tested into several binary subsequences of length p (p is any positive integer). Each binary subsequence of length p has 2p seed sequence types. Then, it checks whether the number of these 2p seed sequence types is equal. If they are equal, the test passes.
[0080] The above embodiments provide the specific hardware configuration of the true random number generation unit 300. Using true random numbers in the encryption and decryption process is beneficial to improving the security of the relay protection safety chip.
[0081] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0082] The above embodiments merely illustrate several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A relay protection security chip password module, It is characterized in that It includes an encryption and decryption algorithm unit, a true random number generation unit and a hash algorithm unit, wherein the encryption and decryption algorithm unit is connected to the relay protection safety chip, the true random number generation unit and the hash algorithm unit; The encryption and decryption algorithm unit includes a symmetric algorithm component and an asymmetric algorithm component; the symmetric algorithm component is connected to the relay protection safety chip, the true random number generation unit and the hash algorithm unit; the asymmetric algorithm component is connected to the relay protection safety chip, the true random number generation unit and the hash algorithm unit; The asymmetric algorithm component includes an elliptic curve algorithm component; the elliptic curve algorithm component is connected to the relay protection safety chip, the true random number generation unit and the hash algorithm unit; The elliptic curve algorithm component includes a multiplication circuit and a processor; The multiplication circuit is connected to the true random number generation unit, the hash algorithm unit and the processor; the processor is connected to the relay protection safety chip; The processor is used to obtain user configuration information and data to be encrypted sent by the relay protection safety chip, determine the initial coordinates of the elliptic function, the public key and the encryption parameters according to the user configuration information, and send the initial coordinates of the elliptic function, the public key, the encryption parameters and the data to be encrypted to the multiplication circuit; The multiplication circuit is used to receive the true random number generated by the true random number generation unit, and based on the true random number and the elliptic function initial coordinates, obtain a first multiplier and send it to the processor; The multiplication circuit is further used to obtain a hash value calculation parameter based on the first multiplier and the public key and send the parameter to the hash algorithm unit; the multiplication circuit is further used to obtain a second multiplier based on the data to be encrypted and the encryption parameter and send the parameter to the processor; The processor is further configured to receive an encrypted hash value, and combine the encrypted hash value, the first multiplier, and the second multiplier to generate and output ciphertext data; The hash algorithm unit includes a first interface, a first register, a first controller, an encryption calculation circuit, a decryption calculation circuit, a memory, and a second interface; The first register is connected to the first interface, the first controller and the encryption calculation circuit; the encryption calculation circuit is connected to the first controller and the memory; The decryption calculation circuit is connected to the first controller and the memory; the memory is also connected to the second interface; the first interface and the second interface are used to connect to the encryption and decryption algorithm unit; The first register is used to obtain the hash value calculation parameter from the encryption and decryption algorithm unit through the first interface; The encryption and decryption algorithm unit is also used to send the data to be processed to the first register; The first controller is used to extract the hash value calculation parameters in the first register, and when the data to be processed is data to be encrypted, control the encryption calculation circuit to perform hash value calculation on the data to be encrypted according to the hash value calculation parameters, obtain the encrypted hash value and write it into the memory; the data to be encrypted reaches the encryption calculation circuit via the first interface and the first register in sequence; The first controller is also used to control the decryption calculation circuit to perform hash value calculation on the data to be decrypted according to the hash value calculation parameters when the data to be processed is data to be decrypted, obtain the decrypted hash value and write it into the memory; the data to be decrypted reaches the decryption calculation circuit via the second interface and the memory in sequence.
2. The relay protection security chip password module according to claim 1, It is characterized in that The symmetric algorithm component includes a bus interface, a second register, a second controller and a symmetric algorithm operation circuit; the bus interface is used to connect the relay protection safety chip, the true random number generation unit, the hash algorithm unit, the second register and the symmetric algorithm operation circuit; the second controller is used to connect the second register and the symmetric algorithm operation circuit.
3. The relay protection security chip password module according to claim 1, It is characterized in that The asymmetric algorithm component includes a register interface, and an AHB Slave interface, a main operation circuit, a basic operation circuit, a data path circuit and an SRAM interface connected to the register interface; the main operation circuit is connected to the basic operation circuit and the data path circuit; the basic operation circuit is connected to the data path circuit, and the data path circuit is connected to the SRAM interface; The AHB Slave interface is used to connect the hash algorithm unit and the true random number generation unit, and the SRAM interface is used to connect the relay protection safety chip.
4. The relay protection security chip password module according to claim 1, It is characterized in that The true random number generation unit includes an energy conversion circuit, an amplification circuit and an analog-to-digital conversion circuit: the amplification circuit is connected to the energy conversion circuit and the analog-to-digital conversion circuit; the analog-to-digital conversion circuit is connected to the encryption and decryption algorithm unit.
5. The relay protection security chip password module according to claim 4, It is characterized in that The true random number generation unit also includes a detection circuit, which is connected to the analog-to-digital conversion circuit and the encryption and decryption algorithm unit.
6. The relay protection security chip password module according to claim 5, It is characterized in that The detection circuit is used to perform statistical inspection on the obtained true random number based on a preset statistical inspection method, and then transmit the true random number that passes the inspection to the encryption and decryption algorithm unit.
7. The relay protection security chip password module according to claim 6, It is characterized in that The preset statistical detection method includes any one of bit distribution detection, transfer detection, run detection, collision detection or poker detection.
8. The relay protection security chip password module according to claim 1, It is characterized in that The first register is a data register or a segment register.
9. The relay protection security chip password module according to claim 1, It is characterized in that The first interface is a bus interface or a serial port.
10. The relay protection security chip password module according to claim 1, Features: The encryption calculation circuit includes a multiplication circuit, a shift register and a result register, wherein the shift register is connected to the multiplication circuit and the result register; the multiplication circuit is connected to the first controller and the first register; and the result register is connected to the memory.
