True random number processing circuit, semiconductor chip, and electronic device
By dynamically calculating the statistical parameter range of true random numbers and combining it with preset requirement information and process parameters, the accuracy problem of true random number quality monitoring is solved, achieving higher monitoring accuracy and anti-attack capability.
Patent Information
- Application Number
- CN202610209096.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-12
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2046-02-12
AI Technical Summary
In existing technologies, when monitoring the quality of true random numbers using fixed preset thresholds, there are problems of false alarms or missed alarms, resulting in poor monitoring accuracy.
By employing threshold calculation circuits, statistical calculation circuits, and quality monitoring circuits, the statistical parameter range of true random numbers is dynamically calculated. Combined with preset demand information and process parameters, the statistical parameter range is dynamically adjusted to improve monitoring accuracy.
It improves the accuracy of true random number quality monitoring, reduces power consumption, and enhances hardware-level protection against side-channel attacks.
Smart Images

Figure CN122240063B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hardware security technology, and in particular to a true random number processing circuit, a semiconductor chip, and an electronic device. Background Technology
[0002] True random numbers, characterized by randomness, unpredictability, and non-reproducibility, are widely used in hardware security. Generated by a true random number generation circuit based on a physical process, the quality of these numbers significantly impacts security performance.
[0003] In existing technologies, the quality of truly random numbers can be monitored in hardware, including: monitoring the ring oscillator information in the truly random number generation circuit through hardware, and determining the quality of the truly random numbers based on the ring oscillator information and a preset threshold. The ring oscillator information includes frequency drift and / or period jitter. When the ring oscillator information is greater than or equal to the preset threshold, it is determined that the truly random number generation circuit is malfunctioning, and the quality of the truly random numbers is poor.
[0004] However, due to factors such as process deviations, temperature and voltage changes, true random numbers have a certain degree of dynamism. Therefore, monitoring with a fixed preset threshold may lead to false alarms or missed alarms, resulting in poor monitoring accuracy. Summary of the Invention
[0005] This application provides a true random number processing circuit, a semiconductor chip, and an electronic device to solve problems in related technologies.
[0006] In a first aspect, embodiments of this application provide a true random number processing circuit, including: a threshold calculation circuit, a statistical calculation circuit, and a quality monitoring circuit; the threshold calculation circuit is used to calculate a range of statistical parameters based on preset requirement information and process parameters of the true random number generation circuit, wherein the preset requirement information includes a preset minimum information entropy and / or a preset minimum throughput; the statistical calculation circuit is used to receive true random numbers and calculate the statistical parameters of the true random numbers; the quality monitoring circuit is connected to the threshold calculation circuit and the statistical calculation circuit, and the quality monitoring circuit is used to determine the quality monitoring result of the true random numbers based on the statistical parameters and the range of statistical parameters.
[0007] Secondly, embodiments of this application provide a semiconductor chip including the true random number processing circuit of the first aspect.
[0008] Thirdly, embodiments of this application provide an electronic device including the semiconductor chip of the second aspect.
[0009] In this embodiment, the true random number processing circuit includes a threshold calculation circuit, a statistical calculation circuit, and a quality monitoring circuit. The threshold calculation circuit is used to calculate a statistical parameter range based on preset requirement information and process parameters of the true random number generation circuit. The preset requirement information includes a preset minimum information entropy and / or a preset minimum throughput. The statistical calculation circuit is used to receive true random numbers and calculate the statistical parameters of the true random numbers. The quality monitoring circuit is connected to the threshold calculation circuit and the statistical calculation circuit, and is used to determine the quality monitoring result of the true random numbers based on the statistical parameters and the statistical parameter range. The statistical parameter range in this embodiment is dynamically generated based on preset requirement information and process parameters. The statistical parameter range corresponding to the preset requirement information can be dynamically adjusted under different processes, resulting in higher accuracy of the statistical parameter range and helping to improve the accuracy of true random number quality monitoring.
[0010] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application, it can be implemented according to the contents of the specification. In order to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of a true random number processing circuit provided in an embodiment of this application; Figure 2 This is a schematic diagram showing the connection relationship between a threshold calculation circuit and related circuits provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a COSO TRNG provided in an embodiment of this application; Figure 4 This is a schematic diagram of a conversion circuit provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a ring oscillator provided in an embodiment of this application; Figure 6 This is a schematic diagram of a dynamic delay circuit provided in an embodiment of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and are not limited in number; for example, a first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In the embodiments of this application, the term "multiple" refers to two or more, and other quantifiers are similar.
[0015] This application's embodiments are applicable to the field of hardware security technology, specifically used to monitor the truly random numbers output by a truly random number generation circuit to determine the quality of the truly random numbers. The quality of a truly random number refers to its randomness and unpredictability; the higher the randomness and unpredictability, the higher the quality of the truly random number. Truly random numbers are widely used in security applications such as cryptographic systems, secure boot, and key generation.
[0016] The quality monitoring of the above-mentioned random numbers can be achieved through both software and hardware methods.
[0017] In the software implementation, a standard statistical test suite is run to periodically verify truly random numbers. This approach relies on the CPU (Central Processing Unit), consumes CPU resources, and affects system performance, making it unsuitable for deployment in lightweight, low-power embedded environments.
[0018] To address the issue of excessive CPU resource consumption, quality monitoring can be implemented via hardware. Specifically, this involves monitoring relevant parameters and preset thresholds of the true random number generation circuit. These parameters can be frequency drift or period jitter. When a relevant parameter is greater than or equal to a preset threshold, the quality of the true random numbers is considered poor. However, this approach uses preset thresholds set based on experience or experimental data, which may contain some deviation, leading to poor monitoring accuracy.
[0019] To address the aforementioned issues, this application proposes a true random number processing circuit to monitor the quality of true random numbers through hardware, avoiding excessive CPU resource consumption. Specifically, the threshold calculation circuit in the true random number processing circuit dynamically calculates the statistical parameter range of the true random numbers based on preset requirement information. The statistical calculation circuit calculates the statistical parameters of the true random numbers, and the quality monitoring circuit combines the statistical parameters and the statistical parameter range to achieve quality monitoring of the true random numbers. In this embodiment, the statistical parameter range is dynamically generated based on preset requirement information and process parameters. The statistical parameter range corresponding to the preset requirement information can be dynamically adjusted under different processes, resulting in higher accuracy of the statistical parameter range and contributing to improved accuracy of true random number quality monitoring.
[0020] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0021] Figure 1 This is a schematic diagram of a true random number processing circuit provided in an embodiment of this application, as shown below. Figure 1 As shown, the above-mentioned true random number processing circuit includes: The system includes a threshold calculation circuit, a statistical calculation circuit, and a quality monitoring circuit. The threshold calculation circuit calculates a range of statistical parameters based on preset requirement information and process parameters of the true random number generation circuit. The preset requirement information includes a preset minimum information entropy and / or a preset minimum throughput. The statistical calculation circuit receives true random numbers and calculates the statistical parameters of the true random numbers. The quality monitoring circuit is connected to the threshold calculation circuit and the statistical calculation circuit, and determines the quality monitoring result of the true random numbers based on the statistical parameters and the range of statistical parameters.
[0022] It can be seen that the threshold calculation circuit described above is used to receive preset demand information and process parameters.
[0023] In one implementation, preset demand information and process parameters can be stored in a storage circuit (which may be called a configuration storage circuit). Both inputs of the threshold calculation circuit are then connected to this configuration storage circuit to read the preset demand information and process parameters from it. Both the preset demand information and process parameters can be input into the configuration storage circuit by the user. Here, the process parameters are parameters in the functional relationship between the variance and mean of truly random numbers, used to indicate the functional relationship between the two. This functional relationship can be obtained through fitting or derived empirically.
[0024] In another possible implementation, preset demand information can be stored in the aforementioned configuration storage circuit, and an input of the threshold calculation circuit can be connected to this configuration storage circuit to read the preset demand information from the configuration storage circuit. However, the process parameters are generated internally by the threshold calculation circuit.
[0025] Specifically, refer to Figure 2 As shown, the threshold calculation circuit includes a process calculation circuit and a conversion circuit. The process calculation circuit is connected to the statistical calculation circuit and is used to receive the statistical parameters of the true random number and calculate the process parameters of the true random number generation circuit based on the statistical parameters. The relationship between the statistical parameters and the process parameters is obtained when the true random number follows an inverse Gaussian distribution. The conversion circuit is connected to the process calculation circuit and is used to convert the minimum information entropy and the minimum throughput into the range of the statistical parameters based on the process parameters. In other words, the threshold calculation circuit is connected to the statistical calculation circuit and is used to obtain the statistical parameters required for calculating the process parameters from the statistical calculation circuit.
[0026] The input terminal of the process calculation circuit serves as the input terminal of the threshold calculation circuit and is connected to the output terminal of the statistical calculation circuit to receive the statistical parameters of the true random numbers output by the statistical calculation circuit. Since the process parameters describe the relationship between the statistical parameters, the process parameters can be calculated based on these statistical parameters. Thus, the embodiments of this application can calculate the process parameters based on the actual statistical parameters, improving the accuracy of the process parameters.
[0027] The process parameters are related to the distribution of true random numbers. When true random numbers are generated by the true random number generation circuit COSO TRNG (Coherent Sampling True Random Number Generator), the true random numbers follow an inverse Gaussian distribution. Figure 3 This is a schematic diagram of the structure of a COSO TRNG provided in an embodiment of this application. (Refer to...) Figure 3As shown, the COSO TRNG includes two ring oscillators, 1 and 2, a D flip-flop, a T flip-flop, and a counter. The two ring oscillators can have identical structures, but due to unavoidable manufacturing variations, there is a slight difference in signal transmission delay between the two ring oscillators, resulting in a certain deviation in their operating frequencies. Each ring oscillator exhibits random jitter, which can originate from sources such as thermal noise and flicker noise—the physical source of entropy. This random jitter causes the generated truly random numbers to also be random.
[0028] The output of ring oscillator 1 is connected to the data input D of a D flip-flop, allowing the signal S1 output by ring oscillator 1 to be input into the D flip-flop (DFF). The output of ring oscillator 2 is connected to the clock input C of a D flip-flop, allowing the signal S2 output by ring oscillator 2 to be input into the D flip-flop. The D flip-flop samples signal S1 using signal S2 to obtain signal S3.
[0029] The output of the D flip-flop is connected to the input of the Toggle Flip-Flop (TFF) to transfer signal S3 from the D flip-flop to the T flip-flop. The T flip-flop then down-converts signal S3 to obtain signal S4. The frequency of signal S4 is half the frequency of signal S3.
[0030] The output of the T flip-flop is connected to the enable terminal EN of the counter, and the output of the ring oscillator 2 is also connected to the data input terminal D of the counter. The counter is used to receive the signal S4 output by the T flip-flop and the signal S2 output by the ring oscillator 2, so as to count the signal S2 based on the signal S4 to obtain a true random number.
[0031] The aforementioned COSO TRNG utilizes the cumulative phase difference between two ring oscillators with similar frequencies but slight differences as an entropy source to generate truly random numbers. Here, the entropy is the Shannon information entropy. The period difference between the two ring oscillators is much smaller than their respective absolute periods and exhibits a certain degree of randomness. The counter stops when the cumulative phase difference first crosses 2π radians. If the relationship between the time and phase of the ring oscillators is abstracted as a one-dimensional Brownian motion, then the cumulative phase difference also constitutes a one-dimensional Brownian motion. Therefore, the problem is transformed into finding the time when this Brownian motion first crosses 2π radians. In the continuous-time model, this time is the first passage time of the drifting Brownian motion over a fixed threshold, and the probability of the first passage time can be classified into an inverse Gaussian distribution using probability theory. The truly random number M output by the counter is the integer part of the event occurrence time divided by the period time; therefore, the distribution of the truly random number M is consistent with the inverse Gaussian distribution. The embodiments of this application establish a mathematical model between process parameters and statistical parameters based on mathematical theory, which has a mathematical basis and can effectively improve the accuracy of quality monitoring results.
[0032] When truly random numbers follow an inverse Gaussian distribution, the following formulas for process parameters can be derived mathematically: K=
[0033] Where K is a process parameter, For variance, This is the average value.
[0034] The embodiments of this application can calculate process parameters based on the statistical parameters actually output by the true random number generation circuit, so that the process parameters accurately describe the actual situation of the true random number generation circuit. Dynamically adjusting the conversion relationship for different manufacturing processes of the true random number generation circuit helps to further improve the accuracy of true random number quality monitoring.
[0035] When the process calculation circuit calculates the process parameter K using the above formula, the output of the process calculation circuit is connected to the input of the conversion circuit to output the process parameter to the conversion circuit. The conversion circuit is used to convert the minimum information entropy and minimum throughput into a range of statistical parameters based on the process parameters. Information entropy is positively correlated with statistical parameters, throughput is negatively correlated with statistical parameters, and different statistical parameters are positively correlated with each other. Therefore, the minimum information entropy corresponds to the minimum statistical parameter, the minimum throughput corresponds to the maximum statistical parameter, and the minimum and maximum statistical parameters constitute the range of statistical parameters.
[0036] Since the statistical parameters that are directly positively correlated with information entropy and those that are directly negatively correlated with throughput are not the same type of statistical parameter, it is necessary to convert between the statistical parameters that are directly positively correlated with information entropy and those that are directly negatively correlated with throughput through process parameters. This includes: converting the minimum statistical parameter corresponding to minimum information entropy to the maximum statistical parameter corresponding to minimum throughput through process parameters, and / or converting the maximum statistical parameter corresponding to minimum throughput to the minimum statistical parameter corresponding to minimum information entropy through process parameters.
[0037] Based on the above explanation, the conversion circuit can calculate the minimum statistical parameter corresponding to the minimum information entropy using a first function model with process parameters as parameters, or calculate the maximum statistical parameter corresponding to the minimum throughput using a second function model with process parameters as parameters. The first and second function models are pre-constructed, and their parameters are all process parameters. Therefore, inputting the minimum information entropy into the first function model yields the minimum statistical parameter, and inputting the minimum throughput into the second function model yields the maximum statistical parameter. The conversion circuit can be understood as an implementation circuit for the first and second function models, used to implement the computational processes of the first and second function models.
[0038] It should be noted that the first function model mentioned above can be a functional relationship between information entropy and variance, and the second function model mentioned above can be a functional relationship between throughput and variance; of course, the first function model can also be a functional relationship between information entropy and average value, and the second function model can also be a functional relationship between throughput and average value.
[0039] In some possible implementations, the statistical parameters include variance and mean. The range of the statistical parameters can be expressed as a range of variance or a range of mean. The range of variance includes the minimum variance and the maximum variance, and the range of mean includes the minimum mean and the maximum mean. (See reference...) Figure 4 As shown, the conversion circuit includes: an entropy conversion circuit, a throughput conversion circuit, and a parameter conversion circuit; the entropy conversion circuit is used to convert the minimum information entropy into the minimum variance; the throughput conversion circuit is used to convert the minimum throughput into the maximum average value; the parameter conversion circuit is connected to the entropy conversion circuit and the throughput conversion circuit, and the parameter conversion circuit is used to generate the statistical parameter range based on the process parameters, the minimum variance, and the maximum average value, wherein the minimum statistical parameter and the maximum statistical parameter in the statistical parameter range are between...
[0040] Specifically, the input terminal of the entropy conversion circuit serves as an input terminal of the conversion circuit, connected to the configuration storage circuit to receive the minimum information entropy. The entropy conversion circuit is used to calculate the minimum variance corresponding to the minimum information entropy based on a third function model relating information entropy and variance; essentially, it inputs the minimum information entropy into the third function model to obtain the minimum variance. The third function model is pre-fitted or empirically set. The entropy conversion circuit can be understood as the implementation circuit of the third function model.
[0041] The input terminal of the throughput conversion circuit, serving as another input terminal of the conversion circuit, is connected to the configuration storage circuit to receive the minimum throughput. The throughput conversion circuit calculates the maximum average value corresponding to the minimum throughput based on a fourth function model relating throughput and average value; essentially, it inputs the minimum throughput into the fourth function model to obtain the maximum average value. The fourth function model is pre-fitted or empirically set. The throughput conversion circuit can be understood as the implementation circuit of the fourth function model.
[0042] The input terminal of the parameter conversion circuit, serving as the third input terminal of the conversion circuit, can be connected to the configuration storage circuit or the output terminal of the process calculation circuit to receive process parameters. The other input terminal of the parameter conversion circuit is connected to the output terminals of the entropy conversion circuit and the throughput conversion circuit, to receive the minimum variance output by the entropy conversion circuit and the maximum average value output by the throughput conversion circuit. This allows for the conversion of the minimum variance and / or maximum average value based on the process parameters, yielding the maximum variance and / or minimum average value. The minimum variance and maximum variance constitute a statistical parameter range, or the minimum average value and maximum average value constitute a statistical parameter range.
[0043] The parameter conversion circuit is used to calculate the minimum mean corresponding to the minimum variance, and / or the maximum variance corresponding to the maximum mean, based on the fifth function model between variance and mean. Essentially, it inputs the minimum variance into the fifth function model to obtain the minimum mean, and / or inputs the maximum mean into the fifth function model to obtain the maximum variance. The fifth function model is represented by the aforementioned process parameters, and the parameter conversion circuit can be understood as the implementation circuit of the fifth function model.
[0044] As can be seen, the embodiments of this application divide the conversion circuit into three parts. The parameter conversion circuit can be flexibly set to achieve the conversion from minimum variance to minimum average, or the conversion from maximum average to maximum variance. Thus, compared to directly setting the circuit corresponding to the first function model and the circuit corresponding to the second function model, dividing the conversion circuit into three parts can effectively improve circuit flexibility.
[0045] In some possible implementations, two parameter conversion sub-circuits can be set in the parameter conversion circuit to respectively implement the conversion from minimum variance to minimum average, and the conversion from maximum average to maximum variance. Then, the two parameter conversion sub-circuits can be flexibly switched by a switching circuit. The switching circuit can read switching instruction information from the configuration storage circuit, and the switching circuit can control the operation of one of the parameter conversion sub-circuits according to the switching instruction information.
[0046] Specifically, refer to Figure 4 As shown, the parameter conversion circuit includes: a minimum parameter conversion circuit and / or a maximum parameter conversion circuit; the minimum parameter conversion circuit is used to convert the minimum variance into the minimum mean, and the minimum mean and the maximum mean constitute the statistical parameter range; the maximum parameter conversion circuit is used to convert the maximum mean into the maximum variance, and the minimum variance and the maximum variance constitute the statistical parameter range.
[0047] After obtaining the aforementioned statistical parameter range, it can be stored in the threshold storage circuit for convenient reuse multiple times, avoiding repeated generation of the statistical parameter range. The threshold calculation circuit can operate periodically or when the electronic device starts up, which can greatly reduce the number of times the threshold transport circuit runs, thus helping to reduce power consumption.
[0048] Specifically, refer to Figure 2 As shown, the above-mentioned true random number processing circuit further includes: a threshold storage circuit, a configuration storage circuit, and a threshold control circuit. The threshold control circuit is connected to the threshold storage circuit, the configuration storage circuit, and the threshold calculation circuit. The threshold control circuit is used to control whether the threshold calculation circuit runs based on the statistical parameter range in the threshold storage circuit and the threshold calculation information in the configuration storage circuit.
[0049] Specifically, the input of the threshold control circuit is connected to the output of the threshold storage circuit and the output of the configuration storage circuit to read the statistical parameter range from the threshold storage circuit and the threshold calculation information from the configuration storage circuit. The threshold calculation information includes the operating conditions of the threshold calculation circuit; for example, it may be an indication of whether the threshold calculation circuit should be run, or the operating cycle of the threshold calculation circuit.
[0050] The output of the threshold control circuit is connected to the control input of the threshold calculation circuit. The threshold control circuit can generate operation control information based on the threshold calculation information and the statistical parameter range, and input this information to the control input of the threshold calculation circuit to indicate whether to run the threshold calculation circuit. When the threshold calculation information indicates to run the threshold calculation circuit, and / or when the statistical parameter range is not present in the threshold storage circuit, the operation control information indicates to run the threshold calculation circuit; otherwise, the operation control information indicates not to run the threshold calculation circuit.
[0051] The embodiments of this application can combine the threshold calculation information configured by the user and the existence of the statistical parameter range to comprehensively determine whether to run the threshold calculation circuit. This not only improves the flexibility of updating the statistical parameter range, but also avoids quality monitoring failure caused by the non-existence of the statistical parameter range.
[0052] In addition to the threshold calculation circuit needing to output a range of statistical parameters, a statistical calculation circuit also needs to output truly random numbers to monitor the quality of these numbers. Specifically, the input of the statistical calculation circuit can be connected to the output of the truly random number generation circuit to receive truly random numbers from it. Furthermore, a truly random number storage circuit can be installed between the input of the statistical calculation circuit and the truly random number generation circuit. This storage circuit continuously stores the truly random numbers output by the generation circuit, and can store up to N bits of truly random numbers, where N is an integer greater than or equal to 1. It can be understood that the truly random number storage circuit can slide to store the most recently generated N bits of truly random numbers, thereby dynamically calculating the statistical parameters of the most recently generated truly random numbers.
[0053] The statistical operation circuit described above is used to calculate the statistical parameters of an N-bit true random number. The statistical parameters are used to describe the statistical characteristics of the true random number and may include variance and / or mean.
[0054] The output terminals of the threshold calculation circuit and the statistical calculation circuit are respectively connected to the two input terminals of the quality monitoring circuit. The quality monitoring circuit is used to determine the quality of the true random number based on the range of statistical parameters output by the threshold calculation circuit and the statistical parameters output by the statistical calculation circuit, and obtain the quality monitoring result.
[0055] Specifically, the quality monitoring circuit compares a statistical parameter with its range. When the statistical parameter is within its range, the output quality monitoring result is normal; when the statistical parameter is outside its range, the output quality monitoring result is abnormal. Therefore, the quality monitoring circuit can be a comparison circuit.
[0056] In some possible implementations, the comparison circuit internally includes two comparators and a comparison result output circuit. One comparator compares the statistical parameter with the minimum statistical parameter within the range of the statistical parameter, outputting a first comparison result; the other comparator compares the statistical parameter with the maximum statistical parameter within the range of the statistical parameter, outputting a second comparison result. The comparison output circuit outputs a comparison result based on the first and second comparison results.
[0057] It is understandable that the meaning of the comparison output circuit is related to the meaning of the first comparison result and the meaning of the second comparison result.
[0058] When the first comparison result is 1, indicating that the statistical parameter is greater than or equal to the minimum statistical parameter, and the second comparison result is 1, indicating that the statistical parameter is less than or equal to the maximum statistical parameter, the comparison output circuit can be an AND circuit, so that the AND result of the two is used as the comparison result output by the comparison circuit.
[0059] When the first comparison result is 1, indicating that the statistical parameter is greater than or equal to the minimum statistical parameter, and the second comparison result is 0, indicating that the statistical parameter is less than or equal to the maximum statistical parameter, the comparison output circuit may include an inverter and an AND circuit. The inverter is used to invert the second comparison result, and the AND circuit is used to take the AND result of the inverted first and second comparison results as the comparison result output by the comparison circuit.
[0060] Similarly, when the first comparison result is 0, indicating that the statistical parameter is greater than or equal to the minimum statistical parameter, and the second comparison result is 1, indicating that the statistical parameter is less than or equal to the maximum statistical parameter, the comparison output circuit can include an inverter and an AND circuit. The inverter is used to invert the first comparison result, and the AND circuit uses the inverted result of the first comparison result and the AND result of the second comparison result as the comparison result output by the comparison circuit.
[0061] When the first comparison result is 0, indicating that the statistical parameter is greater than or equal to the minimum statistical parameter, and the second comparison result is 0, indicating that the statistical parameter is less than or equal to the maximum statistical parameter, the comparison output circuit may include a NAND circuit. The NAND circuit is used to invert the AND result of the first and second comparison results, which is then used as the comparison result output by the comparison circuit.
[0062] As can be seen, two comparators and a comparison output circuit can be flexibly configured, and the internal structure of the comparison circuit is not limited in the embodiments of this application.
[0063] When quality monitoring reveals that the statistical parameters of the true random numbers are outside the statistical parameter range, the true random number generation circuit can be calibrated to dynamically adjust the circuit and continuously improve the quality of the true random numbers. Specifically, the true random number processing circuit further includes a calibration circuit and a ring oscillator connected to the quality monitoring circuit and the true random number generation circuit, used to adjust the operating frequency of the ring oscillator according to the quality monitoring results. In this embodiment, the operating frequencies of the two ring oscillators are adjustable, thereby adjusting the difference in their operating frequencies to achieve quality adjustment of the true random numbers.
[0064] The input of the calibration circuit is connected to the output of the quality monitoring circuit to receive the quality monitoring results. The output of the calibration circuit is connected to the ring oscillator in the true random number generation circuit. The calibration circuit generates a frequency control signal based on the quality monitoring results and outputs it to the ring oscillator to adjust the operating frequency.
[0065] Specifically, the quality monitoring results can also be used to indicate whether the statistical parameters of the true random numbers are less than the minimum statistical parameter or greater than the maximum statistical parameter. The calibration circuit can reduce the operating frequency difference between the two ring oscillators when the statistical parameters are less than the minimum statistical parameter, thereby increasing the information entropy and ensuring that the information entropy of the true random numbers is greater than or equal to the minimum information entropy; conversely, when the statistical parameters are greater than the maximum statistical parameter, it can increase the operating frequency difference between the two ring oscillators, thereby increasing the throughput of the true random numbers and ensuring that the throughput of the true random numbers is greater than or equal to the minimum throughput.
[0066] The embodiments of this application have hardware-level protection against side-channel attacks. When an attacker attempts to affect the operating frequency of the ring oscillator by injecting external noise or power supply interference, it will cause abnormalities in the variance of the true random number, triggering the calibration circuit to perform calibration, causing the true random number generation circuit to enter self-test, so as to reconfigure the operating frequency of the ring oscillator, making it difficult for the attack to continue.
[0067] It has the ability to resist frequency manipulation-type side-channel attacks.
[0068] The operating frequency of the aforementioned ring oscillator is adjustable. In some possible implementations, the ring oscillator includes at least two stages of dynamic delay circuitry, as shown in the reference. Figure 5 As shown, the dynamic delay circuit includes a selection circuit and at least two transmission paths with different signal transmission delays; the selection circuit is connected to the transmission path and the calibration circuit, and is used to select the transmission path according to the frequency control signal output by the calibration circuit. The number of dynamic delay circuits is even.
[0069] Reference Figure 5 As shown, an exemplary two-stage dynamic delay circuit is provided; the number of dynamic delay circuits is unlimited. Multiple stages of dynamic delay circuits are connected end-to-end to form a ring structure. Specifically, the input of the i-th stage dynamic delay circuit is connected to the output of the (i-1)-th stage dynamic delay circuit.
[0070] In each stage of the dynamic delay circuit, at least two transmission paths have their input terminals as input terminals of the dynamic delay circuit. The output terminals of the transmission paths are connected to the data input terminal of the selection circuit to receive multiple signals with different delays. The control input terminal of the selection circuit is connected to the output terminal of the calibration circuit to receive the frequency control signal output by the calibration circuit. Under the action of the frequency control signal, the selection circuit can select the signal of one transmission path as its output signal.
[0071] The frequency control signal comprises two signals, each corresponding to a ring oscillator and used to control the operating frequency of that ring oscillator to increase or decrease. Each frequency control signal may include a multi-bit binary signal, with each bit corresponding to a selection circuit in a dynamic delay circuit. Therefore, the number of bits in each frequency control signal is the same as the number of selection circuits in a ring oscillator. The target value in the frequency control signal indicates the operating frequency of the ring oscillator, and the target value can be negatively correlated with the operating frequency of the ring oscillator.
[0072] The calibration circuit generates two frequency control signals with smaller differences in the number of target values when the statistical parameter is less than the minimum statistical parameter, in order to reduce the operating frequency difference between the two ring oscillators. When the statistical parameter is greater than the maximum statistical parameter, it generates two frequency control signals with larger differences in the number of target values, in order to increase the operating frequency difference between the two ring oscillators.
[0073] Specifically, the calibration circuit can record the frequency control signal from the previous moment to output the frequency control signal for the current moment. For example, if the two frequency control signals from the previous moment are 1100000000 and 1111111100, corresponding to target value counts of 2 and 8 respectively, in order to reduce the operating frequency difference, the count of the smaller target value can be increased and the count of the larger target value can be decreased, generating two frequency control signals for the current moment of 1110000000 and 1111111000, with target value counts of 3 and 7 respectively.
[0074] For example, the two frequency control signals at the previous moment were 1111100000 and 1111110000, corresponding to target value numbers of 5 and 6 respectively. In order to increase the working frequency difference, the number of smaller target values can be decreased and / or the number of larger target values can be increased, generating two frequency control signals at the current moment of 1111000000 and 1111111000, with target value numbers of 4 and 7 respectively.
[0075] When the bit in the frequency control signal is the target value, the corresponding selection circuit can choose the signal output from the transmission path with a larger signal transmission delay as the output signal of the selection circuit. When the bit in the frequency control signal is not the target value, the corresponding selection circuit can choose the signal output from the transmission path with a smaller signal transmission delay as the output signal of the selection circuit. In this case, a larger number of target values indicates a larger signal transmission delay and a lower operating frequency of the ring oscillator; conversely, a larger number of target values indicates a smaller signal transmission delay and a higher operating frequency of the ring oscillator.
[0076] For example, let A1 be the frequency control signal for ring oscillator S2 and A2 be the frequency control signal for ring oscillator S2. In the previous moment, A1 = 1100000000 and A2 = 1111111100, corresponding to target values of 1 (2 and 8 respectively). In the current moment, A1 = 1110000000 and A2 = 1111111000, corresponding to target values of 3 and 7 respectively. It can be seen that in the previous moment, A1 had a smaller target value than A2, meaning the operating frequency of ring oscillator 1 was higher than that of ring oscillator 2. In the current moment, the target value of A1 is greater than that of A1 in the previous moment, so the operating frequency of ring oscillator A1 decreases. In the current moment, the target value of A2 is less than that of A2 in the previous moment, so the operating frequency of ring oscillator A2 increases. This reduces the operating frequency of ring oscillator 1 and increases the operating frequency of ring oscillator A2, thus reducing the frequency difference between the two ring oscillators.
[0077] Of course, this is just an example and is not limited to this kind of selection logic.
[0078] When the bit in the frequency control signal is the target value, the corresponding selection circuit can choose the signal output from the transmission path with the shorter signal transmission delay as its output signal. When the bit in the frequency control signal is not the target value, the corresponding selection circuit can choose the signal output from the transmission path with the longer signal transmission delay as its output signal. In this case, a larger number of target values indicates a shorter signal transmission delay and a higher operating frequency of the ring oscillator; conversely, a smaller number of target values indicates a longer signal transmission delay and a lower operating frequency of the ring oscillator.
[0079] For example, if in the previous time step A1 = 1100000000 and A2 = 1111111100, corresponding to target values of 2 and 8 respectively, and in the current time step A1 = 1110000000 and A2 = 1111111000, the target values are 3 and 7 respectively. It can be seen that in the previous time step A1 and A2, A1 had a smaller target value of 1 than A2, so the operating frequency of ring oscillator 1 was lower than that of ring oscillator 2. In the current time step A1 has a larger target value than the previous time step A1, so the operating frequency of ring oscillator A1 increases. In the current time step A2 has a smaller target value than the previous time step A2, so the operating frequency of ring oscillator A2 decreases. This increases the operating frequency of ring oscillator 1 and decreases the operating frequency of ring oscillator A2, reducing the frequency difference between the two ring oscillators.
[0080] Similarly, the principle is the same for the case where the target value is 0, and will not be repeated here.
[0081] In the aforementioned ring oscillator, the lengths of different transmission paths can vary to achieve different delays. Alternatively, logic circuits can be placed on different transmission paths to achieve different delays. Specifically, within the dynamic delay circuit, different numbers of latches are placed on different transmission paths. For example, one transmission path may not have any latches, while another transmission path may have one or more latches. The embodiments of this application can achieve different delays for transmission paths using latches, resulting in a relatively simple circuit structure.
[0082] In some possible implementations, the frequency control signal received by the selection circuit can also be connected to the transmission path to which the data input terminal of the selection circuit is connected, for example, to a latch on the transmission path, so as to control the latch on the transmission path to stop working when the selection circuit does not select the transmission path. In this way, power consumption can be reduced as much as possible.
[0083] Figure 6 This is a schematic diagram of a dynamic delay circuit provided in an embodiment of this application. (Refer to...) Figure 6 As shown, the dynamic delay circuit includes an inverter, two transmission paths, and a selector, which acts as a selection circuit. One transmission path has no latch, while the other has one latch. The inverter's input is used as the input to the dynamic delay circuit. The inverter's output is connected to the two data inputs D1 and D2 of the selector via the two transmission paths. The selector's control input A is connected to the output of the calibration circuit to receive one bit of the frequency control signal output by the calibration circuit. The selector's output is used as the output of the dynamic delay circuit.
[0084] from Figure 6 As can be seen, the signal transmission delay of the transmission path with a latch is relatively large, while the signal transmission delay of the transmission path without a latch is relatively small. Compared with the traditional ring oscillator that only includes one transmission path, the signal transmission delay of the ring oscillator of this application is adjustable, thereby realizing the adjustment of the operating frequency.
[0085] In some possible implementations, the calibration circuit, in addition to controlling the operating frequency of the ring oscillator, can also control the state of the true random number storage circuit. Specifically, the true random number processing circuit further includes a state control circuit and a true random number storage circuit, wherein the state control circuit is connected to the quality monitoring circuit and the true random number storage circuit, and the state control circuit is used to generate the state of the true random number generation circuit based on the quality monitoring results and the state of the true random number storage circuit.
[0086] One input of the state control circuit is connected to the output of the quality monitoring circuit to receive the quality monitoring results. The other input of the state control circuit is connected to the output of the true random number storage circuit to obtain its state. The state of the true random number storage circuit indicates whether there are any unread true random numbers in the circuit; unread true random numbers are generated but unused true random numbers.
[0087] Specifically, a duration threshold can be set. When the quality monitoring result indicates that the duration of the true random number quality anomaly is less than or equal to the duration threshold, the state control circuit sets the state of the true random number generation circuit to self-test. When the quality monitoring result indicates that the duration of the true random number quality anomaly is greater than the duration threshold, the state of the true random number generation circuit is set to fault. The duration of the quality anomaly refers to the duration of the true random number quality anomaly. The self-test state indicates that the calibration circuit is adjusting the operating frequency of the ring oscillator in the true random number generation circuit to improve the quality of the true random numbers.
[0088] When the quality monitoring result indicates that the quality of the true random number is normal, and the status of the true random number storage circuit indicates that there are no unread true random numbers in the true random number storage circuit, the status control circuit sets the status of the true random number generation circuit to "True random number to be generated"; when the quality monitoring result indicates that the quality of the true random number is normal, and the status of the true random number storage circuit indicates that there are unread true random numbers in the true random number storage circuit, the status control circuit sets the status of the true random number generation circuit to "True random number generated".
[0089] The embodiments of this application can dynamically update the state of the true random number generation circuit to indicate that the application is using true random numbers correctly.
[0090] In some possible implementations, a state storage circuit can be provided to store the state of the true random number generation circuit. The state storage circuit and the true random number storage circuit may be the same circuit or different circuits.
[0091] When an application needs to use truly random numbers, it can read the state of the truly random number generation circuit. If the state of the truly random number generation circuit is "generated truly random numbers," then truly random numbers can be read from the truly random number storage circuit. After reading the truly random numbers, the state of the truly random number generation circuit is updated to "to be generated truly random numbers."
[0092] For example, a security coprocessor needs to generate a 256-bit truly random number as an RSA private key seed. The system-level software running on the coprocessor can read the state storage circuit to obtain the state of the truly random number generation circuit. If the state of the truly random number generation circuit is "generated truly random number," the system-level software reads a 16-bit truly random number from the storage circuit. The storage circuit's state automatically changes to "to be generated truly random number," and the truly random number generation circuit continues generating the next 16-bit truly random number in the background. When the state of the truly random number generation circuit is updated to "generated truly random number," the system-level software reads the 16-bit truly random number again. This process is repeated 16 times to obtain a 256-bit truly random number.
[0093] If the true random number generation circuit updates its status to "self-testing" during the reading process, the system software needs to wait until the true random number generation circuit's status returns to "generated true random numbers." If the status updates to "fault," the system software triggers an exception handling procedure, records the security event, and switches to a backup random data source.
[0094] The following example illustrates the operation flow of a true random number processing circuit.
[0095] First, after startup, the true random number processing circuit enters calibration mode. In calibration mode, the two ring oscillators operate at two different default frequencies. For example, the two ring oscillators operate at their maximum and minimum frequencies respectively. This means that the selection circuit for one ring oscillator selects the transmission path with a longer signal transmission delay, while the selection circuit for the other ring oscillator selects the transmission path with a shorter signal transmission delay. In calibration mode, the threshold calculation circuit outputs the statistical parameter range to the threshold storage circuit.
[0096] Then, the true random number processing circuit enters the operating mode. In operating mode, the statistical calculation circuit, quality monitoring circuit, and calibration circuit operate. The calibration circuit can adaptively adjust the true random number generation circuit to ensure the quality of the true random numbers. During this process, the state control circuit can continuously output the state of the true random number generation circuit to the state storage circuit, including: true random numbers to be generated, true random numbers already generated, self-test in progress, and faults.
[0097] In summary, the statistical parameter range of this application embodiment is dynamically generated based on preset requirement information and process parameters. This allows for dynamic adjustment of the statistical parameter range corresponding to the preset requirement information under different processes, resulting in high accuracy of the statistical parameter range and contributing to improved accuracy in true random number quality monitoring. Furthermore, the area and power consumption of the true random number processing circuit in this application embodiment are kept within acceptable limits, and calibration and monitoring are implemented in hardware, reducing system cost and deployment complexity.
[0098] This application also provides a semiconductor chip including the aforementioned true random number processing circuit.
[0099] This application provides an electronic device, characterized in that it includes the aforementioned semiconductor chip.
[0100] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0101] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0102] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A true random number processing circuit, characterized in that, include: Threshold calculation circuit, statistical calculation circuit, and quality monitoring circuit; The threshold calculation circuit is used to calculate the range of statistical parameters based on the preset demand information and the process parameters of the true random number generation circuit. The preset demand information includes a preset minimum information entropy and / or a preset minimum throughput. The statistical processing circuit is used to receive true random numbers and calculate the statistical parameters of the true random numbers; The quality monitoring circuit is connected to the threshold calculation circuit and the statistical calculation circuit. The quality monitoring circuit is used to determine the quality monitoring result of the true random number based on the statistical parameters and the range of statistical parameters. The threshold calculation circuit includes: a process calculation circuit and a conversion circuit; The process calculation circuit is connected to the statistical calculation circuit. The process calculation circuit is used to receive the statistical parameters of the true random number and calculate the process parameters of the true random number generation circuit based on the statistical parameters. The process parameters are used to describe the functional relationship between the variance and the mean of the true random number. The relationship between the statistical parameters and the process parameters is obtained under the condition that the true random number follows an inverse Gaussian distribution. The conversion circuit is connected to the process calculation circuit, and the conversion circuit is used to convert the minimum information entropy and the minimum throughput into the statistical parameter range according to the process parameters.
2. The true random number processing circuit according to claim 1, characterized in that, The conversion circuit includes: an entropy conversion circuit, a throughput conversion circuit, and a parameter conversion circuit; The entropy conversion circuit is used to convert the minimum information entropy into the minimum variance. The throughput conversion circuit is used to convert the minimum throughput into the maximum average value; The parameter conversion circuit is connected to the entropy conversion circuit and the throughput conversion circuit. The parameter conversion circuit is used to generate the statistical parameter range based on the process parameters, the minimum variance, and the maximum average value, wherein the minimum statistical parameter and the maximum statistical parameter are within the statistical parameter range.
3. The true random number processing circuit according to claim 2, characterized in that, The parameter conversion circuit includes: a minimum parameter conversion circuit and / or a maximum parameter conversion circuit; The minimum parameter conversion circuit is used to convert the minimum variance into the minimum mean, and the minimum mean and the maximum mean constitute the statistical parameter range; The maximum parameter conversion circuit is used to convert the maximum average value into the maximum variance, and the minimum variance and the maximum variance constitute the statistical parameter range.
4. The true random number processing circuit according to any one of claims 1 to 3, characterized in that, Also includes: A calibration circuit, connected to the ring oscillator of the quality monitoring circuit and the true random number generation circuit, is used to adjust the operating frequency of the ring oscillator according to the quality monitoring results.
5. The true random number processing circuit according to claim 4, characterized in that, The ring oscillator includes: at least two stages of dynamic delay circuitry, wherein the dynamic delay circuitry includes a selection circuit and at least two transmission paths with different signal transmission delays; The selection circuit is connected to the transmission path and the calibration circuit, and is used to select the transmission path according to the frequency control signal output by the calibration circuit.
6. The true random number processing circuit according to claim 5, characterized in that, Within the dynamic delay circuit, different numbers of latches are provided on different transmission paths.
7. The true random number processing circuit according to claim 4, characterized in that, Also includes: A state control circuit and a true random number storage circuit are provided. The state control circuit is connected to the quality monitoring circuit and the true random number storage circuit. The state control circuit is used to generate the state of the true random number generation circuit based on the quality monitoring results and the state of the true random number storage circuit.
8. The true random number processing circuit according to claim 1, characterized in that, Also includes: The system includes a threshold storage circuit, a configuration storage circuit, and a threshold control circuit. The threshold control circuit is connected to the threshold storage circuit, the configuration storage circuit, and the threshold calculation circuit. The threshold control circuit is used to control whether the threshold calculation circuit operates based on the statistical parameter range in the threshold storage circuit and the threshold calculation information in the configuration storage circuit.
9. A semiconductor chip, characterized in that, Includes a true random number processing circuit as described in any one of claims 1 to 8.
10. An electronic device, characterized in that, Includes the semiconductor chip described in claim 9.
