True random number generator and true random number generation method

By adjusting the working state of the phase-locked loop to make it enter the out-of-lock state, and using the out-of-lock state of the phase-locked loop to generate true random numbers, the problem of excessive chip occupation area caused by high hardware structure requirements in the existing technology is solved, and a high Quality true random number output.

CN118363565BActive Publication Date: 2024-08-27SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410789919.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-08-27
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

In order to ensure the quality and output performance of true random numbers, existing true random number generators have high requirements on hardware structure, resulting in a chip that occupies an excessively large area and lacks effective solutions.

Method used

The working state of the phase-locked loop is adjusted through the random control module to make it enter the out-of-lock state, thereby utilizing the characteristics of the out-of-lock state of the phase-locked loop to generate true random numbers, and the random control module is used to output the first clock signal to the phase-locked loop, The phase-locked loop outputs low-frequency and high-frequency clock signals to the flip-flop in the out-of-lock state, and the flip-flop processes these clock signals to generate true random numbers.

Benefits of technology

While occupying less hardware resources, it achieves high-quality true random number output and solves the problem of excessive chip occupation area caused by high hardware structure requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363565B
    Figure CN118363565B
Patent Text Reader

Abstract

An embodiment of the present application provides a true random number generator and a method for generating true random numbers, wherein the true random number generator includes: a random control module, used to output a first clock signal to a phase-locked loop, wherein the first clock signal is used to adjust the working state of the phase-locked loop; the phase-locked loop is connected to the random control module, and is used to output a second clock signal and a third clock signal to a trigger when it is determined that the working state is an unlocked state according to the first clock signal, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal; the trigger is connected to the phase-locked loop, and is used to process the second clock signal and the third clock signal to generate a first true random number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and in particular, to a true random number generator and a method for generating true random numbers. Background Art

[0002] The typical structure of a true random number generator usually consists of three modules: noise source, sampling circuit, and algorithm post-processing. The noise source is the source of random numbers, and its quality (randomness, independence, unpredictability, etc.) is the key to the quality of true random numbers. When the noise source has serious defects, the algorithm post-processing cannot make up for the defects, resulting in output data that cannot meet the requirements. The sampling circuit is used to collect data from the noise source, and the algorithm post-processing is generally implemented using a specific structure (linear feedback shift register) or algorithm (such as hash algorithm) to improve the quality of random numbers.

[0003] Regarding the related technology, in order to ensure the quality and output performance of true random numbers, the existing true random number generator has high requirements on the hardware structure of the true random number generator, which leads to the technical problem that the chip occupies too large an area, and no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a true random number generator and a method for generating true random numbers, so as to at least solve the problem that the existing true random number generator in the related art has high requirements on the hardware structure of the true random number generator in order to ensure the quality and output performance of the true random number, resulting in excessive chip area occupation.

[0005] According to one embodiment of the present application, a true random number generator is provided, including: a random control module, used to output a first clock signal to a phase-locked loop, wherein the first clock signal is used to adjust the working state of the phase-locked loop; the phase-locked loop, connected to the random control module, and used to output a second clock signal and a third clock signal to a trigger when it is determined that the working state is an unlocked state according to the first clock signal, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal; the trigger, connected to the phase-locked loop, is used to process the second clock signal and the third clock signal to generate a first true random number.

[0006] In an exemplary embodiment, the random control module includes: a processor, connected to an oscillator, for receiving an original clock signal output by the oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, and outputting the fourth clock signal to a selector, wherein the oscillator is connected to the true random number generator; the selector, selectively connected to the processor and the oscillator, for selectively receiving the fourth clock signal or the original clock signal, obtaining the first clock signal, and outputting the first clock signal to the phase-locked loop, wherein the first clock signal includes one of the following: the fourth clock signal, the original clock signal.

[0007] In an exemplary embodiment, the processor includes: a first buffer, used to delay the original clock signal and send it to an inverter; the inverter, connected to the first buffer, is used to perform phase flip processing on the original clock signal and output the obtained fifth clock signal to a first XOR gate; the first XOR gate, connected to the inverter and the oscillator, is used to perform an XOR operation on the received original clock signal and the fifth clock signal, and output the obtained sixth clock signal to a second buffer; the second buffer, connected to the first XOR gate, is used to delay the sixth clock signal and send it to an AND gate; the AND gate, connected to the second buffer and the oscillator, is used to perform an AND gate operation on the received original clock signal and the sixth clock signal, and output the obtained seventh clock signal to a second XOR gate; the second XOR gate, connected to the trigger and the AND gate, is used to receive the second true random number generated by the trigger last time, perform an XOR operation on the second true random number and the seventh clock signal to obtain the fourth clock signal, and output the obtained fourth clock signal to the selector.

[0008] In an exemplary embodiment, the selector includes: a selector switch, used to control the selector to be connected to the second XOR gate when it is determined that the number of true random numbers generated is less than a first preset threshold; and used to control the selector to be connected to the oscillator when it is determined that the number of true random numbers generated is greater than the first preset threshold.

[0009] In an exemplary embodiment, the random control module includes: a processor, connected to an oscillator and the phase-locked loop, for receiving an original clock signal output by the oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, determining the fourth clock signal as the first clock signal, and outputting the first clock signal to the phase-locked loop, wherein the oscillator is connected to the true random number generator.

[0010] In an exemplary embodiment, the processor includes: a first buffer, used to delay the original clock signal and send it to an inverter; the inverter, connected to the first buffer, is used to perform phase flip processing on the original clock signal and output the obtained fifth clock signal to a first XOR gate; the first XOR gate, connected to the inverter and the oscillator, is used to perform an XOR operation on the received original clock signal and the fifth clock signal, and output the obtained sixth clock signal to a second buffer; the second buffer, connected to the first XOR gate, is used to delay the sixth clock signal and send it to an AND gate; the AND gate, connected to the second buffer and the oscillator, is used to perform an AND gate operation on the received original clock signal and the sixth clock signal, and output the obtained seventh clock signal to a second XOR gate; the second XOR gate, connected to the trigger, the AND gate and the phase-locked loop, is used to receive the second true random number generated by the trigger last time, perform an XOR operation on the second true random number and the seventh clock signal to obtain the fourth clock signal, and output the obtained fourth clock signal to the phase-locked loop.

