Entropy collection method and device, and electronic equipment

Generating an entropy source through memory data read/write operations solves the problem of entropy acquisition dependence on hardware, and provides an entropy acquisition method that does not rely on hardware, which is an efficient entropy acquisition solution suitable for the mobile security field.

CN117494234BActive Publication Date: 2024-11-19CHENGDU HAITAI FANGYUAN TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202311325766.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-12
Publication Date
2024-11-19
Estimated Expiration
2043-10-12

AI Technical Summary

Technical Problem

In the prior art, the entropy acquisition process relies on hardware equipment, and it is difficult to introduce additional hardware facilities in the fields of mobile security, especially in areas such as mobile security, making it difficult to implement entropy acquisition in traditional hardware equipment.

Method used

The time consumed by memory data read/write operations is used as the entropy source, and the time characteristics of memory data read/write operations are not exactly the same each time, uncertain entropy pool data is generated, reducing the dependence on hardware, especially suitable for mobile security, etc. field.

Benefits of technology

Entropy acquisition is realized without relying on hardware such as crystal oscillator, thermal noise source, high-frequency oscillator, etc., and a stable entropy source is provided to generate random numbers to meet modern safety requirements and quality requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117494234B_ABST
    Figure CN117494234B_ABST
Patent Text Reader

Abstract

The embodiment of the present application relates to the field of information security technology, and provides an entropy collection method, which includes: determining whether it is necessary to collect entropy; if entropy needs to be collected, extracting first data at least once from preset entropy pool data to form entropy data; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated through a first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends; outputting the entropy data. This method of collecting entropy does not rely on hardware such as crystal oscillators, thermal noise sources, high-frequency oscillators, and low-frequency oscillators, which reduces the degree of dependence on hardware during entropy collection, and is particularly suitable for fields such as mobile security where it is not desired to introduce additional hardware facilities. The present application also discloses an entropy collection device and an electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information security technology, and specifically, to an entropy collection method and device, and an electronic device. Background Art

[0002] With the development of informatization and computer technology, while people are enjoying the many benefits brought by informatization, network security issues have become a common challenge faced by mankind in the information age. In the existing technology, people widely use random numbers to protect information security. For example, random numbers are used to generate keys for symmetric and asymmetric cryptographic algorithms, challenge values ​​in challenge-response mechanisms, secret information in digital signature schemes, and resist side channel analysis attacks.

[0003] Entropy is the source of uncertainty in a random number generator, so it is also called an entropy source. The entropy source is the most fundamental and core component of a random number generator. To generate high-quality and stable random numbers, the prerequisite is to have an entropy source with stable properties. Existing technologies are almost all based on hardware devices to achieve entropy acquisition. For example, electronic technology, optoelectronic technology, quantum technology, etc. are used to make entropy sources. This method relies on special hardware, such as crystal oscillators, thermal noise sources, high-frequency and low-frequency oscillators, etc. In some application areas, such as mobile security, it is not desirable to introduce additional hardware facilities because it is difficult to add an additional hardware device in these areas, which makes traditional hardware-based entropy acquisition difficult to implement.

[0004] The above information disclosed in the background section is only for enhancing understanding of the background of the present application and therefore it may contain information that does not form the prior art known to a person of ordinary skill in the art. Summary of the invention

[0005] The embodiments of the present application provide an entropy collection method and device, and an electronic device to reduce the dependence of entropy collection on hardware.

[0006] According to a first aspect of an embodiment of the present application, an entropy collection method is provided, comprising: determining whether entropy needs to be collected; if entropy needs to be collected, extracting first data at least once from preset entropy pool data to form entropy data; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated at a first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends; and outputting the entropy data.

[0007] In an optional embodiment of the present application, determining whether entropy needs to be collected includes:

[0008] Determine whether a request to generate entropy data is obtained;

[0009] In the case where a request to generate entropy data is obtained, entropy needs to be collected.

[0010] In an optional embodiment of the present application, the request includes the byte length of the entropy data generated by the request; each time the first data is extracted, the length of the data to be extracted is determined according to the byte length, and the first data is extracted according to the length of the data to be extracted.

[0011] In an optional embodiment of the present application, updating the entropy pool data for the first time includes:

[0012] Starting from the number of iterations k = 0, perform the update operation. After each update operation, execute k = k + 1 and enter the next iteration;

[0013] The update operation consists of the following steps:

[0014] Determine whether k reaches a preset iteration threshold;

[0015] When k does not reach a preset iteration threshold, a memory data read / write operation is performed and a corresponding first time is obtained, at least one time variation is obtained according to the first time corresponding to the memory data read / write operation, second data is generated according to the time variation, and the second data is used to cover data of part of the bytes in the entropy pool data, or to cover data of all the bytes in the entropy pool data; the time variation is used to characterize a result of calculation using the first time and at least one second time; the second time is a time before the first time corresponding to the memory data read / write operation characterizing the end of the memory data read / write operation;

[0016] The iteration stops when k reaches the preset iteration threshold.

[0017] In an optional embodiment of the present application, generating the second data according to the time variation includes:

[0018] The first time, the time variation, and the entropy pool data before the update corresponding to the memory data read / write operation are respectively concatenated into different byte strings to obtain multiple concatenation results;

[0019] Each splicing result is encrypted respectively to obtain second data.

[0020] In an optional embodiment of the present application, before determining whether entropy needs to be collected, the entropy collection method further includes:

[0021] Generate memory data;

[0022] Set the first time to zero;

[0023] Set all bytes of data in the entropy pool data to zero and update the entropy pool data at least once.

[0024] In an optional embodiment of the present application, after the entropy data is formed, the entropy collection method further includes:

[0025] Use 0 or 1 to overwrite the memory data, entropy pool data and the first time.

[0026] According to a second aspect of an embodiment of the present application, an entropy collection device is provided, comprising: a determination module, used to determine whether entropy needs to be collected; an entropy collection module, used to extract first data at least once from preset entropy pool data to form entropy data when entropy needs to be collected; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated through a first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends; an output module, used to output the entropy data.

[0027] According to the third aspect of the embodiment of the present application, an entropy acquisition device is provided, which includes a main control module, an internal storage module, an entropy data pool module and a timer. The main control module is electrically connected to the internal storage module, the entropy data pool module and the timer respectively; the main control module executes the steps of the above method when running; the internal storage module is used to read / write data under the control of the main control module, so that the execution time of the main control module oscillates; the entropy data pool module is used to store entropy pool data; the timer is used to provide time information to the main control module.

[0028] According to a fourth aspect of the embodiments of the present application, an electronic device is provided, which includes a processor and a memory, wherein the memory stores a program code, and when the program code is executed by the processor, the processor executes the steps of the above method. Due to the adoption of the above technical solution, the embodiments of the present application have the following technical effects:

[0029] The time consumed by memory data read / write operations is not exactly the same each time. The memory read / write consumes a period of time, which serves as the basic support for data uncertainty. The entropy pool data obtained from this has uncertainty. Therefore, the entropy pool data can be output as an entropy source to generate random numbers. This method of collecting entropy does not rely on hardware such as crystal oscillators, thermal noise sources, high-frequency oscillators, and low-frequency oscillators, which reduces the dependence on hardware during entropy collection. It is especially suitable for fields such as mobile security that do not want to introduce additional hardware facilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0031] Figure 1A schematic diagram of an entropy collection method provided in an embodiment of the present application;

[0032] Figure 2 A schematic diagram of an entropy collection device provided in an embodiment of the present application;

[0033] Figure 3 A schematic diagram of an electronic device provided in an embodiment of the present application.

[0034] Figure 4 A schematic diagram of another entropy collection device provided in an embodiment of the present application; DETAILED DESCRIPTION

