Random number seed generation method and apparatus
By writing reference values into the firmware system of electronic devices and reducing the refresh rate of the memory storage area, the problem of generating unclonable random number seeds is solved by utilizing the charge decay characteristics of memory, thus improving data encryption security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LENOVO (BEIJING) LTD
- Filing Date
- 2023-03-27
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies make it difficult to conveniently generate non-clonable random number seeds on electronic devices, which affects data security.
The firmware system obtains a reference value after startup, writes it to a designated memory storage area, reduces the refresh rate of that storage area, and utilizes the charge decay characteristics of memory to generate a unique and unclonable random number seed.
It achieves the generation of unclonable random number seeds at the software level, improving the security of data encryption, reducing generation complexity, and requiring no hardware changes.
Smart Images

Figure CN116301725B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method and apparatus for generating random number seeds. Background Technology
[0002] Random number seeds are required in security algorithms involving key generation and encryption / decryption.
[0003] To ensure data security, the generated random number seed must be unique and unclonable. Therefore, how to conveniently generate unclonable random number seeds on electronic devices is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] On the one hand, this application provides a method for generating random number seeds, including:
[0005] After the firmware system boots up, a reference value is obtained through the firmware system;
[0006] Write the reference value into a designated storage area in memory;
[0007] Reduce the refresh rate of the specified storage area in the memory;
[0008] The updated value of the reference value is obtained from the designated storage area, wherein the updated value is the value obtained because the refresh rate of the designated storage area has decreased, causing the reference value to change.
[0009] Based on the updated value, a random number seed is determined.
[0010] In one possible implementation, after reducing the refresh rate of the specified storage area in the memory, the method further includes:
[0011] The refresh rate of the specified storage area in the memory is adjusted to a base refresh rate, where the base refresh rate is the refresh rate of the specified storage area before the refresh rate of the specified storage area is reduced.
[0012] In another possible implementation, obtaining the updated value of the reference value from the designated storage area includes:
[0013] After a set time has elapsed since the refresh rate of the specified storage area was reduced, the updated value of the reference value is obtained from the specified storage area.
[0014] In another possible implementation, the set duration is a duration determined based on the first random information.
[0015] In yet another possible implementation, obtaining a reference value via the firmware system includes:
[0016] The initial value stored in the read-only memory is obtained through the firmware system;
[0017] Based on the initial values, a reference value is determined.
[0018] In yet another possible implementation, determining the reference value based on the initial value includes:
[0019] A first hash value of a first set length is generated based on the initial value, and the first hash value is determined as a reference value.
[0020] In another possible implementation, after obtaining the initial value stored in the read-only memory via the firmware system, the following is also included:
[0021] Add the set value to the initial value to obtain the updated initial value;
[0022] Replace the initial value stored in the read-only memory with the updated initial value.
[0023] In another possible implementation, determining the random number seed based on the updated value includes:
[0024] Based on the updated value, a second hash value of a second set length is generated, and the second hash value is determined as a random number seed.
[0025] In yet another possible implementation, reducing the refresh rate of the specified storage area in the memory includes:
[0026] Send a refresh adjustment command to the memory controller, the refresh adjustment command being used to instruct to reduce or pause the refresh of the specified memory area;
[0027] The refresh rate of the specified storage area is reduced by the memory controller.
[0028] Furthermore, this application also provides a random number seed generation device, comprising:
[0029] The reference value acquisition unit is used to obtain a reference value through the firmware system after the firmware system starts up.
[0030] A numerical storage unit is used to write the reference value into a designated storage area in memory;
[0031] A refresh reduction unit is used to reduce the refresh rate of the specified storage area in the memory;
[0032] An update value obtaining unit is used to obtain an update value of the reference value from the designated storage area, wherein the update value is a value obtained because the reference value changes due to a decrease in the refresh rate of the designated storage area;
[0033] A seed generation unit is used to determine a random number seed based on the updated value. Attached Figure Description
[0034] 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 embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0035] Figure 1 This paper illustrates a flowchart of a random number seed generation method provided in an embodiment of this application.
[0036] Figure 2 This paper illustrates a flowchart of a random number seed generation method provided in an embodiment of this application.
[0037] Figure 3 This illustration shows a schematic diagram of the implementation principle framework of the random number seed generation method provided in an embodiment of this application;
[0038] Figure 4 This illustration shows another flowchart of the random number seed generation method provided in the embodiments of this application;
[0039] Figure 5 This illustration shows a schematic diagram of the composition structure of a random number seed generation device provided in an embodiment of this application;
[0040] Figure 6 A schematic diagram of the component architecture of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0041] 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, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0042] like Figure 1The illustration shows a flowchart of a random number seed generation method provided in an embodiment of this application. The solution of this embodiment can be applied to electronic devices, such as mobile phones, laptops, tablets, desktop computers, or smart home devices, without limitation.
[0043] The method in this embodiment may include:
[0044] S101 obtains a reference value through the firmware system after the firmware system starts up.
[0045] Firmware refers to the drivers stored internally in an electronic device, typically on its storage medium, such as the motherboard's memory. Firmware performs the most basic and lowest-level software functions, enabling the operating system to execute specific components according to standard device drivers.
[0046] In one possible scenario, the firmware system is a firmware interface used to facilitate the booting of the auxiliary operating system and hardware initialization, thereby enabling software and hardware connectivity.
[0047] For example, the firmware system could be a Basic Input Output System (BIOS). The BIOS is responsible for detecting hardware functions and booting the operating system when the electronic device is powered on, thus enabling the connection between software and hardware. For instance, the BIOS program implements self-test and initialization procedures, hardware interrupt handling, and program service requests.
[0048] For example, the firmware system can also be a Unified Extensible Firmware Interface (UEFI), which serves as an alternative to BIOS and can be responsible for power-on self-test (POST), communication with the operating system, and providing an interface for connecting the operating system and hardware.
[0049] The above is an example of a firmware system serving as a firmware interface program. In practical applications, the firmware system can also be other possibilities. Any firmware system in an electronic device that can be updated or upgraded by modifying its configuration items is applicable to this application.
[0050] It is understandable that the firmware system is started every time the electronic device is powered on, and the operation of generating random number seeds in this case can be triggered through the firmware system.
[0051] The reference value can be a randomly generated or determined value to further ensure the uniqueness of the random number seed generated subsequently.
[0052] There are many possible ways to obtain this reference value, and this application does not impose any restrictions on them.
[0053] For example, the firmware system can randomly generate a value as a reference value, or a unique value can be obtained using a clock or other means.
[0054] In one possible implementation, a reference value can be generated based on the value stored in the read-only memory (ROM) of the electronic device. The value stored in the ROM is dynamic, and the value obtained from the ROM may be different on different occasions when the electronic device is powered on.
[0055] For ease of distinction, the values stored in the ROM are called initial values. Correspondingly, after obtaining the initial values stored in the ROM through the firmware system, reference values can be determined based on the initial values.
[0056] For example, a hash value of a set length can be generated based on the initial value, and this hash value can be used as a reference value. This set length can be set as needed. For instance, a Secure Hash Algorithm (SHA) can be used to hash the initial value, and the resulting hash value can be used as the reference value. For example, the SHA256 algorithm can be used to hash the initial value, and the resulting 256-bit hash value can be used as the reference value.
[0057] Of course, there are other possible ways to determine the reference value based on this initial value, and there are no restrictions on this.
[0058] S102, write the reference value to the specified storage area in memory.
[0059] In this application, the memory is a dynamically refreshed memory to avoid data loss due to memory charge decay.
[0060] For example, this memory is Dynamic Random Access Memory (DRAM). DRAM is a component that provides temporary data storage for electronic devices. The basic principle of DRAM is to store data by storing charge in a small capacitor. However, due to leakage current in transistors, the amount of charge stored in the capacitor may not be sufficient to correctly identify the data, leading to data corruption. Therefore, periodic charging is an unavoidable requirement for DRAM. Based on this, DRAM needs to be constantly refreshed to retain data; otherwise, charge decay will lead to data loss.
[0061] The designated memory storage area is a region set in memory to store the reference value associated with the random number seed.
[0062] Understandably, electronic devices can store reference values in a designated memory area through the firmware system.
[0063] S103, reduce the refresh rate of the specified storage area in memory.
[0064] As mentioned earlier, memory is constantly refreshed. Once the refresh rate of memory decreases or stops refreshing, there will be charge decay in the memory. However, since the decay characteristics of different memory are fixed and cannot be copied, this application can utilize this decay characteristic of memory to generate a unique and unclonable random number seed.
[0065] Based on this, this application is equivalent to applying Physically Unclonable Functions (PUF) technology in memory. PUF technology utilizes inherent device variations to produce a unique, non-clonable device response to a given input. It uses inherent process variations in integrated circuits to generate unique encryption keys. PUF technology helps protect data because cloning a PUF is impossible, which significantly increases the difficulty of breaking cryptography.
[0066] Understandably, to avoid affecting other data in memory, this application will only reduce the refresh rate of the specified memory area. Reducing the refresh rate of the specified memory area can be done by controlling the refresh rate of the specified memory area to be lower than a baseline refresh rate set in memory; or it can be done by reducing the refresh rate of the specified memory area to zero, thereby pausing the refresh of the specified memory area.
[0067] In one possible implementation, the refresh rate of a specified region in memory can be reduced by the memory controller. For example, a refresh adjustment command can be sent to the memory controller, instructing it to reduce or pause the refresh of the specified memory region. Accordingly, the memory controller can control the reduction of the refresh rate of the specified memory region.
[0068] S104, obtain the updated value of the reference value from the specified storage area in memory.
[0069] The updated value is obtained because the refresh rate of the specified storage area has decreased, causing the reference value to change.
[0070] It is understandable that after storing the reference value in a designated memory area, if the refresh rate of that designated memory area decreases, the charge in that designated memory area will decay, and this decay will cause the data stored in that designated memory area to change. Therefore, after reducing the refresh rate of the designated memory area, the value after the reference value changes is called the updated value.
[0071] As mentioned above, different memory modules have different charge decay characteristics. Therefore, when the same value is stored in the memory of different electronic devices, the change in the value will be different due to the charge decay of the memory. Based on this, a unique and non-cloning updated value can be obtained by reducing the refresh rate of a specified memory area.
[0072] S105, Determine the random number seed based on the updated value.
[0073] There are several possible ways to determine the random number seed.
[0074] For example, this updated value can be used as a random number seed.
[0075] For example, the updated value is encoded according to the set encoding method, and the encoded value is determined as the random number seed.
[0076] For example, a hash value of a set length can be generated based on the updated value, and this hash value can be used as a random number seed. For clarity, the hash value generated earlier based on the initial value is called the first hash value, while the hash value generated here based on the updated value is called the second hash value. The set length corresponding to the first hash value is called the first set length, and the set length corresponding to the second hash value is called the second set length. The first set length and the second set length can be the same or different.
[0077] In generating the second hash value, various algorithms can be used. For example, the SHA algorithm can be used to calculate the hash value of the updated value to obtain the random number seed. For instance, the SHA256 algorithm can be used to perform hash calculation on the updated value, and the resulting 256-bit hash value can be determined as the random number seed.
[0078] Understandably, once the random number seed is determined, it can be used by the hardware or software program in the electronic device to generate a key, perform anti-counterfeiting processing or other processing based on the random number seed, without any restrictions.
[0079] Throughout the entire operation of the electronic device from powering on to powering off, the electronic device can perform encryption-related operations based on this random number seed. The random number seed generated each time the electronic device is powered on will be different, which helps to improve the security of encryption processing based on the random number seed.
[0080] As can be seen from the above, in this embodiment of the application, after the firmware system starts, a reference value can be obtained through the firmware system. This reference value is written into a designated storage area in memory, and the refresh rate of the designated storage area in memory is reduced. Based on this, since the memory undergoes charge decay after the refresh rate is reduced, and utilizing the non-cloning characteristic of the memory's charge decay, a unique and non-cloning updated value can be obtained based on the reference value. Therefore, the random number seed determined based on this updated value is a non-cloning random number seed, thus realizing the combination of memory and non-cloning technology to generate random number seeds.
[0081] Moreover, the random number seed generated by the scheme in this application can be implemented at the software level without changing the hardware of the electronic device, which reduces the complexity of generating random number seeds using electronic devices.
[0082] It is understood that, in this embodiment of the application, after reducing the refresh rate of the specified storage area in memory, in order to ensure the normal refresh of the specified storage area in memory, the application will also adjust the refresh rate of the specified storage area in memory to a base refresh rate. The base refresh rate is the refresh rate of the specified storage area before the refresh rate of the specified storage area was reduced.
[0083] Adjusting the refresh rate of a specified memory area to restore it to the baseline refresh rate can be done at any time after the refresh rate of the specified memory area has been reduced, as long as the refresh rate of the specified memory area can be changed so that the reference value in the specified memory area changes.
[0084] For example, after reducing the refresh rate of a specified storage area to a target duration, the refresh rate of the specified storage area can be restored to the base refresh rate. This target duration can be set as needed.
[0085] For example, suppose that lowering the refresh rate of a specified memory area pauses the refresh of that specified memory area in memory. Since the charge of the specified memory area will decay quickly after the refresh of the specified memory area is paused, the reference value stored in the specified memory area will change. Therefore, the refresh rate of the specified memory area can be restored at any time after the refresh of the specified memory area is paused.
[0086] It is understandable that after reducing the refresh rate of a specified memory area, the reference data within that memory area will change. However, after restoring the refresh rate of the specified memory area to the base refresh rate, the data stored in the specified memory area will no longer change. Based on this, in one possible implementation, this application could obtain updated data from the specified memory area after the reference data has changed, following the restoration of the refresh rate of the specified memory area to the base refresh rate. In this case, the updated data is the value obtained by observing the change in the reference value due to charge decay during the period between reducing the refresh rate of the specified memory area and restoring it to the base refresh rate.
[0087] To facilitate understanding, the following example illustrates how lowering the refresh rate of a specified memory region in memory pauses the refresh of that region, and also demonstrates an implementation method for obtaining a reference value from the specified memory region. Figure 2 As shown, it illustrates another flowchart of the random number seed generation method provided in this application embodiment. The method of this embodiment may include:
[0088] S201, after the firmware system starts up, obtains a reference value through the firmware system.
[0089] This step can be found in the previous related introduction, and will not be repeated here.
[0090] S202, the firmware system writes the reference value into a designated storage area in memory.
[0091] For example, the firmware system can control the memory controller to write the reference value to a designated storage area of the memory. For instance, the firmware system can send a data write command to the memory controller, which includes the reference value, and the memory controller, in response to the data write command, stores the reference value in the designated storage area of the memory.
[0092] For example, by means of address mapping, the firmware system can obtain the address of the specified storage area in memory, and the firmware system can also write the reference value to the specified storage area in memory directly or through the memory controller.
[0093] S203 controls the pause of refreshing a specified memory area.
[0094] For example, a refresh adjustment command is sent to the memory controller via the firmware system. This refresh adjustment command instructs the refresh of the specified memory area to be paused. Accordingly, the memory controller responds to the refresh adjustment command and controls the pause of the refresh of the specified memory area.
[0095] Of course, there are other ways to control the pausing of refreshing the specified storage area, and there are no restrictions on this.
[0096] S204 restores the refresh rate of the specified storage area in memory to the base refresh rate.
[0097] The baseline refresh rate is the refresh rate of the specified storage area before pausing the refresh rate of that specified storage area.
[0098] For example, the firmware system sends a refresh recovery command to the memory controller, which instructs the refresh of a specified memory area to be restored. Correspondingly, the memory controller responds to the refresh recovery command by controlling the restoration of the specified memory area to the base refresh rate.
[0099] It is understandable that, as mentioned above, this step can be executed at any time after S203. Of course, a target duration can also be set, and after the duration of pausing the refresh of the storage area in memory reaches the set target duration, the refresh of the specified storage area in memory is resumed and the refresh rate of the specified storage area is restored to the base refresh rate.
[0100] S205, Obtain the updated value of the reference value from the specified storage area.
[0101] The updated value is a value obtained by changing the reference value due to the charge decay in the specified storage area caused by the pause in refreshing the specified storage area.
[0102] For example, based on the address of a specified storage area, the data stored in that specified storage area is read to obtain the updated value. Alternatively, the firmware system can read the data stored in that specified storage area based on its address to obtain the updated value.
[0103] For example, the firmware system can read the updated value corresponding to the reference data stored in the specified memory area through the memory controller. For instance, the firmware system sends a data read request to the memory controller to request the reading of data in the specified memory area. In response to the data read request, the memory controller retrieves the updated data from the specified memory area and returns it to the firmware system.
[0104] S206. Based on this updated value, determine the random number seed.
[0105] This step can be referred to in the relevant description of the previous embodiments, and will not be repeated here.
[0106] It is understood that, in any embodiment of this application, in order to enable the electronic device to obtain the random number seed at any time, after determining the random number seed, this application may also store the random number seed in a storage area outside the designated storage area in memory. Based on this, when the hardware or software program in the electronic device needs to perform encryption operations based on the random number seed, it can obtain the random number seed from memory.
[0107] As you can understand, the above content illustrates how to first reduce or pause the refresh rate of a specified memory area, and then read the updated value in that specified memory area after restoring the refresh rate of the specified memory area to the base refresh rate.
[0108] However, in practical applications, it is also possible to read the updated values of the specified storage area before or simultaneously with restoring the refresh rate of the specified storage area.
[0109] For example, in another possible implementation, this application may also obtain the updated value of the reference value from the specified storage area when the refresh rate of the specified storage area of memory is reduced for a set period of time.
[0110] The set duration can be adjusted as needed. It can be the same as the target duration for reducing the refresh rate of the specified storage area, so that while restoring the refresh rate of the specified storage area, the updated value after the reference value has been updated is obtained. Of course, the set duration can also be less than the target duration.
[0111] Specifically, the set duration can also be a duration determined based on the first random information to further increase the randomness of the updated value. The first random information can be a randomly generated value or a value randomly selected within a range of values. For example, a random duration can be selected within a set random duration range and determined as the set duration.
[0112] Correspondingly, while or after reading the updated value of the reference value from the specified storage area, the refresh rate of the specified storage area can be adjusted to the base refresh rate.
[0113] It is understood that, in order to further improve the randomness and non-cloning properties of the random number seed, this application can read the initial value from the read-only memory when obtaining the reference value, and determine the reference value based on the initial value.
[0114] In order to ensure that the data read from the read-only memory is different each time, after obtaining the initial value from the read-only memory (or after determining the reference value based on the initial value), this application adds a set value to the initial value to obtain an updated initial value, and then replaces the initial value stored in the read-only memory with the updated initial value.
[0115] Based on this, since the initial value is updated each time it is read from the read-only memory, the initial value read by the firmware system from the read-only memory will be different from the initial value read last time when the electronic device is powered on and the firmware system is started. This ensures that the firmware system generates a random number seed based on a different reference value each time it is started, further improving the security of the random number seed.
[0116] To facilitate understanding, the following explanation uses BIOS as the firmware system and DRAM as the memory as an example, and is illustrated with a specific implementation.
[0117] The following is combined Figure 3 The following diagram illustrates one implementation principle framework of the solution proposed in this application.
[0118] exist Figure 3 Based on this, taking the generation of random number seeds controlled by BIOS as an example, in order to implement the method of this application based on BIOS, a driver program required to implement the method of this application can be configured in the BIOS chip.
[0119] Depend on Figure 3 It can be seen that the process of the BIOS completing the random number seed involves interaction with the read-only memory (ROM), flash memory controller, dynamic random access memory (DRAM), and memory controller.
[0120] The following is combined Figure 3 The process of generating random number seeds is described using a flowchart.
[0121] like Figure 4 As shown, this illustrates another implementation flowchart of the random number seed generation method of this application. The method in this embodiment may include:
[0122] S401, after the BIOS program starts, the BIOS program obtains the initial values stored in the ROM based on the flash memory controller.
[0123] For ease of distinction, the values stored in the ROM are referred to as the initial values.
[0124] For example, by mapping the ROM address to a memory address through memory mapping, the BIOS program can directly read the value stored in the ROM through the memory controller.
[0125] For example, combining Figure 3 In this process, the BIOS program can send a request to the flash memory controller to read data from the ROM, thereby obtaining the initial values stored in the ROM through the flash memory controller.
[0126] S402 generates a first hash value of a first set length based on the initial value through the BIOS program.
[0127] For example, the driver in the BIOS program uses the SHA256 algorithm to hash the initial value and obtain the first hash value of 256 bits.
[0128] The first hash value is used as a reference value.
[0129] S403 stores the first hash value into a designated memory area of DRAM via the BIOS program based on the memory controller.
[0130] Combination Figure 3 It is known that the BIOS program can send a data storage request, which includes the first hash value, to the memory controller to request data to be stored in a specified memory area in the DRAM, so that the memory controller stores the first hash value in the specified memory area in the DRAM.
[0131] S404 uses the BIOS program to add a set value to the initial value to obtain the updated initial value.
[0132] The setting value can be set as needed. For example, if the setting value is 1, then the initial value can be increased by 1.
[0133] S405, the BIOS program replaces the initial value stored in the read-only memory with the updated initial value through flash memory.
[0134] like Figure 3 As shown, the BIOS program can send a store command to the read-only memory through the flash memory controller. This store command carries the updated initial value, so that the ROM will replace the stored initial value with the updated initial data.
[0135] Understandably, each time the BIOS program reads an initial value from the ROM, it adds a set value to the initial value and then stores the added initial value back into the ROM to update the initial value stored in the ROM. Thus, the next time the BIOS program reads an initial value from the ROM, the updated initial value will be different from the initial value read in step S402, resulting in a different initial value used by the BIOS program to generate the random number seed each time it starts.
[0136] It is understood that the order of steps S404 and S405 with step S403 is not limited. Figure 4 As shown, in practical applications, steps S403 and S405 can be executed before step S403 or simultaneously with step S403, without any restrictions.
[0137] S406 sends a refresh adjustment command to the memory controller via the BIOS program, so that the memory controller can control the reduction of the refresh rate of the specified memory area in DRAM.
[0138] This refresh adjustment command is used to reduce the refresh rate of the specified memory area in the paused DRAM.
[0139] In this embodiment, the refresh rate of a specified memory area in DRAM is reduced as an example. However, this embodiment also applies to pausing the refresh of a specified memory area in DRAM, and there is no limitation on this.
[0140] S407, after the set time has elapsed since the refresh rate of the specified memory area was reduced, obtains the updated value obtained by decaying the first hash value from the specified memory area through the BIOS program.
[0141] The BIOS program can also obtain the updated value directly from the specified memory without any restrictions.
[0142] like Figure 3 The BIOS program can obtain the updated value from the specified memory through this memory controller.
[0143] S408 generates a second hash value of a second set length based on the updated value through the BIOS program, and determines the second hash value as the random number seed.
[0144] For example, the BIOS program uses the SHA256 algorithm to perform hash calculation on the updated value, and obtains a second hash value of 256 bits.
[0145] S409 stores the random number seed in a region outside the specified memory area in DRAM via the BIOS program.
[0146] Depend on Figure 3 As can be seen, after the BIOS program stores the random number seed in a region outside the specified memory area in DRAM, if the program in the electronic device needs to obtain the random number seed, it can obtain the random number seed from that memory through the operating system so as to perform security processing such as encryption based on the random number seed.
[0147] Corresponding to the random number seed generation method provided in the embodiments of this application, this application also provides a random number seed generation apparatus.
[0148] like Figure 5 The diagram illustrates a structural composition of a random number seed generation device provided in this embodiment. This device can be applied to electronic devices. The device may include:
[0149] The reference value acquisition unit 501 is used to obtain a reference value through the firmware system after the firmware system is started.
[0150] The numerical storage unit 502 is used to write the reference value into a designated storage area in memory;
[0151] The refresh reduction unit 503 is used to reduce the refresh rate of the specified storage area in the memory.
[0152] The update value acquisition unit 504 is used to obtain the update value of the reference value from the designated storage area. The update value is the value obtained because the reference value changes due to the decrease in the refresh rate of the designated storage area.
[0153] Seed generation unit 505 is used to determine a random number seed based on the updated value.
[0154] In one possible implementation, the device further includes:
[0155] The refresh recovery unit is used to adjust the refresh rate of the specified memory area in the memory to a base refresh rate after the refresh reduction unit reduces the refresh rate of the specified memory area in the memory. The base refresh rate is the refresh rate of the specified memory area before the refresh rate of the specified memory area was reduced.
[0156] In another possible implementation, the update value acquisition unit includes:
[0157] The update value acquisition sub-unit is used to obtain the updated value of the reference value from the specified storage area after a set time has elapsed since the refresh rate of the specified storage area was reduced.
[0158] In one possible implementation, the set duration is a duration determined based on the first random information.
[0159] In yet another possible implementation, the reference value acquisition unit includes:
[0160] An initial value acquisition unit is used to obtain the initial value stored in the read-only memory through the firmware system;
[0161] The reference value determination unit is used to determine a reference value based on the initial value.
[0162] In another possible implementation, the reference value determination unit includes:
[0163] The reference value determination subunit is used to generate a first hash value of a first set length based on the initial value, and to determine the first hash value as the reference value.
[0164] In yet another possible implementation, the device further includes:
[0165] The initial value update unit is used to add a set value to the initial value after the initial value acquisition unit obtains the initial value, so as to obtain the updated initial value.
[0166] An initial value replacement unit is used to replace the initial value stored in the read-only memory with the updated initial value.
[0167] In yet another possible implementation, the seed generation unit includes:
[0168] The seed generation subunit is used to generate a second hash value of a second set length based on the updated value, and to determine the second hash value as the random number seed.
[0169] In another possible implementation, the refresh rate reduction unit includes:
[0170] The command sending unit is used to send a refresh adjustment command to the memory controller, which is used to instruct to reduce or pause the refresh of the specified memory area;
[0171] Reduce execution unit, used to reduce the refresh rate of the specified memory area through the memory controller.
[0172] Furthermore, this application also provides an electronic device, such as Figure 6 As shown, it illustrates a schematic diagram of the composition structure of the electronic device. The electronic device can be any type of electronic device, and the electronic device includes at least a firmware module 601, a memory 602, and a storage device 603.
[0173] The firmware module 601 is used to execute the random number seed generation method in any of the above embodiments.
[0174] The memory 603 is used to store the programs required for the firmware module to perform operations.
[0175] Understandably, the electronic device may also include a read-only memory 604.
[0176] Of course, the electronic device can also have more than Figure 6 There are no restrictions on the number of components, whether more or fewer.
[0177] On the other hand, this application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the random number seed generation method as described in any of the above embodiments.
[0178] This application also proposes a computer program comprising computer instructions stored in a computer-readable storage medium. When run on an electronic device, the computer program performs the random number seed generation method as described in any of the above embodiments.
[0179] It is understood that in this application, the terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar parts and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that illustrated herein.
[0180] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. Furthermore, the features described in the various embodiments of this specification can be substituted or combined with each other, enabling those skilled in the art to implement or use this application. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0181] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0182] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0183] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for generating a random number seed, comprising: After the firmware system boots up, a reference value is obtained through the firmware system; Write the reference value into a designated storage area in memory; Reduce the refresh rate of the specified storage area in the memory; The updated value of the reference value is obtained from the designated storage area, wherein the updated value is the value obtained because the refresh rate of the designated storage area has decreased, causing the reference value to change. Based on the updated value, a random number seed is determined.
2. The method according to claim 1, further comprising, after reducing the refresh rate of the specified storage area in the memory: The refresh rate of the specified storage area in the memory is adjusted to a base refresh rate, where the base refresh rate is the refresh rate of the specified storage area before the refresh rate of the specified storage area is reduced.
3. The method according to claim 1 or 2, wherein obtaining the updated value of the reference value from the designated storage area comprises: After a set time has elapsed since the refresh rate of the specified storage area was reduced, the updated value of the reference value is obtained from the specified storage area.
4. The method according to claim 3, wherein the set duration is a duration determined based on the first random information.
5. The method according to claim 1, wherein obtaining a reference value through the firmware system comprises: The initial value stored in the read-only memory is obtained through the firmware system; Based on the initial values, a reference value is determined.
6. The method according to claim 5, wherein determining the reference value based on the initial value includes: A first hash value of a first set length is generated based on the initial value, and the first hash value is determined as a reference value.
7. The method according to claim 5, further comprising, after obtaining the initial value stored in the read-only memory through the firmware system: Add the set value to the initial value to obtain the updated initial value; Replace the initial value stored in the read-only memory with the updated initial value.
8. The method according to claim 1, 5, or 6, wherein determining the random number seed based on the updated value includes: Based on the updated value, a second hash value of a second set length is generated, and the second hash value is determined as a random number seed.
9. The method according to claim 1, wherein reducing the refresh rate of the specified storage area in the memory comprises: Send a refresh adjustment command to the memory controller, the refresh adjustment command being used to instruct to reduce or pause the refresh of the specified memory area; The refresh rate of the specified storage area is reduced by the memory controller.
10. A random number seed generation device, comprising: The reference value acquisition unit is used to obtain a reference value through the firmware system after the firmware system starts up. A numerical storage unit is used to write the reference value into a designated storage area in memory; A refresh reduction unit is used to reduce the refresh rate of the specified storage area in the memory; An update value obtaining unit is used to obtain an update value of the reference value from the designated storage area, wherein the update value is a value obtained because the reference value changes due to a decrease in the refresh rate of the designated storage area; A seed generation unit is used to determine a random number seed based on the updated value.
Citation Information
Patent Citations
Random verification method and device for verifying processor chip after manufacturing
CN101826050A
Random number acquisition method, random number acquisition device, random number acquisition system and storage medium
CN109801427A