[0011] In an exemplary embodiment, the trigger is further used to send the first true random number to the second XOR gate; the second XOR gate is further used to generate an eighth clock signal according to the first true random number, wherein the eighth clock signal is used to generate a third true random number.

[0012] In an exemplary embodiment, a ratio of a frequency of the third clock signal to a frequency of the second clock signal is greater than a second preset threshold.

[0013] In an exemplary embodiment, the phase-locked loop includes: a phase detector, which is used to generate an error signal between the first clock signal and the output signal of the phase-locked loop, and output the error signal to a filter; the filter, which is connected to the phase detector, is used to filter the error signal and output the processed error signal to a voltage-controlled oscillator; the voltage-controlled oscillator, which is connected to the filter, is used to adjust the frequency of the output signal of the phase-locked loop according to the processed error signal.

[0014] In an exemplary embodiment, the phase detector is further used to determine that the phase-locked loop is in the unlocked state when the error signal indicates that the phase difference between the first clock signal and the output signal is greater than a third preset threshold; and to determine that the phase-locked loop is in the locked state when the error signal indicates that the phase difference is less than or equal to the third preset threshold.

[0015] In an exemplary embodiment, the phase-locked loop is also used to determine a first output clock and a second output clock from multiple output clocks according to preset configuration parameters when it is determined that the phase-locked loop is in the unlocked state, and control the first output clock to output the second clock signal, and control the second output clock to output the third clock signal, wherein the preset configuration parameters are used to indicate the frequencies of the third clock signal and the second clock signal, and the phase-locked loop includes the multiple output clocks.

[0016] In an exemplary embodiment, the trigger includes: a data input terminal connected to the first output clock, for receiving the second clock signal output by the first output clock; a clock input terminal connected to the second output clock, for receiving the third clock signal output by the second output clock, and sampling the third clock signal according to the second clock signal to generate the first true random number; and an output terminal connected to the clock input terminal, for outputting the first true random number.

[0017] According to another embodiment of the present application, a method for generating a true random number is provided, including: inputting a first clock signal into a phase-locked loop, wherein the first clock signal is used to adjust the working state of the phase-locked loop; when it is determined that the working state is an unlocked state according to the first clock signal, inputting a second clock signal and a third clock signal output by the phase-locked loop into a trigger, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal; and processing the second clock signal and the third clock signal by the trigger to generate a first true random number.

[0018] In an exemplary embodiment, inputting a first clock signal into a phase-locked loop includes: receiving an original clock signal output by an oscillator, performing random control processing on the original clock signal to obtain a fourth clock signal, and inputting the fourth clock signal into a selector, wherein the oscillator is connected to the true random number generator; determining the first clock signal from the fourth clock signal and the original clock signal by the selector, and inputting the first clock signal into the phase-locked loop.

[0019] In an exemplary embodiment, inputting a first clock signal into a phase-locked loop includes: receiving an original clock signal output by an oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, wherein the oscillator is connected to the true random number generator; determining the fourth clock signal as the first clock signal, and inputting the first clock signal into the phase-locked loop.

[0020] In an exemplary embodiment, an original clock signal output by an oscillator is received, and the original clock signal is subjected to random control processing to obtain a fourth clock signal, including: delaying the original clock signal and sending it to an inverter through a first buffer; performing phase flip processing on the original clock signal through the inverter, and sending the obtained fifth clock signal to a first XOR gate; performing an XOR operation on the original clock signal and the fifth clock signal through the first XOR gate, and sending the obtained sixth clock signal to a second buffer; delaying the sixth clock signal and sending it to an AND gate through the second buffer; performing an AND gate operation on the original clock signal and the sixth clock signal through the AND gate, and outputting the obtained seventh clock signal to a second XOR gate; performing an XOR operation on a second true random number and the seventh clock signal through the second XOR gate to obtain the fourth clock signal.

[0021] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0022] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0023] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.

[0024] The present application provides a true random number generator, comprising a random control module, a phase-locked loop and a trigger, wherein the random control module outputs a first clock signal for adjusting the working state of the phase-locked loop to the phase-locked loop, and when the phase-locked loop determines that the working state of the phase-locked loop is an unlocked state according to the first clock signal, the phase-locked loop outputs a second clock signal which is a low-frequency clock signal and a third clock signal which is a high-frequency clock signal to the trigger; and the trigger processes the second clock signal and the third clock signal to generate a first true random number; by using the true random number generator, the quality of the clock signal input to the phase-locked loop is adjusted through the random control module, so that the phase-locked loop enters an unlocked state, thereby generating true random numbers by utilizing the characteristics of the unlocked state of the phase-locked loop, and achieving the output of higher-quality true random numbers while occupying fewer hardware resources; thereby solving the technical problem that the existing true random number generator in the related art has high requirements on the hardware structure of the true random number generator in order to ensure the quality and output performance of the true random number, resulting in excessive chip occupation area. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a hardware structure block diagram of a true random number generator according to an embodiment of the present application;

[0026] Figure 2 is a structural diagram of a true random number generator according to the present application;

[0027] Figure 3 is a schematic structural diagram of an optional random control module according to an embodiment of the present application;

[0028] Figure 4 is a schematic diagram of the structure of an optional processor according to an embodiment of the present application;

[0029] Figure 5 is an optional signal waveform diagram according to an embodiment of the present application;

[0030] Figure 6 is a schematic structural diagram of another optional random control module according to an embodiment of the present application;

[0031] Figure 7 is a schematic diagram of the structure of another optional processor according to an embodiment of the present application;

[0032] Figure 8 is a structural block diagram of a phase-locked loop according to an embodiment of the present application;

[0033] Fig. 9 is a schematic structural diagram of an optional true random number generator according to an embodiment of the present application;

[0034] Fig.10 It is a flowchart of a method for generating true random numbers according to an embodiment of the present application. DETAILED DESCRIPTION