[0035] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0036] The existing technologies mostly use physical noise sources as entropy sources, and use the microscopic quantum mechanism or macroscopic random phenomenon of physical entropy sources in nature to generate unpredictable non-periodic random data, such as using electronic technology, optoelectronic technology, quantum technology, etc. to make entropy sources. For example, thermal noise amplification is to use a high-gain, high-bandwidth amplifier to amplify the thermal noise with a small amplitude of the circuit or electronic components to reach a certain voltage level so that it can be compared with the reference voltage of the clock synchronization comparator, thereby generating unbiased sequence data. Oscillator acquisition uses the relative relationship between two independently working high and low frequency oscillators to realize the noise source, and uses a low-frequency oscillator to sample the high frequency through a D flip-flop to generate sequence data. Entropy acquisition is almost always based on hardware devices, such as using electronic technology, optoelectronic technology, quantum technology, etc. to make entropy sources. In some application fields, such as mobile security, it is not desirable to introduce additional hardware facilities, because it is difficult to add an additional hardware device in these fields, which makes traditional hardware-based entropy acquisition difficult to implement. Secondly, a large number of hardware entropy collection devices do not use cryptographic algorithms, especially domestic cryptographic algorithms. In addition, there was a lack of relevant entropy evaluation schemes during early design and development, which means that the entropy collected and output by these devices may not meet the security and quality requirements of modern security for entropy data.

[0037] Based on this, the present application utilizes the characteristic that the time consumed by memory data read / write operations is not exactly the same each time to improve the method of obtaining entropy sources, so as to reduce the dependence on hardware in the process of collecting entropy.

[0038] Embodiment 1

[0039] like Figure 1As shown, an entropy collection method of an embodiment of the present application includes:

[0040] Step S101, determining whether entropy needs to be collected.

[0041] Step S102, when entropy needs to be collected, extract the first data at least once from the preset entropy pool data to form entropy data; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated by the first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends. When entropy collection is not required, entropy collection is not performed.

[0042] Step S103, output entropy data.

[0043] An entropy collection method using an embodiment of the present application can consume a period of time through memory reading and writing, which serves as the basic support for data uncertainty. The time consumed by the memory data read / write operation is not exactly the same each time, and the entropy pool data obtained thereby has uncertainty. Therefore, the entropy pool data can be output as an entropy source to generate random numbers. This method of collecting entropy does not rely on hardware such as crystal oscillators, thermal noise sources, high-frequency oscillators, and low-frequency oscillators, which reduces the degree of dependence on hardware during entropy collection, and is particularly suitable for fields such as mobile security where additional hardware facilities are not desired.

[0044] In some embodiments, the memory data read / write operation includes one or more of a memory data read operation and a memory data write operation.

[0045] Further, determining whether entropy needs to be collected includes: determining whether a request to generate entropy data is obtained. In the case where a request to generate entropy data is obtained, entropy needs to be collected. In the case where a request to generate entropy data is not obtained, entropy does not need to be collected. Exemplarily, the request to generate entropy data includes a random number generation request, a data encryption request, or an independent request for indicating that entropy data needs to be generated.

[0046] The above method facilitates timely entropy collection according to encryption requirements. It is not necessary to continuously collect entropy, but only perform subsequent entropy collection operations when a request to generate entropy data is obtained.

[0047] Further, the request for generating entropy data includes the byte length of the entropy data requested to be generated. It is determined whether the byte length of the requested entropy data is greater than 0. If the byte length of the requested entropy data is not greater than 0, no entropy data is output, an error message such as "request data length error" is returned to the requesting party, and the process is terminated. If the byte length of the requested entropy data is greater than 0, entropy collection is started. In some embodiments, starting entropy collection means executing step S102.

[0048] Furthermore, the request to generate entropy data includes the byte length of the entropy data requested to be generated; each time the first data is extracted, the length of the data to be extracted is determined according to the byte length, and the first data is extracted according to the length of the data to be extracted.

[0049] Since the entropy data is generated by extracting data from the entropy pool data, determining the length of the data to be extracted by the byte length of the request to be generated can ensure that the length of the generated entropy meets the requirements.

