This application claims the benefit of Japanese Application No. 2008-318666 filed in Japan on Dec. 15, 2008, the contents of which are incorporated herein by this reference.
1. Field of the Invention
The present invention relates to a random number generator and a pseudo-random number generator, and particularly to a random number generator which generates a random number based on a variation of a reception condition of a signal received via a bus, and a pseudo-random number generator using such a random number as a seed.
2. Description of the Related Art
Encryption technologies have been widely used because of increase of awareness of security. Random numbers are required in many encryption technologies. As a method for easily obtaining a random number, a pseudo-random number generator is generally used. Since a pseudo-random number is a number contained in a number sequence obtained by a deterministic calculation, if the same value, that is, the same seed is inputted for execution, the same random number is generated. Therefore, what type of value to use as a seed is important for pseudo-random number generators. For example, as in a/dev/random file in Linux, input information from a keyboard or a mouse to a computer system is pooled, and retrieved and used as a seed as needed. However, this method may require time to obtain a necessary quantity of random numbers, and is not easy to use in a system such as a server system having a low frequency of input from outside.
In contrast to a pseudo-random number, physical random number generators generate physical random numbers which are unpredictable because the physical random numbers do not have regularity and repeatability. These physical random number generators are being used in statistics, financial simulation, large-scale physical simulation, security and other fields. Physical random numbers are a number sequence generated using a natural phenomenon in which numbers are randomly arranged. For example, Japanese Patent Application Laid-Open Publication No. 2007-304730 discloses a physical random number generator which generates physical random numbers by applying high-speed digital processing to random thermionic signals inside a semiconductor device.
Although physical random numbers are unpredictable high-quality random numbers since the physical random numbers use a natural phenomenon, physical random number generators require dedicated hardware such as a temperature sensor. Accordingly, the physical random number generators become complicated and larger, and are not easy to use in a small-scale system.
A random number generator of an embodiment of the present invention includes: a bus including a plurality of bus lines configured to send and receive a signal between circuits; a calibration unit configured to dynamically adjust a reception condition of the signal; and a random number generating unit configured to generate a random number based on adjustment information of the calibration unit.
A pseudo-random number generator of another embodiment of the present invention includes: a bus including a plurality of bus lines configured to send and receive a signal between circuits; a calibration unit configured to dynamically adjust a reception condition of the signal; a random number generating unit configured to generate a random number based on adjustment information of the calibration unit; and a pseudo-random number generating unit configured to generate a pseudo-random number wherein the random number generated by the random number generating unit is a seed.
A random number generator of another embodiment of the present invention includes: a CPU; an auxiliary operation device having a calibration unit configured to dynamically adjust a reception timing of a signal between the CPU and the auxiliary operation device; a bus including a plurality of bus lines configured to send and receive the signal; a calibration information converting unit configured to generate one-bit data of “1” if a variation of the reception timing increases and to generate one-bit data of “0” if a variation of the reception timing decreases; and a random number generating unit which includes a memory unit configured to sequentially store one-bit data generated by the calibration information converting unit, a sampling unit configured to perform sampling processing to sequentially sample the one-bit data stored in the memory unit and obtain a number sequence of a bit length of a random number to be generated, and a shifting unit configured to apply rotational shift processing to the number sequence for each of the sampling processes of the sampling unit and generate the random number.
Hereinafter, a random number generator 1 of the first embodiment of the present invention will be described with reference to the drawings.
As shown in
A timing of sending and receiving of a signal via a bus line is determined based on, for example, a clock signal generated by a clock unit 4B provided in the circuit 4. However, a delay time in which a clock signal generated by the clock unit 4B reaches the circuit 3, the circuit 3 sends the signal, and the circuit 4 receives the signal, varies depending on a condition of a surrounding environment such as a temperature. Variation amount of the delay time differs for each bus line. Therefore, calibration is indispensable, which adjusts a phase of the clock signal generated by the clock unit 4B and optimizes a reception timing that is a reception condition for the circuit 4 to receive the signal and the like. The calibration is performed by the calibration unit 5.
The calibration unit 5 performs calibration processing for each bus line, dynamically, that is, for each unit time. For example, in a case of buses operating at an operating frequency of several tens of MHz, calibration is performed several tens of million times per second for every bus line. As previously described, temperature is a factor which most influences a calibration condition.
As shown in
The number of the bus lines n just needs to be greater than or equal to a bit length of generated random numbers, and not all the bus lines' adjustment information is required to be used. The number of bus lines to be used for random number generation is assumed to be ten as an example for simplicity in the following description.
The bus 2 configured to send and receive a signal between the circuit 3 and the circuit 4 and the calibration unit 5 are components important for the random number generator 1 of the present invention as described above, but original purposes of the bus 2 and the calibration unit 5 are different from it while the bus 2 and the calibration unit 5 are the components used also by the random number generator 1.
Next, a flow of operation of the random number generator 1 of the present embodiment will be described using
First, the counter M of the counting unit 16 configured to count the number of random number generation is initialized to “1”.
The calibration unit 5 performs calibration processing with respect to each of n bus lines to adjust a reception state to an optimum state.
The counter K of the counting unit 16 is initialized to “1” in order to sequentially process adjustment information of calibration of the n bus lines. Loops for a loop variable K may be processed in parallel, that is, simultaneously at each bus line.
As shown in
As shown in
If a timing of adjustment information of calibration of a bus line whose bus line number is K is the same as a timing of previous adjustment information, the calibration information converting unit 11 outputs the same value as in a previous time at entry No. K of the memory unit 13.
The calibration information converting unit 11 continues processing until the counter K becomes the number of bus lines N, e.g., 10.
As shown in
Although the number sequence obtained in step S21 is random numbers, the random number generator 1 of the present embodiment performs processing from step S22 in order to generate higher-quality random numbers.
The shifting unit 15 performs rotational shift processing to rotationally shift the n-bit length data sequence sampled by the sampling unit 14 by a value of the counter M of the counting unit 16.
As used herein, rotational shift processing refers to processing for making one-bit data in a predetermined position most significant and changing other data positions in turn as shown in
A random number generating unit 12 outputs the 8-bit length data sequence rotationally shift-processed by the shifting unit 15, as random numbers.
The shifting unit 15 increases the value M for rotational shift one by one so that output of random numbers is continuously performed. When M becomes the data length n, M is initialized to 1 again.
As described above, the random number generator 1 of the present embodiment generates random numbers based on calibration information of the calibration unit 5 which has been provided in the circuit 3 and the circuit 4 for a different purpose, and therefore has a simple configuration. In other words, the circuit 3 that is the first circuit and the circuit 4 that is the second circuit are circuits indispensable to the random number generator 1, but are not circuits dedicated to the random number generator 1.
Even though the random number generator 1 has the simple configuration, the random number generator 1 can generate random numbers fast and constantly. Further, a random number generated by the random number generator 1 is an unpredictable physical random number because a timing of calibration is dependent on temperature. Thus, the random number generator 1 can generate high-quality random numbers with the simple configuration.
Although the random number generator 1 which generates random numbers based on calibration information of the bus 2 having ten bus lines 2A has been described above for simplicity of description, the number of bus lines may be greater than or equal to 100, for example, 144 in a given CPU, and the random number generator of the present invention using calibration of this CPU's bus may generate random numbers having a longer data length which is 64 bit length or 128 bit length. The random number generator 1 does not need to use information of all the bus lines 2A.
Although a timing is used as an example of an object of calibration in the above description, various information such as a current value or a capacity may be used to be dynamically calibrated.
Although in the above description the calibration information converting unit 11 sets bit data to “1” if a timing is increased, and sets bit data to “0” if the timing is decreased, bit data may be set to “0” if the timing is increased and bit data may be set to “1” if the timing is decreased, or bit data may be replaced only when there is increase or decrease at a predetermined rate or more.
Hereinafter, a random number generator of a second embodiment will be described with reference to the drawings. Because the random number generator of the second embodiment of the present invention is similar to the random number generator 1 of the first embodiment, the same components are given the same reference numerals, and the same description will be omitted.
A description will be made below with reference to the flowchart of
Steps S30 to S37 are the same as the already described steps S10 to S17, and a description thereof will be omitted.
In the random number generator of the present embodiment, the calibration information converting unit 11 replaces an entry number of the memory unit 13 for storing one-bit data based on a bus line 2A whose adjustment information is the same as previous adjustment information, with a one-layer lower entry number.
As shown in
Although each bus line 2A has its respective characteristic, and one-bit data based on adjustment information of calibration of a bus line 2A which is less likely to vary is less likely to vary, the random number generator of the second embodiment can prevent fixing of a bit. Specifically, an entry number of the memory unit 13 of data from such a bus line is changed to a lower-level entry number so that, in a case where the number of bit sampled by the sampling unit 14 is smaller than the number of data entered in the table, one-bit data based on adjustment information of a bus line 2A which is less likely to vary is not entered in sampled upper bits. In other words, data from a bus line at which a frequency of change of a timing before and after calibration is low is removed as much as possible, so that a more random number sequence can be generated.
Steps S39 to S46 are the same as the already described steps S18 to S25 of
In addition to an advantage of the random number generator 1 of the first embodiment, the random number generator of the present embodiment can generate a higher-quality random number.
Hereinafter, a pseudo-random number generator 101 of a third embodiment of the present invention will be described with reference to the drawings. Because the pseudo-random number generator 101 of the third embodiment of the present invention is similar to the random number generator 1 of the first embodiment, the same components are given the same reference numerals, and the same description will be omitted.
As shown in
Processing of the pseudo-random number generator 101 will be described below with reference to a flowchart of
Steps S50 to S60 are the same as the already described steps S11 to S21, and a description thereof will be omitted.
As shown in
The pseudo-random number generating unit 9 generates a pseudo-random number using the random number outputted from the random number generator 1A as a seed.
As described above, the pseudo-random number generator 101 uses a result of calibration of a calibration unit in a system having the calibration unit for preventing influence of heat and voltage, so that the pseudo-random number generator 101 can acquire a seed for pseudo-random number generation which reflects randomness of heat, voltage, and the like at low cost and high speed.
In other words, a pseudo-random number generated by the pseudo-random number generating unit 9 of the pseudo-random number generator 101 is high-quality because a seed of the pseudo-random number is a random number. Further, the pseudo-random number generating unit 9 is easy to build because the configuration of the random number generator 1A is simpler than the configuration of the random number generator 1. In addition, it will be appreciated that, in order to generate a higher-quality pseudo-random number, the random number generator 1 of the first embodiment or the random number generator of the second embodiment may be provided to the pseudo-random number generator of the third embodiment.
In program code of an operating system, a device driver, and a user application, when a certain program execution unit (a process, a thread, or the like) performs processing for acquiring a value of a random number or a pseudo-random number's seed from a random number generating device in a multithread, multiprocessor or other parallel execution environment, exclusive processing is preferably performed during a period longer than or equal to a cycle of execution of each calibration so as to prevent other program execution units from performing value acquisition processing. In other words, it is preferably ensured that adjustment information of one calibration can be acquired only by one program execution unit. The above configuration can exclude a possibility that, at the same instant when one software attempts to use a generated number sequence, another software reads the same number sequence. This is effective especially in software related to security.
Having described the preferred embodiments of the invention referring to the accompanying drawings, it should be understood that the present invention is not limited to those precise embodiments and various changes and modifications thereof could be made by one skilled in the art without departing from the spirit or scope of the invention as defined in the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2008-318666 | Dec 2008 | JP | national |