[0035] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0037] The method embodiments provided in the embodiments of the present application can be executed in a true random number generator or a similar computing device. Taking running on a true random number generator as an example, Figure 1 1 is a hardware structure block diagram of a true random number generator of a true random number generation method of an embodiment of the present application. Figure 1 As shown, the true random number generator may include one or more ( Figure 1Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the true random number generator may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned true random number generator. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0038] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining the mapping relationship in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the true random number generator via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0039] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the true random number generator. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0040] In this embodiment, a true random number generator is provided. Figure 2 is a structural diagram of a true random number generator according to an embodiment of the present application, such as Figure 2 As shown, the true random number generator 20 comprises:

[0041] A random control module 22, configured to output a first clock signal to a phase-locked loop 24, wherein the first clock signal is used to adjust a working state of the phase-locked loop 24;

[0042] The phase-locked loop 24 is connected to the random control module 22, and is used to output a second clock signal and a third clock signal to the trigger 26 when the working state is determined to be an unlocked state according to the first clock signal, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal;

[0043] The trigger 26 is connected to the phase-locked loop 24, and is used to process the second clock signal and the third clock signal to generate a first true random number.

[0044] The above-mentioned true random number generator includes a random control module, a phase-locked loop and a trigger. The random control module outputs a first clock signal used for adjusting the working state of the phase-locked loop to the phase-locked loop. When the phase-locked loop determines that the working state of the phase-locked loop is an unlocked state according to the first clock signal, the phase-locked loop outputs a second clock signal which is a low-frequency clock signal and a third clock signal which is a high-frequency clock signal to the trigger; and the trigger processes the second clock signal and the third clock signal to generate a first true random number. The above-mentioned true random number generator is adopted, and the quality of the clock signal input to the phase-locked loop is adjusted through the random control module, so that the phase-locked loop enters an unlocked state, thereby utilizing the characteristics of the phase-locked loop unlocked state to generate true random numbers, and realizes the output of higher-quality true random numbers while occupying less hardware resources; thereby solving the technical problem that the existing true random number generator in the related art has high requirements on the hardware structure of the true random number generator in order to ensure the quality and output performance of the true random number, resulting in excessive chip occupation area.

[0045] When integrating and using a chip, the PLL (phase-locked loop) can be used in the following two ways:

[0046] 1. It is not only used to generate true random numbers, but also to generate other clocks for use by other modules. At this time, random numbers are generated first (by controlling the selector to output the D signal (i.e. the fourth clock signal mentioned above)). After obtaining the required number of true random numbers, the selector switch is switched to the A signal (i.e. the original clock signal mentioned above) for output. At this time, under the influence of the A signal, the PLL can be locked and work normally;

[0047] 2. Only used to generate true random numbers, that is, only two sets of output clocks are generated, and other required clocks are realized by other PLLs or clock processing units. This method requires an additional set of PLL resources, but true random numbers can be generated at any time, and can be used at any time, and the average rate of generating random numbers is higher.

[0048] Corresponding to the application scenarios of the above two PLLs, the embodiments of the present application propose two optional random control module structures, including:

[0049] In a first optional embodiment, the structure of the random control module 22 is as follows: Figure 3 As shown, it includes: a processor 222, connected to the oscillator 28, for receiving the original clock signal output by the oscillator 28, and performing random control processing on the original clock signal to obtain a fourth clock signal, and outputting the fourth clock signal to the selector 224, wherein the oscillator 28 is connected to the true random number generator 20; the selector 224 is selectively connected to the processor 222 and the oscillator 28, for selectively receiving the fourth clock signal or the original clock signal, obtaining the first clock signal, and outputting the first clock signal to the phase-locked loop 24, wherein the first clock signal includes one of the following: the fourth clock signal, the original clock signal.

[0050] like Figure 3 As shown, after the original clock signal is input into the random control module, it is output to the processor and the selector respectively. The processor performs random control processing on it to obtain a fourth clock signal. The selector chooses to output the fourth clock signal or the original clock signal according to different needs. The fourth clock signal can put the phase-locked loop in an unlocked state, while the original clock signal can put the phase-locked loop in a locked state, thereby allowing the phase-locked loop to be flexibly applied to different scenarios.

[0051] It should be noted that a phase locked loop (PLL) is a negative feedback control system that uses the voltage generated by phase synchronization to tune a voltage controlled oscillator to generate a target frequency. It is often used in chips (integrated circuits) to generate clocks of multiple target frequencies. The phase locked loop consists of a phase detector (PD), a filter (LF) and a voltage controlled oscillator (VCO) as a forward path, and a frequency divider as a feedback path for the frequency phase. When the phase locked loop is working, it can generally be divided into two states:

[0052] Locked state, the entire loop has reached a stable state of the input signal phase. It means that the output signal phase is equal to the input signal phase or there is a fixed phase difference between the two, but the frequency is equal. In the locked state, the voltage control signal of the voltage controlled oscillator is close to flat.

[0053] The unlocked state is a stable state in which the frequency difference between the feedback signal of the loop and the input signal of the phase-locked loop cannot be zero. When there is a problem with the structural design of the loop, or the input signal exceeds the application range of the phase-locked loop, it will enter the unlocked state. This state means that the loop is not working properly. At this time, the output signal is in an uncertain state with an uncertain period and jitter.

[0054] Furthermore, the following combination Figure 4 right Figure 3 The working principle of the processor 222 in the random control module is described as follows: Figure 4 As shown, the processor 222 includes the following structural units:

[0055] A first buffer 41, used for delaying the original clock signal and sending it to the inverter 42;

[0056] The inverter 42 is connected to the first buffer 41, and is used to perform phase inversion processing on the original clock signal, and output the obtained fifth clock signal to the first XOR gate 43;

[0057] The first XOR gate 43 is connected to the inverter 42 and the oscillator 28, and is used to perform an XOR operation on the received original clock signal and the fifth clock signal, and output the obtained sixth clock signal to the second buffer 44;

[0058] The second buffer 44 is connected to the first XOR gate 43, and is used to delay the sixth clock signal and send it to the AND gate 45;

[0059] The AND gate 45 is connected to the second buffer 44 and the oscillator 28, and is used to perform an AND gate operation on the received original clock signal and the sixth clock signal, and output the obtained seventh clock signal to the second XOR gate 46;

[0060] The second XOR gate 46 is connected to the trigger 26 and the AND gate 45, and is used to receive the second true random number generated by the trigger 26 last time, perform an XOR operation on the second true random number and the seventh clock signal to obtain the fourth clock signal, and output the obtained fourth clock signal to the selector 224.