[0050] In some embodiments, the entropy pool data is stored in a preset entropy data pool module, which is used to temporarily store the collected entropy therein, and extract data from it to form the entropy data to be output when entropy needs to be collected. The entropy stored in the entropy data pool module is the entropy pool data. Exemplarily, in step S102, the first data is extracted at least once from the preset entropy pool data to form the entropy data, including: for i=0, 1, 2…, Perform the following steps: If ip+p≤L, copy the entropy pool data P of the entropy data pool module to the ip of the entropy data e to the ip+p-1th byte, that is, e[ip..ip+p-1]=P. Otherwise, in the case of ip+p>L, copy the entropy pool data P of the entropy data pool module to the ip of the entropy data e to the L-1th byte, that is, e[ip..L-1]=P[0..L-ip-1]. Among them, e is the entropy data finally obtained. L is the byte length of the entropy data requested to be generated, P is the data stored in the entropy data pool module, that is, the entropy pool data, and p is the data byte size of P, and p is not 0. Optionally, p is not less than 512B. ip+p≤L means that the cumulative length ip+p to be copied does not exceed the requested entropy data length L, and ip+p>L means that the cumulative length ip+p to be copied exceeds the requested entropy data length L. The cumulative length to be copied represents the sum of the length of the data that has been copied plus the length of the data to be copied this time. For rounding up operations, for example e[a..b] means to intercept the byte string e from the ath position (starting from 0) to the bth position from the left to form a new substring; for example, if e is the string "abcdefgh", then e[1..3] = "bcd".

[0051] Exemplarily, extracting the first data at least once from the preset entropy pool data to form entropy data in step S102 includes: extracting data of a preset length from the entropy data pool module to form entropy data to be output, until the byte length of the entropy data to be output is the same as the byte length of the entropy data requested to be generated. Optionally, extracting data of a preset length is extracting one byte of data.

[0052] Further, by updating the entropy pool data for the first time, including: starting from the iteration number k=0, performing an update operation, and executing k=k+1 after each update operation and entering the next iteration. The update operation includes the following steps:

[0053] Determine whether k reaches a preset iteration threshold; if k does not reach the preset iteration threshold, perform a memory data read / write operation and obtain a corresponding first time, obtain at least one time variation according to the first time corresponding to the memory data read / write operation, generate second data according to the time variation, and use the second data to cover data of some bytes in the entropy pool data, or cover data of all bytes in the entropy pool data; the time variation is used to characterize the result of calculation using the first time and at least one second time; the second time is the time before the first time corresponding to the memory data read / write operation that characterizes the end of the memory data read / write operation. Stop iteration when k reaches the preset iteration threshold.

[0054] Furthermore, the second data is generated according to the time variation, including: respectively splicing the first time, the time variation and the entropy pool data before updating corresponding to the memory data read / write operation into different byte strings to obtain multiple splicing results; and respectively encrypting each splicing result to obtain the second data.

[0055] Exemplarily, the entropy pool data is updated in the following manner:

[0056] Step S201, initializing the current iteration number k to 0.

[0057] Step S202, determine whether the current number of iterations k is greater than c. If k is greater than c, then end and output the updated P, M, t. Otherwise, execute step S203. Where c is a preset number of iterations threshold. Optionally, c is not less than 256. P is the data stored in the entropy data pool module, M is the memory data, t is the time information sequence, and contains i=0,1,2,….where t i Indicates the first time of the i-th acquisition, the time change for Time Variation Time Variation for i=0,1,2,…。

[0058] Step S203, perform memory data read / write operation. Exemplarily, perform x (x ≥ m) memory data read / write operations, each memory data read / write operation is to randomly replace the values ​​of any two bytes. Wherein, m is the data byte size of the memory data M. Optionally, m is not less than 32KB.

[0059] Step S204, obtaining the first time t when the memory data read / write operation ends i , i means it is the i-th acquisition time, and the time change is calculated

[0060] Step S205: Time information t i , Accumulate into the entropy data pool module. The specific method is: perform the following update on the p-byte entropy pool data P. That is, for j = 0, 1, 2, ..., p / h-1, perform:

[0061] Calculate SM3 hash value where j 32 is to represent j as a byte string with a 32-bit integer. Cover the hjth to hj+h-1th bytes of the entropy pool data P with the SM3 hash value d, that is, P[hj..hj+h-1]=d. Wherein, SM3 is a hash function, d=SM3(x) means that the 32-byte hash value d is obtained by performing SM3 hashing on the data x. h is the output byte length of the SM3 hash function, h=32. p is an integer multiple of h. || represents the concatenation of data, X||Y means that X is connected on the left and Y is connected on the right. In some embodiments, the formula The P in is the entropy pool data in the entropy data pool module, that is, the entropy pool data before updating.

[0062] Step S206, the current iteration number k is added by 1, that is, k=k+1, and then the process returns to step S202.

