Anti-clock-attack random clock generation method and system, computer equipment, storage medium and program product
The random seed sequence and working mode are configured through external input signals, and one cycle is randomly lost within the clock cycle to generate a random clock, which solves the problems of hardware support and design complexity in the existing technology, and improves the efficiency and flexibility of resisting clock attacks. .
Patent Information
- Application Number
- CN202410758442.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-08-30
AI Technical Summary
Existing random clock generation methods require additional hardware support and complex hardware design to resist clock attacks, making it difficult to achieve efficient random seed sequence and working mode updates.
Configure a new random seed sequence and working mode through an external input signal, and randomly lose one cycle within a target number of cycles to generate a random clock, which reduces hardware requirements and implementation difficulty.
It reduces the hardware requirements and implementation difficulty in resisting clock attacks, and improves the efficiency and flexibility of random clock generation.
Smart Images

Figure CN118567608A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of integrated circuits, and in particular relates to a random clock generation method, system, computer equipment, storage medium and program product that are resistant to clock attacks. Background Art
[0002] In the field of cryptography and chip security, random clocks are increasingly used. Random clocks can be used to generate encryption keys and security tokens to ensure the security of encryption algorithms, and can also be used as a clock disruption method to resist clock attacks. In order to prevent attackers from obtaining sensitive internal information in the encryption process by analyzing the clock behavior of the encryption system, it is necessary to overwrite the random clock in important modules such as cryptographic algorithms, and use the unpredictability of the random clock to increase the chip's resistance to clock attacks. Therefore, random clock generation technology is of great significance in resisting clock attacks.
[0003] At present, the common method of random clock generation is to destroy the regularity of the clock by adding delays, randomly changing the clock period, etc., and use the clock randomization circuit to output a random clock. In practice, this method often requires additional hardware support and complex hardware design, and often faces technical challenges in actual deployment. Summary of the invention
[0004] The present invention provides a random clock generation method, system, computer equipment, storage medium and program product that are resistant to clock attacks. A new random seed sequence and a working mode for generating a random clock can be configured on a bus through an external input signal. Then, according to the new random seed sequence and the working mode for generating a random clock, a clock cycle is randomly lost from a target number of cycles of clocks to obtain a random clock, which is beneficial to reducing the hardware requirements and implementation difficulty of updating the random seed sequence and the working mode for generating a random clock.
[0005] In a first aspect, the present invention provides a random clock generation method resistant to clock attacks, comprising: Obtaining an initial random seed sequence of target bits and an initial working mode for generating a random clock; Determine whether all the values of the initial random seed sequence of the target number of bits are zero; If they are all zero, the initial random seed sequence for obtaining the target number of bits and the initial working mode for generating the random clock are re-obtained; If they are not all zero, determining whether the initial working mode and / or the initial random seed sequence receives an update instruction; If an update instruction is received, the initial random seed sequence or the updated random seed sequence is used as the first random seed sequence, the initial working mode or the updated working mode is used as the first working mode, and according to the first random seed sequence and the first working mode, a clock cycle is randomly lost from the clock cycle of the target number of cycles to obtain a random clock; If no update instruction is received, a random clock is obtained by randomly missing one clock cycle from the target number of clock cycles according to the initial random seed sequence and the initial working mode.
[0006] Optionally, the using the initial random seed sequence or the updated random seed sequence as the first random seed sequence, the initial working mode or the updated working mode as the first working mode, and randomly losing one cycle of the clock from the target number of cycles of the clock according to the first random seed sequence and the first working mode to obtain the random clock includes: An m-bit counter is used to count the clock cycle; wherein, after the m-bit counter reaches the maximum count value, the count value is reset to zero and then starts counting from zero again; When the values of the first random seed sequence from 0 to n'-1 are respectively equal to the values of the counter from 0 to n'-1, the clock signal is controlled to be in a low level state in one clock cycle to obtain a random clock; wherein n' is the value corresponding to the first working mode, and m>n'.
[0007] Optionally, the step of randomly losing one cycle of a clock from a target number of cycles of clocks to obtain a random clock according to an initial random seed sequence and an initial working mode includes: The value of the i-1th bit of the initial random seed sequence is used as the value of the ith bit of the updated random seed sequence, and the value of the ith bit of the initial random seed sequence is used as the value of the 0th bit of the updated random seed sequence, to obtain a second random seed sequence; wherein 1≤i≤I, I is the maximum number of bits of the initial random seed sequence; and the total number of bits of the second random seed sequence is the same as that of the initial random seed sequence; An m-bit counter is used to count the clock cycle; wherein, after the m-bit counter reaches the maximum count value, the count value is reset to zero and then starts counting from zero again; When the values of the second random seed sequence from 0 to n-1 are respectively equal to the values of the counter from 0 to n-1, the clock signal is controlled to be in a low level state in one clock cycle to obtain a random clock; wherein n is the value corresponding to the initial working mode, and m>n.
[0008] In a second aspect, the present invention provides a random clock generation system resistant to clock attacks, comprising: A first acquisition module, used to acquire an initial random seed sequence of a target number of bits and an initial working mode for generating a random clock; The first judgment module is used to judge whether the values of all bits of the initial random seed sequence of the target bit number are zero; A second acquisition module is used to reacquire the initial random seed sequence of the target number of bits and the initial working mode for generating the random clock when the first judgment module determines that the values of all bits of the initial random seed sequence of the target number of bits are zero; A second judgment module is used to judge whether the initial working mode and / or the initial random seed sequence receives an update instruction when the first judgment module determines that the values of all bits of the initial random seed sequence of the target bit number are not all zero; A first clock loss module is used for, when the second judgment module determines that the initial working mode and / or the initial random seed sequence receive an update instruction, using the initial random seed sequence or the updated random seed sequence as the first random seed sequence, using the initial working mode or the updated working mode as the first working mode, and randomly losing one cycle of the clock from the target number of cycles of the clock according to the first random seed sequence and the first working mode to obtain a random clock; The second clock loss module is used to randomly lose one clock cycle from a target number of clock cycles according to the initial random seed sequence and the initial working mode to obtain a random clock when the second judgment module determines that neither the initial working mode nor the initial random seed sequence has received an update instruction.
[0009] Optionally, the first clock loss module includes: A first counting unit is used to count the clock cycle using an m-bit counter; wherein after the m-bit counter reaches a maximum count value, the count value is reset to zero and then starts counting again from zero; The first clock signal control unit is used to control the clock signal to be in a low level state in one clock cycle to obtain a random clock when the values of the first random seed sequence from 0 to n'-1 are respectively equal to the values of the counter from 0 to n'-1, wherein n' is the value corresponding to the first working mode, and m>n'.
[0010] Optionally, the second clock loss module includes: a value replacement unit, used to use the value of the i-1th bit of the initial random seed sequence as the value of the ith bit of the updated random seed sequence, and use the value of the ith bit of the initial random seed sequence as the value of the 0th bit of the updated random seed sequence, to obtain a second random seed sequence; wherein 1≤i≤I, I is the maximum number of digits of the initial random seed sequence; and the total number of digits of the second random seed sequence is the same as that of the initial random seed sequence; A second counting unit is used to count the clock cycle using an m-bit counter; wherein after the m-bit counter reaches a maximum count value, the count value is reset to zero and then starts counting again from zero; The second clock signal control unit is used to control the clock signal to be in a low level state in one clock cycle to obtain a random clock when the values of the second random seed sequence from 0 to n-1 are respectively equal to the values of the counter from 0 to n-1, wherein n is the value corresponding to the initial working mode, and m>n.
[0011] In a third aspect, the present invention provides a computer device comprising a processor and a memory; wherein, when the processor executes a computer program stored in the memory, the steps of the random clock generation method for resisting clock attacks described in the first aspect are implemented.
[0012] In a fourth aspect, the present invention provides a computer-readable storage medium for storing a computer program; when the computer program is executed by a processor, the steps of the random clock generation method for resisting clock attacks described in the first aspect are implemented.
[0013] In a fifth aspect, the present invention provides a computer program product, comprising computer executable instructions or a computer program, which, when executed by a processor, implements the steps of the random clock generation method that is resistant to clock attacks as described in the first aspect. Beneficial Effects
[0014] The present invention provides a random clock generation method, system, computer device, storage medium and program product that are resistant to clock attacks. In the method, the update mode of the random seed sequence and the working mode of generating the random clock can be updated in the form of an external input signal through a bus, and then according to the new random seed sequence and / or the new working mode for generating the random clock, a clock cycle is randomly lost from a target number of cycles of clocks to obtain a random clock. Compared with using a clock randomization circuit to output a random clock, the present invention reduces the hardware requirements and implementation difficulty of updating the random seed sequence and the working mode of random clock generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 A flowchart of a random clock generation method resistant to clock attacks provided by an embodiment of the present invention; Figure 2A schematic diagram of the structure of a clock gating unit ICG provided in an embodiment of the present invention; Figure 3 An example timing diagram of a clock gating unit ICG provided in an embodiment of the present invention; Figure 4 A timing diagram of a random clock generation process provided by an embodiment of the present invention; Figure 5 A schematic structural diagram of a random clock generation system resistant to clock attacks provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] The present invention configures a new random seed sequence and a working mode for generating a random clock by bus through an external input signal, and then randomly loses a clock cycle from a target number of clock cycles according to the new random seed sequence and the working mode for generating a random clock to obtain a random clock. Example 1
[0019] like Figure 1 As shown, this embodiment provides a random clock generation method that is resistant to clock attacks, including: Step 101, obtaining an initial random seed sequence of a target number of bits and an initial working mode for generating a random clock.
[0020] This embodiment is described with the value corresponding to the initial working mode being 4, indicating that the initial working mode is to randomly gate a clock (randomly lose a clock cycle) within 16 clock cycles, which can be expressed as controlling the clock signal to be in a low level state within a clock cycle. The initial random seed sequence r0=64'hea13_1497_1023_0125.
[0021] Step 102, determining whether the values of all bits of the initial random seed sequence of the target bit number are zero.
[0022] In this step, since the randomness of the random clock is based on the value of each bit of the random seed sequence, it is necessary to determine whether the values of all bits of the random seed sequence are all zero during the process of generating the random clock. If the values of all bits of the initial random seed sequence are all zero, an all-zero error interrupt is output, and the operation of step 103 is performed, that is, the operation of step 101 is returned. If the values of all bits of the initial random seed sequence are not all zero, the operation of step 104 is performed. In the process of generating the random clock, the random seed sequence needs to be kept in an updated state.
[0023] Step 103: If all are zero, re-acquire the initial random seed sequence for obtaining the target number of bits and the initial working mode for generating the random clock.
[0024] Step 104, if they are not all zero, determine whether the initial working mode and / or the initial random seed sequence receives an update instruction.
[0025] In this embodiment, the update instruction is an instruction input by an external input signal through a bus. According to the requirements of the actual application, the working mode register r_sel_mode is used to change the working mode n'' for generating the random clock according to the configuration value of the external input signal (the working mode is n'', which means that in 2 n'' Randomly gate the clock once within a clock cycle, r_sel_mode=n''), to control the frequency of clock loss.
[0026] Set the random seed sequence register r_sel_seed, r_sel_seed=r, and update the random seed sequence according to the configuration value of the external input signal.
[0027] Exemplarily, the values of the lower I / 2 bits of the target number of bits of the initial random seed sequence are configured to obtain an updated first random seed sequence; wherein I is the maximum number of bits of the initial random seed sequence; and the total number of bits of the first random seed sequence is the same as that of the initial random seed sequence.
[0028] Taking r0=64'hea13_1497_1023_0125 as an example, the lower 32 bits of the random seed sequence are updated each time through the external input signal configuration register, and can be updated multiple times, that is, r[31:0]= wdata; r[31:0] represents the value of the 0th to 31st bits of the random seed sequence r; wdata is the configuration value of the random seed sequence through the external input signal through the 32-bit data bit width bus.
[0029] According to the random seed sequence r, the working mode n'' and the clock gating unit, the random clock can be controlled and generated. In this embodiment, the clock gating unit (integrated clock gating, ICG) can be directly provided by the process library, and the structure is shown as follows Figure 2As shown, E is the gate enable, CK is the input clock, and GCK is the output clock. The clock gating unit usually controls the transmission of the clock signal through a logic gate (such as an AND gate) by using the clock signal CK and the control signal (enable E). In order to avoid glitches at the output end, Figure 2 The latch Latch is used to sample the control signal E to achieve synchronization with the clock CK. Figure 3 FIG. 1 is a timing example diagram of the ICG module. Therefore, by pulling down the enable E pin of the ICG module, the clock signal CK can generate an incomplete random clock GCK through the ICG module.
[0030] Step 105, if an update instruction is received, the initial random seed sequence or the updated random seed sequence is used as the first random seed sequence, the initial working mode or the updated working mode is used as the first working mode, and according to the first random seed sequence and the first working mode, one cycle of the clock is randomly lost from the target number of cycles of the clock to obtain a random clock.
[0031] This step is for the case where there is an external input signal configuration update. Exemplarily, an m-bit counter is used to count the clock cycle; wherein, after the m-bit counter reaches the maximum count value, the count value is reset to zero and then starts counting from zero again; When the values of the first random seed sequence from 0 to n'-1 are respectively equal to the values of the counter from 0 to n'-1, a gating enable signal en=1 is output to enable the clock gating unit, and the clock signal is controlled to be in a low level state in one clock cycle to obtain a random clock; wherein n' is the value corresponding to the first working mode, and m>n'.
[0032] Step 106: If no update instruction is received, a random clock is obtained by randomly missing one clock cycle from the target number of clock cycles according to the initial random seed sequence and the initial working mode.
[0033] This step is for the case where there is no external input signal configuration update, and the random seed sequence performs hardware self-update. Exemplarily, the value of the i-1 bit of the initial random seed sequence is used as the value of the i bit of the updated random seed sequence, and the value of the I bit of the initial random seed sequence is used as the value of the 0 bit of the updated random seed sequence to obtain the updated second random seed sequence; wherein 1≤i≤I, I is the maximum number of digits of the initial random seed sequence; the total number of digits of the second random seed sequence is the same as that of the initial random seed sequence.
[0034] An m-bit counter is used to count the clock cycles; wherein, after the m-bit counter reaches a maximum count value, the count value returns to zero and then starts counting from zero again.
[0035] When the values of the second random seed sequence from 0 to n-1 are respectively equal to the values of the counter from 0 to n-1, the clock signal is controlled to be in a low level state in one clock cycle to obtain a random clock; wherein n is the value corresponding to the initial working mode, and m>n.
[0036] The timing diagram of random clock generation is as follows Figure 4 As shown. Set the initial random seed sequence r0 to: r0=64'hea13_1497_1023_0125, set the value corresponding to the initial working mode for generating random clock to 4 (16 cycles), then with the continuous update of the random seed sequence and the accumulation of the counter cnt, when r[3:0]=cnt[3:0] (the values of the 0th to 3rd bits of the random seed sequence are equal to the values of the 0th to 3rd bits of the counter respectively), the ICG unit will be controlled to enable the clock (the enable pin E of the ICG module pulls down the clock) by one beat (the clock signal is in a low level state in one clock cycle), thereby realizing the function of randomly losing one beat of the clock.
[0037] In summary, the random clock generation method provided by the present embodiment is resistant to clock attacks. The random seed sequence and the working mode of generating the random clock are updated in the form of an external input signal through the bus, and then according to the updated random seed sequence and / or the new working mode for generating the random clock, a clock cycle is randomly lost from the clock of the target number of cycles to obtain the random clock. Compared with outputting the random clock using the clock randomization circuit, the random clock generation method provided by the present embodiment can reduce the hardware requirements and implementation difficulty of updating the random seed sequence and the working mode of random clock generation. Example 2
[0038] Based on the same inventive concept as Example 1, this embodiment also provides a random clock generation system that is resistant to clock attacks. Since the principle of solving the problem by this system is similar to the random clock generation method that is resistant to clock attacks described in Example 1, the implementation of this system can refer to the implementation of the random clock generation method that is resistant to clock attacks.
[0039] like Figure 5 As shown, this embodiment provides a random clock generation system that is resistant to clock attacks, including: The first acquisition module 10 is used to acquire an initial random seed sequence of a target number of bits and an initial working mode for generating a random clock.
[0040] The first judgment module 20 is used to judge whether the values of all bits of the initial random seed sequence of the target bit number are zero.
[0041] The second acquisition module 30 is used to re-acquire the initial random seed sequence of the target number of bits and the initial working mode for generating the random clock when the first judgment module determines that the values of all bits of the initial random seed sequence of the target number of bits are zero.
[0042] The second judgment module 40 is used to judge whether the initial working mode and / or the initial random seed sequence receives an update instruction when the first judgment module determines that the values of all bits of the initial random seed sequence of the target bit number are not all zero.
[0043] The first clock loss module 50 is used to use the initial random seed sequence or the updated random seed sequence as the first random seed sequence, the initial working mode or the updated working mode as the first working mode, and randomly lose one cycle of the clock from the target number of cycles of the clock according to the first random seed sequence and the first working mode, so as to obtain a random clock when the second judgment module determines that the initial working mode and / or the initial random seed sequence receive an update instruction.
[0044] The second clock loss module 60 is used to randomly lose one clock cycle from a target number of clock cycles according to the initial random seed sequence and the initial working mode to obtain a random clock when the second judgment module determines that neither the initial working mode nor the initial random seed sequence receives an update instruction.
[0045] Exemplarily, the first clock loss module includes: The first counting unit is used to count the clock cycle by using an m-bit counter; wherein after the m-bit counter reaches a maximum count value, the count value is reset to zero and then starts counting again from zero.
[0046] The first clock signal control unit is used to control the clock signal to be in a low level state in one clock cycle to obtain a random clock when the values of the first random seed sequence from 0 to n'-1 are respectively equal to the values of the counter from 0 to n'-1, wherein n' is the value corresponding to the first working mode, and m>n'.
[0047] Exemplarily, the second clock loss module includes: The value replacement unit is used to use the value of the i-1th bit of the initial random seed sequence as the value of the ith bit of the updated random seed sequence, and use the value of the ith bit of the initial random seed sequence as the value of the 0th bit of the updated random seed sequence to obtain a second random seed sequence; wherein 1≤i≤I, I is the maximum number of bits of the initial random seed sequence; and the total number of bits of the second random seed sequence is the same as that of the initial random seed sequence.
[0048] The second counting unit is used to count the clock cycle by using an m-bit counter; wherein after the m-bit counter reaches a maximum count value, the count value is reset to zero and then starts counting again from zero.
[0049] The second clock signal control unit is used to control the clock signal to be in a low level state in one clock cycle to obtain a random clock when the values of the second random seed sequence from 0 to n-1 are respectively equal to the values of the counter from 0 to n-1, wherein n is the value corresponding to the initial working mode, and m>n.
[0050] For more specific working processes of the above modules, please refer to the corresponding contents disclosed in Example 1, which will not be repeated here. Example 3
[0051] This embodiment provides a computer device, characterized in that it includes a processor and a memory; wherein the processor implements the steps of the random clock generation method for resisting clock attacks described in Example 1 when executing a computer program stored in the memory.
[0052] For more specific details of the above method, please refer to the corresponding contents disclosed in Example 1, which will not be repeated here. Example 4
[0053] This embodiment provides a computer-readable storage medium, characterized in that it is used to store a computer program; when the computer program is executed by a processor, the steps of the random clock generation method for resisting clock attacks described in the first aspect are implemented.
[0054] For more specific details of the above method, please refer to the corresponding contents disclosed in Example 1, which will not be repeated here. Example 5
[0055] This embodiment provides a computer program product, including computer executable instructions or a computer program. When the computer executable instructions or the computer program are executed by a processor, the steps of the random clock generation method for resisting clock attacks described in Embodiment 1 are implemented.
[0056] For more specific details of the above method, please refer to the corresponding contents disclosed in Example 1, which will not be repeated here.
[0057] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the systems, devices, storage media, and computer program products disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0058] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.
[0059] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0060] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file storing other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0061] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0062] The present invention has been described in detail above in conjunction with specific implementations and exemplary examples, but these descriptions cannot be understood as limiting the present invention. Those skilled in the art understand that, without departing from the spirit and scope of the present invention, a variety of equivalent substitutions, modifications or improvements may be made to the technical solution of the present invention and its implementation methods, all of which fall within the scope of the present invention. The scope of protection of the present invention shall be subject to the attached claims.
Claims
1. A random clock generation method resistant to clock attacks, characterized in that: include: Obtaining an initial random seed sequence of target bits and an initial working mode for generating a random clock; Determine whether all the values of the initial random seed sequence of the target number of bits are zero; If they are all zero, the initial random seed sequence for obtaining the target number of bits and the initial working mode for generating the random clock are re-obtained; If they are not all zero, determining whether the initial working mode and / or the initial random seed sequence receives an update instruction; If an update instruction is received, the initial random seed sequence or the updated random seed sequence is used as the first random seed sequence, the initial working mode or the updated working mode is used as the first working mode, and according to the first random seed sequence and the first working mode, a clock cycle is randomly lost from the clock cycle of the target number of cycles to obtain a random clock; If no update instruction is received, a random clock is obtained by randomly missing one clock cycle from the target number of clock cycles according to the initial random seed sequence and the initial working mode.
2. The random clock generation method against clock attacks according to claim 1, characterized in that: The method of using the initial random seed sequence or the updated random seed sequence as the first random seed sequence, using the initial working mode or the updated working mode as the first working mode, and randomly losing one cycle of clocks from a target number of cycles of clocks according to the first random seed sequence and the first working mode to obtain a random clock includes: An m-bit counter is used to count the clock cycle; wherein, after the m-bit counter reaches the maximum count value, the count value is reset to zero and then starts counting from zero again; When the values of the first random seed sequence from 0 to n'-1 are respectively equal to the values of the counter from 0 to n'-1, the clock signal is controlled to be in a low level state in one clock cycle to obtain a random clock; wherein n' is the value corresponding to the first working mode, and m>n'.
3. The random clock generation method against clock attacks according to claim 1, characterized in that: The method of randomly losing a clock cycle from a target number of clock cycles according to an initial random seed sequence and an initial working mode to obtain a random clock includes: The value of the i-1th bit of the initial random seed sequence is used as the value of the ith bit of the updated random seed sequence, and the value of the ith bit of the initial random seed sequence is used as the value of the 0th bit of the updated random seed sequence, to obtain a second random seed sequence; wherein 1≤i≤I, I is the maximum number of bits of the initial random seed sequence; and the total number of bits of the second random seed sequence is the same as that of the initial random seed sequence; An m-bit counter is used to count the clock cycle; wherein, after the m-bit counter reaches the maximum count value, the count value is reset to zero and then starts counting from zero again; When the values of the second random seed sequence from 0 to n-1 are respectively equal to the values of the counter from 0 to n-1, the clock signal is controlled to be in a low level state in one clock cycle to obtain a random clock; wherein n is the value corresponding to the initial working mode, and m>n.
4. A random clock generation system resistant to clock attacks, characterized in that: include: A first acquisition module, used to acquire an initial random seed sequence of a target number of bits and an initial working mode for generating a random clock; The first judgment module is used to judge whether the values of all bits of the initial random seed sequence of the target bit number are zero; A second acquisition module is used to reacquire the initial random seed sequence of the target number of bits and the initial working mode for generating the random clock when the first judgment module determines that the values of all bits of the initial random seed sequence of the target number of bits are zero; A second judgment module is used to judge whether the initial working mode and / or the initial random seed sequence receives an update instruction when the first judgment module determines that the values of all bits of the initial random seed sequence of the target bit number are not all zero; A first clock loss module is used for, when the second judgment module determines that the initial working mode and / or the initial random seed sequence receive an update instruction, using the initial random seed sequence or the updated random seed sequence as the first random seed sequence, using the initial working mode or the updated working mode as the first working mode, and randomly losing one cycle of the clock from the target number of cycles of the clock according to the first random seed sequence and the first working mode to obtain a random clock; The second clock loss module is used to randomly lose one clock cycle from a target number of clock cycles according to the initial random seed sequence and the initial working mode to obtain a random clock when the second judgment module determines that neither the initial working mode nor the initial random seed sequence has received an update instruction.
5. The random clock generation system against clock attacks according to claim 4, characterized in that: The first clock loss module includes: A first counting unit is used to count the clock cycle using an m-bit counter; wherein after the m-bit counter reaches a maximum count value, the count value is reset to zero and then starts counting again from zero; The first clock signal control unit is used to control the clock signal to be in a low level state in one clock cycle to obtain a random clock when the values of the first random seed sequence from 0 to n'-1 are respectively equal to the values of the counter from 0 to n'-1, wherein n' is the value corresponding to the first working mode, and m>n'.
6. The random clock generation system against clock attacks according to claim 4, characterized in that: The second clock loss module includes: a value replacement unit, used to use the value of the i-1th bit of the initial random seed sequence as the value of the ith bit of the updated random seed sequence, and use the value of the ith bit of the initial random seed sequence as the value of the 0th bit of the updated random seed sequence, to obtain a second random seed sequence; wherein 1≤i≤I, I is the maximum number of digits of the initial random seed sequence; and the total number of digits of the second random seed sequence is the same as that of the initial random seed sequence; A second counting unit is used to count the clock cycle using an m-bit counter; wherein after the m-bit counter reaches a maximum count value, the count value is reset to zero and then starts counting again from zero; The second clock signal control unit is used to control the clock signal to be in a low level state in one clock cycle to obtain a random clock when the values of the second random seed sequence from 0 to n-1 are respectively equal to the values of the counter from 0 to n-1, wherein n is the value corresponding to the initial working mode, and m>n.
7. A computer device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the steps of the random clock generation method for resisting clock attacks as described in any one of claims 1-3 are implemented.
8. A computer-readable storage medium, characterized in that: Used to store computer programs; when the computer programs are executed by a processor, the steps of the random clock generation method for resisting clock attacks as described in any one of claims 1-3 are implemented.
9. A computer program product, comprising computer executable instructions or a computer program, which, when executed by a processor, implements the steps of the random clock generation method for resisting clock attacks as described in any one of claims 1 to 3.
Citation Information
Cited By
Random clock generation device and clock signal output method
CN119336125A