[0061] In order to adjust the irregularities of the input clock signal period, phase, clock jitter, etc., the most basic digital logic units such as buffers (delay units), inverters, XOR gates and AND gates are used, such as Figure 4 As shown, a signal A (i.e. the above-mentioned original clock signal) is input, and signal A continuously passes through a buffer (i.e. the above-mentioned first buffer) and an inverter to output A_1 (i.e. the above-mentioned first five clock signals). At this time, the signal has undergone a 180° phase flip, and a certain delay is generated due to the buffer. Afterwards, A_1 and A pass through an XOR gate (i.e. the above-mentioned first XOR gate) to perform an XOR operation. At this time, the output signal (i.e. the above-mentioned sixth clock signal) generates a burr signal, and the output B signal (i.e. the above-mentioned sixth clock signal) passes through a buffer again, and the B signal is then subjected to an AND gate operation with the A signal to output the C signal (i.e. the above-mentioned seventh clock signal); then the C signal is subjected to an XOR operation with the I signal (i.e. the above-mentioned second true random number), and the D signal (i.e. the above-mentioned fourth clock signal) is output, and finally the D signal is output to the selector. During the processing, the signal waveforms of each signal are shown as follows. Figure 5As shown, the D signal is already a signal containing glitches, phase and period irregularities, and cannot meet the PLL's requirements for input signals. At this time, after the D signal is input into the PLL, the PLL will operate in an unlocked state.

[0062] Further, Figure 3 The selector 224 in the random control module shown includes: a selector switch, which is used to control the selector to be connected to the second XOR gate when it is determined that the number of true random numbers generated is less than a first preset threshold; and is used to control the selector to be connected to the oscillator when it is determined that the number of true random numbers generated is greater than the first preset threshold.

[0063] like Figure 4 As shown, both the D signal and the A signal are input into the selector 224 and output through the selector 224. When the system needs to generate a true random number, the selector switch selects to be connected to the second XOR gate 46, receives the D signal output by the second XOR gate 46 and outputs it; when the system needs the PLL to work stably and normally, the selector switch selects to be connected to the oscillator 28 and outputs the A signal. At this time, the random control module realizes the direct output of the input source signal. An optional control method can specify the number of true random numbers that need to be generated (i.e., the first preset threshold value mentioned above). When the number is not met, the selector switch is always connected to the second XOR gate. When the number is met, the selector switch is switched to be connected to the oscillator.

[0064] Optionally, the switching of the selector switch may be controlled by other control methods, such as directly sending a control signal for adjustment, etc., which is not limited in the present application.

[0065] In a second optional embodiment, the structure of the random control module 22 is as follows: Figure 6 The system shown includes: a processor 222, connected to the oscillator 28 and the phase-locked loop 24, for receiving the original clock signal output by the oscillator 28, and performing random control processing on the original clock signal to obtain a fourth clock signal, determining the fourth clock signal as the first clock signal, and outputting the first clock signal to the phase-locked loop 24, wherein the oscillator 28 is connected to the true random number generator 20.

[0066] If the phase-locked loop is used to generate true random numbers, the random control module connected thereto does not need to output the original clock signal to put the PLL in a locked state, but only needs to output the fourth clock signal to put the PLL in an unlocked state. Therefore, the random control module does not need to be provided with a selector, but only needs to be provided with a processor. This improves the efficiency of the true random number generator in generating true random numbers.

[0067] Optionally, the structure of the processor 222 is as follows: Figure 7 As shown, including:

[0068] A first buffer 71, used for delaying the original clock signal and sending it to the inverter 72;

[0069] The inverter 72 is connected to the first buffer 71, and is used to perform phase inversion processing on the original clock signal, and output the obtained fifth clock signal to the first XOR gate 73;

[0070] The first XOR gate 73 is connected to the inverter 72 and the oscillator 28, and is used to perform an XOR operation on the received original clock signal and the fifth clock signal, and output the obtained sixth clock signal to the second buffer 74;

[0071] The second buffer 74 is connected to the first XOR gate 73 and is used to delay the sixth clock signal and send it to the AND gate 75;

[0072] The AND gate 75 is connected to the second buffer 74 and the oscillator 28, and is used to perform an AND gate operation on the received original clock signal and the sixth clock signal, and output the obtained seventh clock signal to the second XOR gate 76;

[0073] The second XOR gate 76 is connected to the trigger 26, the AND gate 75 and the phase-locked loop 24, and is used to receive the second true random number generated by the trigger 26 last time, perform an XOR operation on the second true random number and the seventh clock signal to obtain the fourth clock signal, and output the obtained fourth clock signal to the phase-locked loop 24.

[0074] In order to adjust the irregularities of the input clock signal period, phase, clock jitter, etc., the most basic digital logic units such as buffers (delay units), inverters, XOR gates and AND gates are used, such as Figure 7 As shown, a signal A (i.e. the original clock signal mentioned above) is input, and signal A continuously passes through a buffer (i.e. the first buffer mentioned above) and an inverter to output A_1 (i.e. the first five clock signals mentioned above). At this time, the signal has undergone a 180° phase flip, and a certain delay is generated due to the buffer. Afterwards, A_1 and A pass through an XOR gate (i.e. the first XOR gate mentioned above) to perform an XOR operation. At this time, the output signal (i.e. the sixth clock signal mentioned above) generates a burr signal, and the output B signal (i.e. the sixth clock signal mentioned above) passes through a buffer again, and the B signal is then subjected to an AND gate operation with the A signal to output the C signal (i.e. the seventh clock signal mentioned above); after that, the C signal is subjected to an XOR operation with the I signal (i.e. the second true random number mentioned above), and the D signal (i.e. the fourth clock signal mentioned above) is output, and finally the D signal is output to the phase-locked loop. During the processing, the signal waveforms of each signal are shown in the following figure. Figure 5As shown, the D signal is already a signal containing glitches, irregular phases and cycles, and cannot meet the PLL's requirements for input signals. At this time, after the D signal is input to the PLL, the PLL will work in an unlocked state. In this embodiment, in order to adapt to the structure of the PLL dedicated to generating true random numbers, no selector is set in the random control module, so the D signal finally processed will be directly output to the phase-locked loop, and the phase-locked loop will quickly complete the generation of true random numbers, thereby improving the generation efficiency.