[0063] The present invention adopts my country's commercial cryptographic algorithm SM3, and its security can be provided by the SM3 cryptographic algorithm. The output entropy data of the present invention is obtained by repeated iteration based on the SM3 hash algorithm, and the output entropy data has an extremely high entropy value, which can reduce the amount of output entropy data under the same entropy value requirement.

[0064] Furthermore, before determining whether entropy needs to be collected, the method also includes: generating memory data; setting the first time to zero; setting all bytes of data in the entropy pool data to zero and updating the entropy pool data at least once.

[0065] Exemplarily, generating memory data includes: filling m bytes of the internal storage module with arbitrary data. Optionally, not filling all m bytes with the same number. Optionally, using i mod 256 to fill the i-th byte of the internal storage module, i=0,1,2,…,m-1.

[0066] Optionally, when the first time is set to zero, the second time and the time variation obtained according to the first time are also set to zero. Set to zero.

[0067] Furthermore, after the entropy data is formed, the method also includes: using 0 or 1 to overwrite the memory data, the entropy pool data and the first time.

[0068] Optionally, when the first time is overwritten with 0 or 1, the second time is also overwritten with 0 or 1 and the time variation obtained according to the first time is set to zero.

[0069] Embodiment 2

[0070] like Figure 2 As shown, an entropy collection device of an embodiment of the present application includes: a determination module 201, an entropy collection module 202 and an output module 203. The determination module 201 is used to determine whether entropy needs to be collected. The entropy collection module 202 is used to extract the first data from the preset entropy pool data at least once to form entropy data when entropy needs to be collected; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated through the first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends. The output module 203 is used to output entropy data.

[0071] An entropy collection device using an embodiment of the present application can consume a period of time through memory reading and writing, which serves as the basic support for data uncertainty. The time consumed by the memory data read / write operation is not exactly the same each time, and the entropy pool data obtained thereby has uncertainty. Therefore, the entropy pool data can be output as an entropy source to generate random numbers. This method of collecting entropy does not rely on hardware such as crystal oscillators, thermal noise sources, high-frequency oscillators, and low-frequency oscillators, which reduces the degree of dependence on hardware during the entropy collection process, and is particularly suitable for fields such as mobile security where additional hardware facilities are not desired.

[0072] Further, the determination module determines whether entropy needs to be collected in the following manner: determining whether a request for generating entropy data is obtained. In the case where a request for generating entropy data is obtained, entropy needs to be collected.

[0073] Further, the request to generate entropy data includes the byte length of the entropy data requested to be generated. The entropy acquisition module includes a first data extraction module, which is used to determine the length of the data to be extracted according to the byte length each time the first data is extracted, and extract the first data according to the length of the data to be extracted.

[0074] Furthermore, the entropy acquisition module includes an update module. The update module is used to perform an update operation starting from the iteration number k=0, and after each update operation, execute k=k+1 and enter the next iteration. The update operation includes the following steps:

[0075] Determine whether k reaches a preset iteration threshold; if k does not reach the preset iteration threshold, perform a memory data read / write operation and obtain a corresponding first time, obtain at least one time variation according to the first time corresponding to the memory data read / write operation, generate second data according to the time variation, and use the second data to cover data of some bytes in the entropy pool data, or cover data of all bytes in the entropy pool data; the time variation is used to characterize the result of calculation using the first time and at least one second time; the second time is the time before the first time corresponding to the memory data read / write operation that characterizes the end of the memory data read / write operation. Stop iteration when k reaches the preset iteration threshold.

[0076] Furthermore, the update module includes a second data generation module. The second data generation module is used to splice different byte strings corresponding to the first time, the time change, and the entropy pool data before the update of the memory data read / write operation to obtain multiple splicing results; and encrypt each splicing result to obtain the second data.

[0077] Furthermore, the entropy collection device also includes a memory data generation module. The memory data generation module is used to generate memory data; reset the first time to zero; reset all the data of each byte in the entropy pool data to zero and update the entropy pool data at least once.

[0078] Furthermore, the entropy collection device also includes an overwriting and erasing module. The overwriting and erasing module is used to overwrite and erase the memory data, the entropy pool data and the first time using 0 or 1.

[0079] Embodiment 3

