A rollback protection device and related methods
By using a real-time clock, timestamp memory, and logic circuits in the anti-rollback protection device, the new time is compared with the stored timestamp, and updates are only made when the new time is later than the original timestamp. This solves the problem of the real-time clock being maliciously rolled back and improves system security.
Patent Information
- Application Number
- CN202111039591.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-04-12
- Filing Date
- 2021-09-06
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2041-09-06
AI Technical Summary
Existing technologies are insufficient to effectively prevent real-time clocks from being maliciously tampered with and rolled back, leading to a decline in system security.
A rollback protection device is adopted, including a real-time clock, a timestamp memory, and a real-time clock logic circuit. By comparing the new time with the stored timestamp, the real-time clock is updated only when the new time is later than the original timestamp, thus preventing rollback.
It ensures that the timestamp of the real-time clock is not maliciously rolled back, enhances system security, prevents degradation attacks, and is suitable for real-time clock operations in single-chip systems.
Smart Images

Figure CN115202437B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present invention relates to a rollback protection technique, and in particular, to a real-time clock with rollback protection and a method thereof. BACKGROUND
[0002] A single-chip system typically includes one or more processors, associated memory, logic, and interfaces. These systems contain a real-time clock (RTC) to indicate time and keep track of date and time. When the system is powered off, the real-time clock continues to run on a backup power source, even when the rest of the system is powered off, and the real-time clock continues to maintain accuracy.
[0003] The real-time clock is a critical element of many electronic systems because it is used to maintain system infrastructure, such as network time stamps, file edit dates, calendar functions, and the like, which are dependent on the accuracy of the real-time clock.
[0004] Many security features of a single-chip system also use time stamps provided by the real-time clock. For example, system access credentials contain time stamps. In addition, software versions are enabled or disabled at certain times.
[0005] The real-time clock is critical to maintaining accurate time, and the real-time clock needs to be protected from malicious tampering with the time setting. The most common attack on a real-time clock is a hacker rolling back time to a past time to achieve a downgrade attack by setting the real-time clock to a time in the past. Therefore, a mechanism is needed to prevent the real-time clock from being rolled back, and a method is needed to ensure that the real-time clock (RTC) never rolls back beyond a checkpoint date and time, so that security attacks that rely on setting the real-time clock (RTC) to a time in the past can be overcome. SUMMARY
[0006] The present invention provides a rollback protection device, including a real-time clock (RTC), a time stamp memory, and a real-time clock logic circuit. The real-time clock is used to generate a current time. The time stamp memory is coupled to the real-time clock and stores an original time stamp. The real-time clock logic circuit is coupled to the time stamp memory and the real-time clock, and is used to update the current time generated by the real-time clock to a new time only when the new time is later than the original time recorded by the original time stamp.
[0007] The present application provides a method for preventing rollback protection, which is used in a rollback protection device. The rollback protection device includes a real-time clock, a time stamp memory and a real-time clock logic circuit. The method for preventing rollback protection includes the real-time clock logic circuit receiving a request for updating the real-time clock to a new time, confirming whether the new time is later than an original time recorded by an original time stamp stored in the time stamp memory, and updating the real-time clock to the new time if the new time is later than the original time. If the new time is earlier than the original time, the real-time clock is not updated to the new time. BRIEF DESCRIPTION OF DRAWINGS
[0008] FIG. 1 is a schematic diagram of a rollback protection device in an embodiment.
[0009] FIG. 2 is a schematic diagram of a time stamp memory of the rollback protection device in FIG. 1.
[0010] FIG. 3 is a decision flowchart of a real-time clock logic circuit of the rollback protection device in FIG. 1. DETAILED DESCRIPTION
[0011] A typical method for protecting a real-time clock from being modified by errors or illegally is to control the authority of modifying the real-time clock. Only certain secure software running on a processor can set the time of the real-time clock. However, this protection method has been difficult to ensure security because this method requires a complete system architecture (processor, bus structure, software) to be implemented correctly, and the above protection method can be broken by hackers.
[0012] To solve this problem, the present application proposes a real-time clock with rollback protection, which can be applied to an application specific integrated circuit (ASIC). The application specific integrated circuit can use a separate battery backup power supply that can supply the real-time clock to continue running when the rest of the system is powered off.
[0013] FIG. 1 is a schematic diagram of a rollback protection device 100 in an embodiment. The rollback protection device 100 includes a time stamp logic circuit 110, a real-time clock (RTC) 120, a real-time clock logic circuit 130 and a time stamp memory 140. The rollback protection device 100 also includes a bus and / or data path connecting other circuits and two inputs and outputs.
[0014] The real-time clock 120 maintains time calculation by counting the oscillation of an oscillation source (usually a 32 kHz quartz crystal). The real-time clock 120 can update the current time every second. The real-time clock 120 can output the current time (including year, month, day, hour, minute, second) every second for the system to use.
[0015] The function of the rollback protection device 100 is as follows. The timestamp memory 140 allows data to be written permanently. In one embodiment, the timestamp memory 140 is a single write memory element (e.g., using One-Time Programmable (OTP) memory or e-fuse memory).
[0016] When the timestamp logic circuit 110 receives a request to write a new timestamp (i.e., a request to write the current time of the real-time clock 120 to the timestamp memory 140), the timestamp logic circuit 110 can obtain a new timestamp from the real-time clock 120 recording the current time and compare the current time with the time recorded by the latest (newest) timestamp stored in the timestamp memory 140. If the current time obtained from the real-time clock 120 is later than the time recorded by the latest timestamp stored in the timestamp memory 140, the timestamp logic circuit 110 can store the new timestamp obtained from the real-time clock 120 to the timestamp memory 140 to update (mark) it as the latest timestamp in the timestamp memory 140 according to the request to write a new timestamp. If the current time obtained from the real-time clock 120 is earlier than the time recorded by the latest timestamp stored in the timestamp memory 140, the timestamp logic circuit 110 can consider the request to write a new timestamp as an unreasonable request and not store the new timestamp obtained from the real-time clock 120 to the timestamp memory 140. Therefore, the timestamp logic circuit 110 can ensure the correctness of the time recorded by the latest timestamp in the timestamp memory 140 according to the above embodiment.
[0017] The input received by the real-time clock logic circuit 130 is to receive a request to write a new time and update the real-time clock 120. When the real-time clock logic circuit 130 receives a request to write a new time and update the real-time clock 120 from outside the rollback protection device 100 (possibly a general time adjustment or a malicious time tampering), the real-time clock logic circuit 130 can compare the new time received from outside the rollback protection device 100 with the time recorded by the latest timestamp stored in the timestamp memory 140. If the new time received from outside the rollback protection device 100 is later than the time recorded by the latest timestamp stored in the timestamp memory 140, the real-time clock logic circuit 130 can update the current time generated by the real-time clock 120 to the new time obtained from outside the rollback protection device 100. If the new time received from outside the rollback protection device 100 is earlier than the time recorded by the latest timestamp stored in the timestamp memory 140, the real-time clock logic circuit 130 can consider it as a malicious time tampering and not update the current time generated by the real-time clock 120.
[0018] For example, when an electronic device (e.g., a mobile device, a computer, a notebook computer, a smart phone, a smart tablet, a personal digital assistant (PDA), a networked device, an Internet of Things (IoT) device, a smart appliance,...) that has the anti-rollback protection device 100 built-in needs to perform a program update (software update, firmware update), a request to write a new timestamp is simultaneously initiated to ensure that the real-time clock 120 cannot be maliciously tampered with to a time setting prior to the program update.
[0019] Since the timestamp logic circuit 110 and the real-time clock logic circuit 130 operate independently of each other, that is, the writing of the timestamp memory 140 and the updating of the real-time clock 120 operate independently of each other. That is, the timestamp logic circuit 110 operates independently without being controlled by other circuits (e.g., the real-time clock logic circuit 130), external requests, to ensure that the real-time clock logic circuit 130 can distinguish between a general time adjustment or a malicious tampering of the time setting, to avoid the real-time clock 120 being maliciously tampered with its time setting.
[0020] FIG. 2 shows a possible format of the stored timestamps. The timestamp memory 140 can include a single-write memory for storing timestamps, which can be a non-volatile memory, a single-programmable memory, or an e-fuse memory. The timestamp memory 140 stores the time of each timestamp submitted to the system. Each entry in the timestamp memory 140 can be blank (all zeros) or non-zero. The timestamp memory 140 includes an array of memory locations, shown here as indexed from 0x000 to 0x3ff. Each memory location can store the year, month, day, hour, minute, and second of a timestamp.
[0021] Since each storage location in the timestamp memory 140 can only be written once, new timestamps can be added in consecutive storage locations. The timestamp memory 140 can contain enough memory space to store many timestamps. In an embodiment, the timestamp memory 140 can store, for example, 1024 timestamps.
[0022] The timestamp logic circuit 110 controls whether a new timestamp taken from the real-time clock 120 is allowed to be written to the timestamp memory 140. When the timestamp logic circuit 110 is to write a new timestamp to the timestamp memory 140, the timestamp logic circuit 110 can store the new timestamp in the next available location in the timestamp memory 140. The current time recorded by the new timestamp must be later than the time recorded by the most recent timestamp in the timestamp memory 140, otherwise the timestamp logic circuit 110 does not allow the new timestamp to be written to the timestamp memory 140. The timestamp logic circuit 110 can also output the most recent timestamp stored in the timestamp memory 140 for use by other software or hardware of the system, which can use the most recent timestamp directly as a relevant security application.
[0023] The setting of the real-time clock 120 is controlled by the real-time clock logic circuit 130. When the system is to update the real-time clock 120, the real-time clock logic circuit 130 can compare the input new time with the time recorded by the most recent timestamp in the highest non-blank location of the timestamp memory 140, and only allow the real-time clock 120 to be updated to the new time if the new time is later than the time recorded by the most recent timestamp. If the new time is not later than the time recorded by the most recent timestamp, the real-time clock 120 is not updated.
[0024] Figure 3 is a flowchart of the decision making of the real-time clock logic circuit 130 in an embodiment. In this embodiment, the comparison starts from the top left corner and proceeds along the diagonal until a decision is made.
[0025] First, the real-time clock logic circuit 130 compares the year of the new time with the year recorded in the latest time stamp in the time stamp memory 140, and if the year of the new time is greater than or equal to the year recorded in the latest time stamp in the time stamp memory 140, the real-time clock logic circuit 130 compares the month of the new time with the month recorded in the latest time stamp in the time stamp memory 140, and otherwise rejects the update of the real-time clock 120. Next, when the real-time clock logic circuit 130 compares the month of the new time with the month recorded in the latest time stamp in the time stamp memory 140, if the month of the new time is greater than or equal to the month recorded in the latest time stamp in the time stamp memory 140, the real-time clock logic circuit 130 compares the day of the new time with the day recorded in the latest time stamp in the time stamp memory 140, and otherwise rejects the update of the real-time clock 120. Next, when the real-time clock logic circuit 130 compares the day of the new time with the day recorded in the latest time stamp in the time stamp memory 140, if the day of the new time is greater than or equal to the day recorded in the latest time stamp in the time stamp memory 140, the real-time clock logic circuit 130 compares the hour of the new time with the hour recorded in the latest time stamp in the time stamp memory 140, and otherwise rejects the update of the real-time clock 120. Next, when the real-time clock logic circuit 130 compares the hour of the new time with the hour recorded in the latest time stamp in the time stamp memory 140, if the hour of the new time is greater than or equal to the hour recorded in the latest time stamp in the time stamp memory 140, the real-time clock logic circuit 130 compares the minute of the new time with the minute recorded in the latest time stamp in the time stamp memory 140, and otherwise rejects the update of the real-time clock 120. Next, when the real-time clock logic circuit 130 compares the minute of the new time with the minute recorded in the latest time stamp in the time stamp memory 140, if the minute of the new time is greater than or equal to the minute recorded in the latest time stamp in the time stamp memory 140, the real-time clock logic circuit 130 compares the second of the new time with the second recorded in the latest time stamp in the time stamp memory 140, and otherwise rejects the update of the real-time clock 120. Finally, when the real-time clock logic circuit 130 compares the second of the new time with the second recorded in the latest time stamp in the time stamp memory 140, if the second of the new time is greater than the second recorded in the latest time stamp in the time stamp memory 140, the current time generated by the real-time clock 120 is updated to the new time, and otherwise rejects the update of the real-time clock 120.
[0026] When a particular application specific integrated circuit (ASIC) is manufactured, the contents of the timestamp memory 140 should be completely blank, so that an initial setting can be performed immediately after the real time clock 120 is powered on (e.g., pre-shipment testing), at which time the time can be input to the real time clock 120 through the real time clock logic circuit 130.
[0027] After the operation is started, the real time clock 120 keeps updating the current time every second. At some point, the software in the system can expect that the timestamp logic circuit 110 can be asked to provide a timestamp that can prevent rollback. At this time, the timestamp logic circuit 110 can store the timestamp from the real time clock 120 to the lowest blank location (e.g., 0x000) in the timestamp memory 140, and then the timestamp logic circuit 110 can read this location 0x000 to output the timestamp.
[0028] If at some time in the future, the system can attempt to modify the real time clock 120 to an earlier time than the time stored in location 0x000 in the timestamp memory 140 to rollback the real time clock 120, the real time clock logic circuit 130 will refuse to update the real time clock 120 according to the decision flow.
[0029] In the future, the system can want to establish a new anti-rollback timestamp again (e.g., when the system desires to perform system changes (e.g., software update, firmware update, …, program update)). At this time, the timestamp logic circuit 110 stores the new timestamp output by the real time clock 120 containing the current time in the lowest available blank location in the timestamp memory 140 according to a request to input a new timestamp, and can update the reading location of the timestamp memory 140 to ensure that the timestamp read from the timestamp memory 140 afterwards is the latest timestamp. In other words, the request to input a new timestamp is used to track system changes.
[0030] At some point in the future, the system software can update the real time clock 120. At this time, the software inputs a new time to the real time clock logic circuit 130, and the real time clock logic circuit 130 confirms whether the new time is later than the time recorded by the latest timestamp in the timestamp memory 140. If the new time is later than the time recorded by the latest timestamp in the timestamp memory 140, the real time clock 120 is allowed to be updated.
[0031] When the anti-rollback protection device 100 is completely powered off, the timestamp memory 140 can still maintain the stored timestamp. When the anti-rollback protection device 100 is powered on again, the timestamp logic circuit 110 can determine which is the latest timestamp by scanning from the highest location in the timestamp memory 140 downwards until a non-blank location is found. Therefore, the function of anti-rollback protection can also be performed when the anti-rollback protection device 100 is powered off and powered on again.
[0032] The present invention provides a method to ensure that a real-time clock does not roll back after the time recorded by a time stamp, preventing a system from being attacked by a downgrade attack, and increasing the security of the system. The present invention can be applied to a single-chip system of an application-specific integrated circuit (ASIC). In addition, the anti-rollback protection for the real-time clock can be maintained in all phases of the operation of the real-time clock, such as when the system is operating, when power is off, or when the real-time clock is operating using a backup power supply. The time stamp memory provided by the present invention stores a plurality of time stamps to provide anti-rollback protection when a program is updated (e.g., software upgrade) and / or a security credential is issued.
[0033] The above descriptions are only the preferred embodiments of the present invention, and all equivalent changes and modifications made within the scope of the present invention should be included in the scope of the present invention.
[0034]
Symbol Description
[0035] 100: Anti-rollback protection device
[0036] 110: Time stamp logic circuit
[0037] 120: Real-time clock
[0038] 130: Real-time clock logic circuit
[0039] 140: Time stamp memory
Claims
1. A rollback protection device, comprising: a real-time clock to generate a current time; a timestamp storage coupled to the real-time clock and storing an original timestamp; and a real-time clock logic coupled to the timestamp storage and the real-time clock to update the current time generated by the real-time clock to a new time only when the new time is later than an original time recorded by the original timestamp; wherein the timestamp storage is not controlled by the real-time clock logic for a write operation.
2. The rollback protection device of claim 1, further comprising a timestamp logic coupled to the timestamp storage and the real-time clock to store a new timestamp to the timestamp storage when receiving an input timestamp request. The timestamp logic stores the new timestamp to the timestamp storage only when the time recorded by the new timestamp is later than the original time.
3. The anti-rollback protection device of claim 2, wherein, The input timestamp request is used to track system changes.
4. The rollback protection apparatus of claim 2 or 3, wherein, 5. The rollback protection device of claim 2 or 3, wherein the timestamp logic and the real-time clock logic operate independently of each other.
6. The rollback protection device of claim 1, wherein the timestamp storage is a single write storage.
7. The rollback protection device of claim 6, wherein the single write storage is one of a single programmable storage and an e-fuse storage.
8. The rollback protection device of claim 1, wherein the timestamp storage is a non-volatile storage.
9. The rollback protection device of claim 1, wherein the timestamp storage stores a plurality of timestamps to provide rollback protection for program updates and / or issuing security credentials.
10. A rollback protection method, the rollback protection device comprising a real-time clock, a timestamp storage and a real-time clock logic, the rollback protection method comprising: the real-time clock logic receiving a request to update the real-time clock to a new time; verifying whether the new time is later than an original time recorded by an original timestamp stored in the timestamp storage; and updating the real-time clock to the new time if the new time is later than the original time. wherein the real-time clock is not updated to the new time if the new time is earlier than the original time.
11. The rollback protection method of claim 10, further comprising storing a new timestamp to the timestamp storage when receiving an input timestamp request. The new timestamp is stored to the timestamp storage only when the time recorded by the new timestamp is later than the original time. The input timestamp request is used to track system changes.
12. The anti-rollback protection method of claim 11 wherein, Storing the new timestamp to the timestamp storage and updating the real-time clock are independent of each other.
13. The anti-rollback protection method of claim 11 or 12, wherein, 15. The rollback protection method of claim 10, wherein the timestamp storage comprises a single write storage, and the original timestamp is stored in the single write storage.
14. The anti-rollback protection method of claim 11 wherein, 16. The rollback protection method of claim 15, wherein the single write storage is one of a single programmable storage and an e-fuse storage. 17. The anti-rollback protection method of claim 10, wherein the timestamp storage is a non-volatile memory.
18. The anti-rollback protection method of claim 10, wherein the timestamp storage stores a plurality of timestamps to provide anti-rollback protection when a program is updated and / or a security credential is issued.
Citation Information
Patent Citations
Relative timestamp when real time clock is unavailable
CN102739468A
Starting method of calculator system
CN104317685A