[0075] Furthermore, the trigger 26 is also used to send the first true random number to the second XOR gate (46 or 76); the second XOR gate (46 or 76) is also used to generate an eighth clock signal according to the first true random number, wherein the eighth clock signal is used to generate a third true random number.

[0076] While generating and outputting the first true random number, the trigger also feeds the first true random number back to the second XOR gate in the random control module for use in the next generation process of the third true random number, thereby forming a "pipeline" that uses the randomness of the previously generated true random number to assist in the next generation of true random numbers, thereby enhancing the quality of the generated true random numbers.

[0077] Optionally, a frequency ratio of the third clock signal to the second clock signal is greater than a second preset threshold.

[0078] By specifying the frequency ratio between the second clock signal and the third clock signal, the difference between the two clock signals is made large enough, so that when one of the clock signals is used to sample the other clock signal, the obtained true random number is more random, thereby obtaining a true random number.

[0079] Optionally, the structure of the phase-locked loop 24 is as follows: Figure 8 As shown, including:

[0080] a phase detector 82, configured to generate an error signal between the first clock signal and the output signal of the phase-locked loop, and output the error signal to a filter 84;

[0081] The filter 84 is connected to the phase detector 82 and is used to filter the error signal and output the processed error signal to the voltage controlled oscillator 86;

[0082] The voltage controlled oscillator 86 is connected to the filter 84 and is used to adjust the frequency of the output signal of the phase locked loop according to the processed error signal.

[0083] The phase detector is the core component of the phase-locked loop. Its function is to compare the input signal with the output signal from the voltage-controlled oscillator and generate an error signal proportional to the frequency difference and phase difference between the two signals. When the two signals are in phase, the phase detector outputs a constant. When the two signal frequencies are inconsistent, the error signal will change, driving the voltage-controlled oscillator to adjust the frequency. The filter is another key component of the phase-locked loop. It filters and smoothes the error signal generated by the phase detector. The design of the filter will affect the dynamic performance of the phase-locked loop, such as stability, tracking speed and noise performance. The voltage-controlled oscillator is an oscillator whose output frequency can be adjusted by a control voltage. In the phase-locked loop, the voltage-controlled oscillator adjusts its output frequency according to the control signal output by the filter until it is consistent with the input signal frequency. The frequency response and stability of the voltage-controlled oscillator have a great influence on the overall performance of the phase-locked loop.

[0084] Furthermore, the phase detector 82 is also used to determine that the phase-locked loop is in the unlocked state when the error signal indicates that the phase difference between the first clock signal and the output signal is greater than a third preset threshold; and to determine that the phase-locked loop is in the locked state when the error signal indicates that the phase difference is less than or equal to the third preset threshold.

[0085] The phase-locked loop determines the current state of the phase-locked loop based on the phase difference and frequency difference between the two signals indicated by the error signal. If the phase difference and frequency difference indicated by the error signal are greater than a third preset threshold, it is determined that the phase-locked loop is in an unlocked state; if they are less than or equal to the third preset threshold, it is determined that the phase-locked loop is in a locked state.

[0086] Optionally, the third preset thresholds corresponding to the phase difference and the frequency difference may be the same or different, and this application does not impose any limitation on this.

[0087] Optionally, the phase-locked loop 24 is also used to determine a first output clock and a second output clock from multiple output clocks according to preset configuration parameters when it is determined that the phase-locked loop is in the unlocked state, and control the first output clock to output the second clock signal, and control the second output clock to output the third clock signal, wherein the preset configuration parameters are used to indicate the frequencies of the third clock signal and the second clock signal, and the phase-locked loop includes the multiple output clocks.

[0088] In order to ensure the quality of the output true random numbers, it is necessary to determine the frequencies of the two clock signals output by the phase-locked loop according to the preset configuration parameters, that is, the ratio of the frequencies of the two clock signals must be greater than the second preset threshold. Therefore, it is necessary to select two clocks from the multiple output clocks of the phase-locked loop according to this requirement to output the second clock signal and the third clock signal respectively.

[0089] It should be noted that the above-mentioned second preset threshold can be set to 6, and can also be set to other values ​​according to actual needs, such as 5, 7, etc., and this application does not impose any restrictions on this.

[0090] Optionally, the trigger 26 includes: a data input terminal connected to the first output clock, for receiving the second clock signal output by the first output clock; a clock input terminal connected to the second output clock, for receiving the third clock signal output by the second output clock, and sampling the third clock signal according to the second clock signal to generate the first true random number; and an output terminal connected to the clock input terminal, for outputting the first true random number.