[0080] like Figure 3 As shown, an electronic device of an embodiment of the present application includes a processor (processor) 300 and a memory (memory) 301 storing program instructions. Optionally, the electronic device may also include a communication interface (CommunicationInterface) 302 and a bus 303. Among them, the processor 300, the communication interface 302, and the memory 301 can communicate with each other through the bus 303. The communication interface 302 can be used for information transmission. The processor 300 can call the program instructions in the memory 301 to execute the entropy acquisition method of the above embodiment.

[0081] In addition, the program instructions in the above-mentioned memory 301 can be implemented in the form of software functional units and can be stored in a readable storage medium when sold or used as an independent product.

[0082] The memory 301, as a readable storage medium, can be used to store software programs and executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 300 executes functional applications and data processing by running the program instructions / modules stored in the memory 301, that is, implementing the entropy collection method in the above embodiment.

[0083] The memory 301 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 301 may include a high-speed random access memory and may also include a non-volatile memory. In some embodiments, the data storage area includes an internal storage module and an entropy data pool module, the internal storage module is used to perform read / write operations of data under the control of the processor, so that the execution time of the processor oscillates; the entropy data pool module is used to store entropy pool data.

[0084] Optionally, the electronic device includes a smart phone, a tablet computer, a computer or a server, etc.

[0085] The above-mentioned readable storage medium may be a transient readable storage medium or a non-transitory readable storage medium.

[0086] Embodiment 4

[0087] like Figure 4 As shown, an entropy collection device according to an embodiment of the present application includes:

[0088] The main control module 401 is electrically connected to the internal storage module 402, the entropy data pool module 403 and the timer 404 respectively; the main control module 401 executes the entropy acquisition method of the above embodiment when running. The internal storage module 402 is used to read / write data under the control of the main control module, so that the execution time of the main control module oscillates; the entropy data pool module 403 is used to store entropy pool data; the timer 404 is used to provide time information to the main control module.

[0089] Exemplarily, the main control module is implemented by a processor, and the internal storage module is a memory or a register of the processor.

[0090] The above-mentioned device can realize entropy collection only by using a high-precision timer. This implementation method is compatible with CPUs equipped with high-precision timers. For example, the RDTSC instruction provided by the CPU can return the number of clock cycles of the CPU since it was started. The main frequency of modern CPUs is mostly above 1GHZ, so the accuracy of the RDTSC instruction is in nanoseconds. This does not rely on other special hardware, such as crystal oscillators, thermal noise sources, high-frequency and low-frequency oscillators, etc., so the present application can be implemented in a pure software manner. In fields such as mobile security where it is not desirable to introduce additional hardware facilities, the present invention is particularly suitable for the security needs of these fields. Of course, the present invention can also be implemented in hardware, and only a hardware high-precision timer needs to be implemented to obtain high-precision time information.

[0091] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0092] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0093] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0095] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0096] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. An entropy collection method, characterized in that: include: Determine whether entropy needs to be collected; In the case where entropy needs to be collected, first data is extracted at least once from the preset entropy pool data to form entropy data; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated by a first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends; Outputting the entropy data; Before determining whether entropy needs to be collected, the method further includes: Generate memory data; Set the first time to zero; Set all bytes of data in the entropy pool data to zero and update the entropy pool data at least once; By updating the entropy pool data as soon as possible, including: Starting from the iteration number k=0, the update operation is performed. After each update operation, k=k+1 is executed and the next iteration is entered; The update operation includes the following steps: Determine whether k reaches a preset iteration threshold; When k does not reach a preset iteration threshold, a memory data read / write operation is performed and a corresponding first time is obtained, at least one time variation is obtained according to the first time corresponding to the memory data read / write operation, second data is generated according to the time variation, and the second data is used to cover data of part of the bytes in the entropy pool data, or to cover data of all the bytes in the entropy pool data; the time variation is used to characterize a result of calculation using the first time and at least one second time; the second time is a time before the first time corresponding to the memory data read / write operation characterizing the end of the memory data read / write operation; The iteration stops when k reaches the preset iteration threshold.

2. The method according to claim 1, characterized in that Determine whether entropy needs to be collected, including: Determine whether a request to generate entropy data is obtained; In the case where a request to generate entropy data is obtained, entropy needs to be collected.