[0091] The structure of the trigger 26 is shown in FIG. Fig. 9 As shown (i.e. Fig. 9 The D flip-flop 96 in the example is connected to PLL_OUT_1 (i.e., the second clock signal) of the D flip-flop to the data input of the flip-flop, and to PLL_OUT_2 (i.e., the third clock signal) of the D flip-flop to the clock input of the D flip-flop. A low-frequency clock is used to sample a high-frequency clock. Since PLL unlocking will cause the clock signals output by the two clocks (i.e., the first output clock and the second output clock) to be in an unstable state, when one of the clock signals is used to sample the other, the output value (i.e., the first true random number) is still in an unstable random state, and the output value is the output true random number.

[0092] It should be noted that the sampling of the third clock signal according to the second clock signal can be understood as: the trigger reads the value of another clock signal on a specific edge of one of the clock signals and stores this value. When a clock signal is used in a trigger to sample another clock signal, the clock control characteristics of the trigger are actually utilized. This technology can be used to implement various functions, such as signal synchronization, data buffering, clock division, etc.

[0093] In related technologies, random number generators are divided into two main types: true random number generator (TRNG) and pseudo random number generator (PRNG). Compared with the PRNG principle, which is based on a fixed algorithm, TRNG utilizes the randomness of physical processes. The entropy source is generally uncertain, random events or some physical phenomena, such as thermal noise, circuit jitter or atomic fission, etc. Random number sequences are generated through these unpredictable and uncontrollable phenomena in nature. This kind of random number has no definite trend and significant regularity, and is not easy to be predicted and attacked, but it is also not easy to control, and its security is generally higher than that of pseudo random numbers.

[0094] An ideal TRNG is a process that takes values ​​from discrete random variables that are independent and uniformly distributed.

[0095] The typical structure of a true random number generator usually consists of three modules: a noise source (i.e., entropy source), a sampling circuit, and an algorithm post-processing. As the source of random numbers, the quality of the entropy source (randomness, independence, unpredictability, etc.) is the key to the quality of true random numbers. When there are serious defects in the entropy source, the algorithm post-processing cannot make up for the defects, resulting in the output data failing to meet the requirements. On the other hand, when the quality of the entropy source is high, the output requirements of true random numbers can be achieved without using a post-processing algorithm or with a simple post-processing algorithm. The sampling circuit is used to collect data from the entropy source, and the algorithm post-processing is generally implemented using a specific structure (linear feedback shift register) or algorithm (such as hash algorithm) to improve the quality of random numbers.

[0096] The related art lacks a high-quality entropy source for generating true random numbers, resulting in the need to use a dedicated hardware structure to provide better algorithm post-processing to improve the quality of the generated true random numbers; the present application proposes a true random number generator that utilizes the characteristics of a phase-locked loop unlocked state to generate high-quality true random numbers, thereby solving the problem of excessive chip area occupation in the related art.

[0097] Fig. 9 The overall structure and data processing flow of the true random number generator in the embodiment of the present application are shown as follows: Fig. 9 As shown, including:

[0098] The random control module 92 is used to perform random control processing on the input clock (i.e. the above-mentioned original clock signal), and control the output clock signal (hereinafter referred to as RA_OUT) by randomly adjusting factors such as the clock period and phase, so that the subsequent PLL is in an unlocked or locked state;

[0099] PLL, phase-locked loop 94, a PLL can generally be configured to generate multiple groups of output signals. In this embodiment, it is necessary to output two groups of clock signals for generating subsequent true random numbers, wherein PLL output clock 2 (hereinafter referred to as PLL_OUT_2) is a low-frequency clock signal (i.e., the above-mentioned second clock signal), and PLL output clock 1 (hereinafter referred to as PLL_OUT_1) is a high-frequency clock signal (i.e., the above-mentioned third clock signal), and the frequency ratio of the two is 1:6 or more, that is, the high-frequency clock frequency is at least six times the low-frequency clock frequency (i.e., the above-mentioned second preset threshold value), and other output ports (hereinafter referred to as PLL_OUT_OT) can be used by other modules in the chip;

[0100] 3. D flip-flop 96, connects PLL_OUT_1 to the data input terminal of the D flip-flop (i.e., the D terminal of the D flip-flop), connects PLL_OUT_2 to the clock input terminal of the D flip-flop (i.e., the CLK terminal of the D flip-flop), and uses a low-frequency clock to sample a high-frequency clock. Since PLL unlocking will cause both clocks to be in an unstable state, when one of the clocks is used to sample the other, the output value is still an unstable random state, and the output value is the output true random number (i.e., the first true random number mentioned above); while outputting the generated true random number, it is also output to the second XOR gate in the random control module, so that the random control module can use it to generate the next true random number.

[0101] based on Fig. 9 When the true random number generator shown generates true random numbers, the data processing flow includes:

[0102] 1. Clock input. In SOC chips, an external crystal oscillator is often used to input the clock.

[0103] Optionally, an external crystal oscillator can be used.

[0104] 2. Random control module: The clock signal generated by the external crystal oscillator (i.e., the above-mentioned original clock signal) first enters the random control module. The random control module can implement two processing methods for the input signal and select one of them for output. The first method is to adjust the period, phase, and signal quality (mainly to generate burrs) of the input clock so that it cannot meet the requirements of the general PLL for the input clock, so that the PLL works in a locked state, that is, an unstable state; the second method is to not process the input clock in any way and directly output it after passing through the selector. At this time, the clock is in a stable state, which can make the subsequent PLL work in a stable state.

[0105] 3. PLL frequency division processing: PLL processes the input clock through the set allocation parameters and outputs the corresponding clock. Two of the output clocks are selected for the subsequent generation of true random numbers, namely PLL_OUT_1 and PLL_OUT_2. Other output ports can be configured according to actual usage requirements or not. This PLL is only used to generate true random numbers.

[0106] 4. Use a D flip-flop for sampling and use the PLL_OUT_2 low-frequency clock to sample the PLL_OUT_1 high-frequency clock.

[0107] 5. The sampled data is output as a true random number from the entropy source to the next stage, and the signal is also passed to the random control module as one of the factors in signal processing.

[0108] pass Fig. 9The structure shown in the figure, the embodiment of the present application proposes a design method and architecture of a true random number generator based on the PLL unlocked state, which uses less hardware resources and lower power consumption to achieve the output of higher quality true random numbers. By adjusting the period, phase and signal quality of the PLL input clock signal, the PLL is controlled to switch between the locked and unlocked states, and true random numbers can be obtained in the unlocked state.

[0109] In this embodiment, a method for generating a true random number is provided, which is applied to a true random number generator 20. Fig.10 is a flow chart of a method for generating true random numbers according to an embodiment of the present application, such as Fig.10 As shown, the process includes the following steps:

[0110] Step S102, inputting a first clock signal into a phase-locked loop, wherein the first clock signal is used to adjust a working state of the phase-locked loop;

[0111] Step S104, when it is determined according to the first clock signal that the working state is an unlocked state, inputting the second clock signal and the third clock signal output by the phase-locked loop into a trigger, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal;

[0112] Step S106: Process the second clock signal and the third clock signal through the trigger to generate a first true random number.

[0113] The present application provides a method for generating true random numbers, wherein a first clock signal for adjusting the working state of a phase-locked loop is output to the phase-locked loop, and when it is determined that the working state of the phase-locked loop is an unlocked state according to the first clock signal, a second clock signal which is a low-frequency clock signal and a third clock signal which is a high-frequency clock signal are output to a trigger; finally, the second clock signal and the third clock signal are processed by the trigger to generate a first true random number; the method for generating true random numbers is adopted to adjust the quality of the clock signal input to the phase-locked loop so that the phase-locked loop enters an unlocked state, thereby generating true random numbers by utilizing the characteristics of the unlocked state of the phase-locked loop, and achieving the output of true random numbers of higher quality while occupying fewer hardware resources; thereby solving the technical problem that the existing true random number generator in the related art has high requirements on the hardware structure of the true random number generator in order to ensure the quality and output performance of the true random number, resulting in excessive chip occupation area.

[0114] Optionally, inputting the first clock signal into a phase-locked loop includes: receiving an original clock signal output by an oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, and inputting the fourth clock signal into a selector, wherein the oscillator is connected to the true random number generator; determining the first clock signal from the fourth clock signal and the original clock signal by the selector, and inputting the first clock signal into the phase-locked loop.

[0115] like Figure 3 As shown, after the original clock signal is input into the random control module, it is output to the processor and the selector respectively. The processor performs random control processing on it to obtain a fourth clock signal. The selector chooses to output the fourth clock signal or the original clock signal according to different needs. The fourth clock signal can put the phase-locked loop in an unlocked state, while the original clock signal can put the phase-locked loop in a locked state, thereby allowing the phase-locked loop to be flexibly applied to different scenarios.

[0116] It should be noted that a phase locked loop (PLL) is a negative feedback control system that uses the voltage generated by phase synchronization to tune the voltage controlled oscillator to generate the target frequency. It is often used in chips (integrated circuits) to generate clocks of multiple target frequencies. The PLL consists of a phase detector (PD), a filter (LF) and a voltage controlled oscillator (VCO) to form a forward path, and a frequency divider to form a frequency phase feedback path. When the PLL is working, it can generally be divided into two states:

[0117] Locked state, the entire loop has reached a stable state of the input signal phase. It means that the output signal phase is equal to the input signal phase or there is a fixed phase difference between the two, but the frequency is equal. In the locked state, the voltage control signal of the voltage controlled oscillator is close to flat.

[0118] The unlocked state is a stable state in which the frequency difference between the feedback signal of the loop and the input signal of the phase-locked loop cannot be zero. When there is a problem with the structural design of the loop, or the input signal exceeds the application range of the phase-locked loop, it will enter the unlocked state. This state means that the loop is not working properly. At this time, the output signal is in an uncertain state with an uncertain period and jitter.

[0119] Optionally, inputting the first clock signal into the phase-locked loop includes: receiving an original clock signal output by an oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, wherein the oscillator is connected to the true random number generator; determining the fourth clock signal as the first clock signal, and inputting the first clock signal into the phase-locked loop.

[0120] If the phase-locked loop is used to generate true random numbers, the random control module connected thereto does not need to output the original clock signal to put the PLL in a locked state, but only needs to output the fourth clock signal to put the PLL in an unlocked state. Therefore, the random control module does not need to be provided with a selector, but only needs to be provided with a processor. This improves the efficiency of the true random number generator in generating true random numbers.

[0121] Optionally, an original clock signal output by an oscillator is received, and the original clock signal is subjected to random control processing to obtain a fourth clock signal, including: delaying the original clock signal and sending it to an inverter through a first buffer; performing phase flip processing on the original clock signal through the inverter, and sending the obtained fifth clock signal to a first XOR gate; performing an XOR operation on the original clock signal and the fifth clock signal through the first XOR gate, and sending the obtained sixth clock signal to a second buffer; delaying the sixth clock signal and sending it to an AND gate through the second buffer; performing an AND gate operation on the original clock signal and the sixth clock signal through the AND gate, and outputting the obtained seventh clock signal to a second XOR gate; performing an XOR operation on a second true random number and the seventh clock signal through the second XOR gate to obtain the fourth clock signal.

[0122] In order to adjust the irregularities of the input clock signal period, phase, clock jitter, etc., the most basic digital logic units such as buffers (delay units), inverters, XOR gates and AND gates are used, such as Figure 4 or Figure 7 As shown, a signal A (i.e. the original clock signal mentioned above) is input, and signal A continuously passes through a buffer (i.e. the first buffer mentioned above) and an inverter to output A_1 (i.e. the first five clock signals mentioned above). At this time, the signal has undergone a 180° phase flip, and a certain delay is generated due to the buffer. Afterwards, A_1 and A pass through an XOR gate (i.e. the first XOR gate mentioned above) to perform an XOR operation. At this time, the output signal (i.e. the sixth clock signal mentioned above) generates a burr signal, and the output B signal (i.e. the sixth clock signal mentioned above) passes through a buffer again, and the B signal is then subjected to an AND gate operation with the A signal to output the C signal (i.e. the seventh clock signal mentioned above); after that, the C signal is subjected to an XOR operation with the I signal (i.e. the second true random number mentioned above), and the D signal (i.e. the fourth clock signal mentioned above) is output, and finally the D signal is output to the phase-locked loop. During the processing, the signal waveforms of each signal are shown in the following figure. Figure 5As shown, the D signal is already a signal containing glitches, irregular phases and cycles, and cannot meet the PLL's requirements for input signals. At this time, after the D signal is input to the PLL, the PLL will work in an unlocked state. In this embodiment, in order to adapt to the structure of the PLL dedicated to generating true random numbers, no selector is set in the random control module, so the D signal finally processed will be directly output to the phase-locked loop, and the phase-locked loop will quickly complete the generation of true random numbers, thereby improving the generation efficiency.

[0123] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0124] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0125] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0126] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0127] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0128] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0129] An embodiment of the present application further provides a computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program product, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.

[0130] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0131] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0132] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A true random number generator, characterized in that: include: A random control module, used for outputting a first clock signal to a phase-locked loop, wherein the first clock signal is used for adjusting a working state of the phase-locked loop; The phase-locked loop is connected to the random control module, and is used to output a second clock signal and a third clock signal to the trigger when the working state is determined to be an unlocked state according to the first clock signal, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal; The trigger is connected to the phase-locked loop and is used to process the second clock signal and the third clock signal to generate a first true random number; Wherein, the random control module includes: a processor connected to the oscillator, configured to receive an original clock signal output by the oscillator, and perform random control processing on the original clock signal to obtain a fourth clock signal, wherein the oscillator is connected to the true random number generator; Wherein, the processor comprises: A first buffer, used for delaying the original clock signal and sending it to the inverter; The inverter is connected to the first buffer and is used to perform phase inversion processing on the original clock signal and output the obtained fifth clock signal to the first XOR gate; The first XOR gate is connected to the inverter and the oscillator, and is used to perform an XOR operation on the received original clock signal and the fifth clock signal, and output the obtained sixth clock signal to the second buffer; The second buffer is connected to the first XOR gate and is used to delay the sixth clock signal and send it to the AND gate; The AND gate is connected to the second buffer and the oscillator, and is used to perform an AND gate operation on the received original clock signal and the sixth clock signal, and output the obtained seventh clock signal to the second XOR gate; The second XOR gate is connected to the trigger and the AND gate, and is used to receive the second true random number generated by the trigger last time, and perform an XOR operation on the second true random number and the seventh clock signal to obtain the fourth clock signal.