3. The method according to claim 2, characterized in that The request includes the byte length of the entropy data requested to be generated; each time the first data is extracted, the length of the data to be extracted is determined according to the byte length, and the first data is extracted according to the length of the data to be extracted.

4. The method according to claim 1, characterized in that: Generating second data according to the time variation includes: The first time corresponding to the memory data read / write operation, the time variation, and the entropy pool data before updating are respectively concatenated into different byte strings to obtain multiple concatenation results; Each splicing result is encrypted respectively to obtain second data.

5. The method according to claim 1, characterized in that After the entropy data is formed, the method further includes: Use 0 or 1 to overwrite the memory data, entropy pool data and the first time.

6. An entropy collection device, characterized in that: include: A determination module is used to determine whether entropy needs to be collected; An entropy acquisition module is used to extract first data from preset entropy pool data at least once to form entropy data when entropy needs to be collected; wherein the entropy pool data is updated once before each extraction of the first data; the entropy pool data is updated by a first time; the first time is the time when a memory data read / write operation is performed and the memory data read / write operation ends; An output module, used for outputting the entropy data; It also includes a generation module, specifically used to, Before determining whether entropy needs to be collected, the following is also included: Generate memory data; Set the first time to zero; Set all bytes of data in the entropy pool data to zero and update the entropy pool data at least once; The entropy acquisition module is specifically used to: By updating the entropy pool data as soon as possible, including: Starting from the iteration number k=0, the update operation is performed. After each update operation, k=k+1 is executed and the next iteration is entered; The update operation includes the following steps: Determine whether k reaches a preset iteration threshold; When k does not reach a preset iteration threshold, a memory data read / write operation is performed and a corresponding first time is obtained, at least one time variation is obtained according to the first time corresponding to the memory data read / write operation, second data is generated according to the time variation, and the second data is used to cover data of part of the bytes in the entropy pool data, or to cover data of all the bytes in the entropy pool data; the time variation is used to characterize a result of calculation using the first time and at least one second time; the second time is a time before the first time corresponding to the memory data read / write operation characterizing the end of the memory data read / write operation; The iteration stops when k reaches the preset iteration threshold.

7. The entropy collection device according to claim 6, characterized in that: The determination module is specifically used to: Determine whether a request to generate entropy data is obtained; In the case where a request to generate entropy data is obtained, entropy needs to be collected.

8. The entropy collection device according to claim 7, characterized in that: The determination module is specifically used for: The request includes the byte length of the entropy data requested to be generated; each time the first data is extracted, the length of the data to be extracted is determined according to the byte length, and the first data is extracted according to the length of the data to be extracted.

9. The entropy collection device according to claim 6, characterized in that: The entropy acquisition module is specifically used to: Generating second data according to the time variation includes: The first time corresponding to the memory data read / write operation, the time variation, and the entropy pool data before updating are respectively concatenated into different byte strings to obtain multiple concatenation results; Each splicing result is encrypted respectively to obtain second data.

10. The entropy collection device according to claim 6, characterized in that: The entropy acquisition module is specifically used to, after forming entropy data, Use 0 or 1 to overwrite the memory data, entropy pool data and the first time.

11. An entropy collection device, characterized in that: include: A main control module, electrically connected to the internal storage module, the entropy data pool module and the timer respectively; the main control module executes the steps of any one of the methods of claims 1 to 5 when running; The internal storage module is used to execute the read / write operation of data under the control of the main control module, so that the execution time of the main control module fluctuates; The entropy data pool module is used to store entropy pool data; The timer is used to provide time information to the main control module.

12. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of any one of the methods in claims 1 to 5.

13. A computer storage medium, characterized in that: Executable instructions are stored, and when the executable instructions are executed, they are used to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Entropy extraction method and circuit based on SRAM PUF (Static Random Access Memory Physical Unclonable Function)

    CN106055491A

  • Minimum entropy kernel density estimator generation method, apparatus, and computer-readable storage medium

    CN109388784A

  • Multi-entropy source random number generator with physical unclonable function function

    CN113672199A

  • Generation device and method of true random number, equipment and storage medium

    CN116185341A

  • High-entropy random number generation method in physical unclonable function hardware

    CN116527238A