2. The true random number generator according to claim 1, characterized in that: The processor is further configured to output the fourth clock signal to the selector; The random control module also includes: The selector is selectively connected to the processor and the oscillator, and is used to select and receive the fourth clock signal or the original clock signal, obtain the first clock signal, and output the first clock signal to the phase-locked loop, wherein the first clock signal includes one of the following: the fourth clock signal, the original clock signal.

3. The true random number generator according to claim 2, characterized in that: The second XOR gate is further used to output the fourth clock signal to the selector.

4. The true random number generator according to claim 3, characterized in that: The selector comprises: A selector switch is used to control the selector to be connected to the second XOR gate when it is determined that the number of true random numbers generated is less than a first preset threshold; and is used to control the selector to be connected to the oscillator when it is determined that the number of true random numbers generated is greater than the first preset threshold.

5. The true random number generator according to claim 1, characterized in that: The processor is connected to the phase-locked loop, and is further configured to determine the fourth clock signal as the first clock signal and output the first clock signal to the phase-locked loop.

6. The true random number generator according to claim 5, characterized in that: The second XOR gate is connected to the phase-locked loop, and is used to output the fourth clock signal to the phase-locked loop.

7. The true random number generator according to claim 3 or 6, characterized in that: The trigger is further used to send the first true random number to the second XOR gate; The second XOR gate is further used to generate an eighth clock signal according to the first true random number, wherein the eighth clock signal is used to generate a third true random number.

8. The true random number generator according to claim 1, characterized in that: A ratio of the frequency of the third clock signal to the frequency of the second clock signal is greater than a second preset threshold.

9. The true random number generator according to claim 1, characterized in that: The phase-locked loop comprises: a phase detector, configured to generate an error signal between the first clock signal and an output signal of the phase-locked loop, and output the error signal to a filter; The filter is connected to the phase detector and is used to filter the error signal and output the processed error signal to the voltage controlled oscillator; The voltage controlled oscillator is connected to the filter and is used to adjust the frequency of the output signal of the phase locked loop according to the processed error signal.

10. The true random number generator according to claim 9, characterized in that: The phase detector is further used to determine that the phase-locked loop is in the unlocked state when the error signal indicates that the phase difference between the first clock signal and the output signal is greater than a third preset threshold; and to determine that the phase-locked loop is in the locked state when the error signal indicates that the phase difference is less than or equal to the third preset threshold.

11. The true random number generator according to claim 10, characterized in that: The phase-locked loop is also used to determine a first output clock and a second output clock from multiple output clocks according to preset configuration parameters when it is determined that the phase-locked loop is in the unlocked state, and control the first output clock to output the second clock signal, and control the second output clock to output the third clock signal, wherein the preset configuration parameters are used to indicate the frequencies of the third clock signal and the second clock signal, and the phase-locked loop includes the multiple output clocks.

12. The true random number generator according to claim 11, characterized in that: The trigger comprises: a data input terminal, connected to the first output clock, and configured to receive the second clock signal output by the first output clock; a clock input terminal connected to the second output clock, configured to receive the third clock signal output by the second output clock, and to sample the third clock signal according to the second clock signal to generate the first true random number; The output end is connected to the clock input end and is used to output the first true random number.

13. A method for generating true random numbers, characterized in that: A true random number generator as claimed in any one of claims 1 to 12, include: Inputting a first clock signal into a phase-locked loop, wherein the first clock signal is used to adjust the working state of the phase-locked loop; In the case where it is determined according to the first clock signal that the working state is an unlocked state, inputting a second clock signal and a third clock signal output by the phase-locked loop into a trigger, wherein the second clock signal is a low-frequency clock signal and the third clock signal is a high-frequency clock signal; The second clock signal and the third clock signal are processed by the flip-flop to generate a first true random number.

14. The method for generating true random numbers according to claim 13, characterized in that: Inputting a first clock signal into a phase-locked loop comprises: Receiving an original clock signal output by an oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, and inputting the fourth clock signal into a selector, wherein the oscillator is connected to the true random number generator; The first clock signal is determined from the fourth clock signal and the original clock signal by the selector, and the first clock signal is input into the phase-locked loop.

15. The method for generating true random numbers according to claim 13, characterized in that: Inputting a first clock signal into a phase-locked loop comprises: receiving an original clock signal output by an oscillator, and performing random control processing on the original clock signal to obtain a fourth clock signal, wherein the oscillator is connected to the true random number generator; The fourth clock signal is determined as the first clock signal, and the first clock signal is input into the phase-locked loop.

16. The method for generating true random numbers according to claim 14 or 15, characterized in that: Receiving an original clock signal output by an oscillator and performing random control processing on the original clock signal to obtain a fourth clock signal, including: Delaying the original clock signal and sending it to the inverter through the first buffer; Performing phase inversion processing on the original clock signal through the inverter, and sending the obtained fifth clock signal to the first XOR gate; Performing an XOR operation on the original clock signal and the fifth clock signal through the first XOR gate, and sending the obtained sixth clock signal to the second buffer; Delaying the sixth clock signal and sending it to the AND gate through the second buffer; Performing an AND gate operation on the original clock signal and the sixth clock signal through the AND gate, and outputting the obtained seventh clock signal to the second XOR gate; The second XOR gate performs an XOR operation on the second true random number and the seventh clock signal to obtain the fourth clock signal.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 13 to 16 when executed by a processor.

18. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 13 to 16 are implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 13 to 16 are implemented.