Clock safety detection method and device, chip
Patent Information
- Application Number
- CN202310181029.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-17
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2043-02-17
AI Technical Summary
[0034]本发明实施例提供的时钟安全检测方法及装置、芯片,通过在TEE中设置参考时钟,并保证参考时钟的精准度,利用该参考时钟检测TEE中作为业务时钟引入的来自REE的外部时钟,确定该业务时钟是否可信,从而可以简单方便地实现对该业务时钟的监测,保证该业务时钟的可信性,使该业务时钟可以作为安全时钟应用于TEE中的Timer、WatchDog、RTC等,使相应的SOC产品符合TBSA(Trusted Base System Architecture,可信基础系统架构)规范要求。
Smart Images

Figure CN116126095B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of clock security technology, specifically to a clock security detection method, device, and chip. Background Technology
[0002] A System-on-Chip (SoC) is a system or product formed by combining multiple integrated circuits with specific functions on a single chip. It includes a complete hardware system and its embedded software. For example, a mobile phone SoC may integrate a CPU (central processing unit), GPU (graphics processing unit), DSP (digital signal processor), RAM (random access memory), modem, navigation and positioning module, and multimedia module, etc.
[0003] A Trusted Execution Environment (TEE) guarantees computation unaffected by conventional operating systems, hence the term "trusted." TEEs are implemented by creating a small operating system that runs independently within TrustZone's "secure world." This operating system directly provides a limited number of security services through system calls (handled directly by the TrustZone kernel). TEEs are typically used for critical operations such as fingerprint verification and PIN code input in mobile payments, secure storage of confidential data like private keys and certificates, and DRM (Digital Rights Management).
[0004] The timers, watchdogs, and RTCs (Real-Time Clocks) used by TEEs within a System-on-a-Chip (SoC) must meet security requirements and ensure clock frequency accuracy. These clocks are typically external inputs, originating from an REE (Rich Execution Environment), which refers to an insecure or untrusted environment. Therefore, ensuring the security of these clocks is a crucial issue to consider in SoC design and development. Summary of the Invention
[0005] This invention provides a clock security detection method, device, and chip to effectively detect the security of externally input clocks in a TEE, thereby ensuring the security of services within the TEE.
[0006] To address the aforementioned technical problems, the embodiments of the present invention provide the following technical solutions:
[0007] On one hand, embodiments of the present invention provide a clock security detection method, the method comprising:
[0008] Set a secure reference clock in the TEE and ensure the accuracy of the reference clock;
[0009] The reference clock is used to detect the service clock in the TEE, which is an external clock from the REE.
[0010] Optionally, ensuring the accuracy of the reference clock includes:
[0011] The calibration value of the reference clock is pre-stored in a secure, one-time programmable memory within the TEE;
[0012] After each power-on, the calibration value is read from the one-time programmable memory, and the reference clock is calibrated according to the calibration value.
[0013] Optionally, the method further includes: calibrating the reference clock using a production line precision clock at different voltages and / or temperatures to obtain a calibration value for the reference clock.
[0014] Optionally, the frequency of the reference clock is greater than or less than the frequency of the service clock;
[0015] The step of detecting the service clock in the TEE using the reference clock includes:
[0016] When the frequency of the reference clock is greater than the frequency of the service clock, the characteristic parameters of the reference clock within a set period are detected and statistically analyzed based on the clock cycle of the service clock; when the frequency of the reference clock is less than the frequency of the service clock, the characteristic parameters of the service clock within a set period are detected and statistically analyzed based on the clock cycle of the reference clock.
[0017] The reliability of the service clock is determined based on the characteristic parameters within a set statistical period.
[0018] Optionally, the characteristic parameters include: the rising edge and / or falling edge of the clock signal;
[0019] Determining whether the service clock is secure based on characteristic parameters within a set statistical period includes:
[0020] If the number of rising and / or falling edges of the clock signal within a set statistical period exceeds a set threshold range, the service clock is determined to be unreliable.
[0021] Optionally, determining whether the service clock is secure based on statistical feature parameters further includes: if the time during which the feature parameters of the service clock are not detected exceeds a set time threshold, then the service clock is determined to be unreliable.
[0022] Optionally, the method further includes: if it is determined that the service clock is unreliable, then reporting an interruption message.
[0023] On the other hand, embodiments of the present invention also provide a clock security detection device, the device comprising: a reference clock disposed in a TEE and protected by security, a calibration module, and a detection module;
[0024] The calibration module is used to ensure the accuracy of the reference clock;
[0025] The detection module is used to detect the service clock in the TEE using the reference clock, wherein the service clock is an external clock from the REE.
[0026] Optionally, the device further includes:
[0027] A one-time programmable memory, set in the TEE and protected by security, is used to store the calibration value of the reference clock;
[0028] The calibration module is used to read the calibration value from the one-time programmable memory after each power-on and calibrate the reference clock according to the calibration value.
[0029] Optionally, the frequency of the service clock is greater than or less than the frequency of the reference clock; the detection module includes:
[0030] The feature parameter statistics unit is used to detect and count the feature parameters of the reference clock within a set period based on the clock cycle of the service clock when the frequency of the reference clock is greater than the frequency of the service clock; and to detect and count the feature parameters of the service clock within a set period based on the clock cycle of the reference clock when the frequency of the reference clock is less than the frequency of the service clock.
[0031] The judgment unit is used to determine whether the service clock is reliable based on the characteristic parameters within a set statistical period.
[0032] Optionally, the detection module is also configured to report interruption information if it is determined that the service clock is unreliable.
[0033] On the other hand, embodiments of the present invention also provide a chip including the aforementioned clock security detection device.
[0034] The clock security detection method, device, and chip provided in this invention set a reference clock in the TEE and ensured the accuracy of the reference clock. The reference clock is used to detect the external clock introduced from the REE as a service clock in the TEE, and to determine whether the service clock is trustworthy. This allows for simple and convenient monitoring of the service clock, ensuring its trustworthiness. The service clock can then be used as a security clock in Timer, WatchDog, RTC, etc. in the TEE, making the corresponding SOC products comply with the TBSA (Trusted Base System Architecture) specification requirements.
[0035] Furthermore, by storing the calibration value of the reference clock in a one-time programmable memory in the TEE, and reading the calibration value from the one-time programmable memory after each power-on, and calibrating the reference clock according to the calibration value, the security of the calibration value and the accuracy of the reference clock are fully guaranteed.
[0036] Furthermore, if the business clock is determined to be unreliable, timely reporting of interruption information can proactively trigger system anomalies, effectively avoiding adverse effects on the operation of other modules within the system or introducing security risks. Attached Figure Description
[0037] Figure 1 This is a flowchart of a clock security detection method provided in an embodiment of the present invention;
[0038] Figure 2 This is another flowchart of the clock security detection method provided in the embodiments of the present invention;
[0039] Figure 3 This is a schematic diagram of the process of detecting the service clock in a TEE using the clock security detection method of the present invention;
[0040] Figure 4 This is a schematic diagram of a clock security detection device provided in an embodiment of the present invention. Detailed Implementation
[0041] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0042] The TBSA specification requires that if the security clock source is externally input, a hardware detection module should be present to verify that the clock frequency is within a reasonable range. For situations where some functional modules within a SOC's TEE require service clocks from external clocks in the REE, this invention provides a clock security detection method, apparatus, and chip. By setting a reference clock in the TEE and ensuring its accuracy, this reference clock is used to detect external clocks introduced into the TEE as service clocks from the REE, thus determining the reliability of the service clock.
[0043] like Figure 1 The diagram shown is a flowchart of a clock security detection method provided in an embodiment of the present invention, comprising the following steps:
[0044] Step 101: Set a secure reference clock in the TEE and ensure the accuracy of the reference clock.
[0045] Specifically, the calibration value of the reference clock can be pre-stored in a one-time programmable memory within the TEE, such as an eFuse or Flash OTP (One Time Programming). Since the one-time programmable memory can only be programmed once, the data is permanently valid once programmed. Furthermore, the one-time programmable memory is located within the TEE and is securely protected, effectively ensuring that the calibration value will not be tampered with.
[0046] The term "securely protected" means that it can only be accessed by modules within the TEE, and not by modules outside the TEE. Any subsequent use of the term "securely protected" will have the same meaning and will not be explained further.
[0047] Accordingly, each time the device is powered on, a calibration value is read from the one-time programmable memory, and the reference clock is calibrated based on the calibration value.
[0048] It should be noted that there can be multiple calibration values, each corresponding to different application environments. For example, multiple calibration values may correspond to different voltages and / or temperatures, ensuring that the reference clock meets the required accuracy requirements under different application environments. Accordingly, when reading calibration values from the one-time programmable memory, the corresponding calibration value can be read according to the environmental parameters of the current application.
[0049] In practical applications, the environmental parameters can be detected in real time by the corresponding sensors and other modules of the device itself, or obtained through third-party services, or determined by manual settings. This embodiment of the invention does not limit the scope of these parameters.
[0050] The calibration value can be obtained by calibrating the reference clock using a production line precision clock or other external high-precision clock. Specifically, the reference clock is calibrated using the production line precision clock or other external high-precision clock at different voltages and / or temperatures to obtain the corresponding calibration value. This embodiment of the invention does not limit the specific calibration method; for example, some existing clock calibration methods can be used.
[0051] Step 102: Detect the service clock in the TEE using the reference clock, where the service clock is an external clock from the REE.
[0052] In practical applications, the service clock can be obtained by dividing an external clock (such as the clock in the REE of the SOC) or by directly inputting the external clock. The specific choice can be determined according to the frequency requirements of the service clock.
[0053] It should be noted that, depending on the actual application requirements, the frequency of the service clock can be greater than or less than the frequency of the reference clock, and this embodiment of the invention does not limit this.
[0054] Accordingly, when detecting the service clock, the characteristic parameters of the service clock can be detected and statistically analyzed based on the clock cycle of the reference clock, or conversely, the reliability of the service clock can be determined based on the statistically analyzed characteristic parameters. For example, when the frequency of the reference clock is greater than the frequency of the service clock, the characteristic parameters of the reference clock within a set period are detected and statistically analyzed based on the clock cycle of the service clock; when the frequency of the reference clock is less than the frequency of the service clock, the characteristic parameters of the service clock within a set period are detected and statistically analyzed based on the clock cycle of the reference clock; the reliability of the service clock is determined based on the statistically analyzed characteristic parameters within the set period.
[0055] The set period can be one or more clock cycles, and this embodiment of the invention does not limit this.
[0056] The characteristic parameters of the service clock can specifically be the rising edge and / or falling edge of the reference clock or the clock signal of the service clock. For example, if the number of rising edges and / or falling edges of the reference clock exceeds a set threshold range within one clock cycle of the service clock, the service clock is determined to be unreliable.
[0057] The threshold range can be set according to the actual application requirements of the chip product. For example, for a set period, a maximum value and a minimum value can be set for the number of acceptable rising edges and / or falling edges of the service clock or reference clock. If the statistical results within the set period are within the range of the maximum and minimum values, it indicates that the service clock frequency is within a reasonable range and is a reliable clock; otherwise, the service clock is determined to be unreliable.
[0058] It should be noted that existing signal detection methods can be used to detect the characteristic parameters of the service clock, such as the rising edge and / or falling edge of the service clock, and this embodiment of the invention does not limit this.
[0059] In addition, there is an extreme case where the service clock is unreliable: the external clock may fail to detect the characteristic parameters of the service clock or the reference clock due to system malfunctions or human tampering. To avoid false triggering of detection results, in another non-limiting embodiment, a timeout threshold can be set. When detecting the characteristic parameters of the service clock, if the time for which the characteristic parameters of the service clock or the reference clock are not detected exceeds the set timeout threshold, the service clock is determined to be unreliable.
[0060] The time threshold, timeout, can be determined, for example, by setting the threshold range as (min, max), where:
[0061] min=4M / 32K=125*0.95=118CYCLE;
[0062] max=4M / 32K*1.05=131CYCLE;
[0063] The timeout value is calculated by counting how many 4MHz cycles there are in 32kHz. The timeout value is 4M / 32K*2=250CYCLE, which means that each CYCLE takes one rising edge and one falling edge within 1 / 4000000s.
[0064] In practical applications, for example, a timer and a counter can be set up. The timer or counter is used to detect the timing or periodicity (it can directly use the timer of the business clock or reference clock). The counter is used to count the statistical characteristic parameters (it can directly use the counter of the business clock or reference clock). After the characteristic parameter is detected, the timer or counter is reset. If the characteristic parameter is not detected after the timing or periodicity is reached, the business clock is determined to be unreliable.
[0065] The clock security detection method provided in this invention sets a reference clock in the TEE and ensures the accuracy of the reference clock. It uses this reference clock to detect the external clock introduced from the REE as a service clock in the TEE, and determines whether the service clock is reliable. This allows for simple and convenient detection of the service clock, and the detection process can be performed in real time, thereby ensuring the reliability of the service clock. This enables the service clock to be used as a security clock in related services in the TEE, ensuring the security and reliability of the services.
[0066] like Figure 2 The diagram shown is another flowchart of a clock security detection method provided in an embodiment of the present invention, which includes the following steps:
[0067] Step 201: Set a secure reference clock in the TEE.
[0068] Step 202: After the device is powered on, it reads the calibration value and calibrates the reference clock according to the calibration value.
[0069] The calibration values can be stored in a secure, one-time programmable memory within the TEE.
[0070] Step 203: Detect and statistically analyze the characteristic parameters of the reference clock within a set period based on the clock cycle of the service clock, or detect and statistically analyze the characteristic parameters of the service clock within a set period based on the clock cycle of the reference clock.
[0071] The characteristic parameters of the service clock may be information such as the rising edge and / or falling edge of the service clock.
[0072] Step 204: Determine whether the service clock is reliable based on the characteristic parameters within the set statistical period.
[0073] Step 205: If it is determined that the service clock is unreliable, then report the interruption information.
[0074] The clock security detection method in this embodiment, when it is determined that the business clock is untrustworthy, actively triggers system anomalies by promptly reporting interruption information, which can effectively avoid adverse effects on the operation of other modules in the system or bring security risks.
[0075] The clock security detection method provided by the embodiments of the present invention will be further illustrated below with examples.
[0076] like Figure 3 The diagram illustrates the process of detecting the service clock in a TEE using the clock security detection method of the present invention.
[0077] Reference Figure 3The dashed box in the diagram represents the chip's TEE environment. After the device is powered on, the security attributes of the modules in the dashed box can be configured to place these modules in the TEE environment. The area outside the dashed box represents the chip's REE environment.
[0078] In this example, the reference clock is RCO100, a 100MHz clock based on RCO (RC oscillator). The reference clock RCO100 is calibrated by the production line precision clock CLK_24M (frequency 24MHz). The service clock CLK_32K (frequency 32KHz) is obtained by dividing the external clock CLK_24M in the REE environment and is used for secure and reliable clock-related services such as WD (WatchDog) / RTC / TMR in the TEE environment. The detection module is used to detect the service clock CLK_32K.
[0079] The following is combined with Figure 3 This describes the process of using the clock security detection method of the present invention to detect the service clock in the TEE.
[0080] First, during production on the production line, under fixed voltage and temperature, the reference clock RCO100 is calibrated using the production line's precision clock CLK_24M, and the calibration value is written to the eFuse. After calibration, the reference clock RCO100 only relies on the value in the eFuse for calibration, thus ensuring the accuracy of the reference clock RCO100.
[0081] Secondly, in chip applications, the detection module detects the service clock CLK_32K based on the reference clock RCO100. The specific process is as follows:
[0082] (1) After the device is powered on, the calibration module reads the calibration value val from the eFuse;
[0083] (2) The calibration module uses the calibration value val to calibrate the reference clock RCO100.
[0084] (3) The clock signal CLK_4M (frequency of 4MHz) is obtained by dividing RCO100M by 1 / 25 and inputting the clock signal CLK_4M to the detection module. At the same time, the calibrated reference clock RCO100 is fed back to the calibration module to form negative feedback, thereby reducing the error.
[0085] (4) Input the service clock CLK_32K generated by dividing the external clock CLK_24M (frequency is 24MHz) to the detection module, and use the clock signal CLK_4M to monitor whether the service clock CLK_32K has been changed.
[0086] If it is determined that the service clock CLK_32K is unreliable, an interrupt can be reported immediately to proactively trigger a system exception.
[0087] Accordingly, embodiments of the present invention also provide a clock security detection device, such as... Figure 4 The diagram shown is a structural schematic of a clock security detection device provided in an embodiment of the present invention.
[0088] The clock safety detection device 400 includes the following modules: a reference clock 401 housed in the TEE and protected by safety, a calibration module 402, and a detection module 403. Wherein:
[0089] The calibration module 402 is used to ensure the accuracy of the reference clock 401;
[0090] The detection module 403 is used to detect the service clock in the TEE using the reference clock 401, wherein the service clock is an external clock from the REE.
[0091] Specifically, the calibration module 402 can calibrate the reference clock based on its calibration value each time the device is powered on. The calibration value can include multiple calibration values corresponding to different voltages and / or temperatures. Accordingly, the calibration module 402 can obtain the calibration value corresponding to the current application environment parameters and use this calibration value to calibrate the reference clock 401 to ensure its accuracy.
[0092] The calibration value can be obtained by calibrating the reference clock using a production line precision clock or other external high-precision clock, and this embodiment of the invention does not limit this.
[0093] Furthermore, to ensure the security of the calibration value, a one-time programmable memory (not shown) can be provided in the clock security detection device 400 to store the calibration value of the reference clock.
[0094] Similarly, the one-time programmable memory can be located in the TEE and protected by security.
[0095] Depending on the application requirements, the frequency of the reference clock can be less than or greater than the frequency of the service clock; this embodiment of the invention does not impose any limitation on this. Accordingly, the detection module 403 can detect and statistically analyze the characteristic parameters of the service clock based on the clock period of the reference clock, and determine whether the service clock is reliable based on the statistically analyzed characteristic parameters. Accordingly, a specific implementation structure of the detection module 403 may include the following units:
[0096] The feature parameter statistics unit is used to detect and count the feature parameters of the reference clock within a set period based on the clock cycle of the service clock when the frequency of the reference clock is greater than the frequency of the service clock; and to detect and count the feature parameters of the service clock within a set period based on the clock cycle of the reference clock when the frequency of the reference clock is less than the frequency of the service clock.
[0097] The judgment unit is used to determine whether the service clock is reliable based on the feature parameters within a set period statistically analyzed by the feature parameter statistics unit.
[0098] For example, one scenario is that the service clock is determined to be unreliable if the number of rising and / or falling edges of the service clock or the reference clock exceeds a set threshold range within one or more clock cycles of the reference clock or the service clock; another scenario is that the service clock is determined to be unreliable if the time during which the characteristic parameters of the service clock or the reference clock are not detected exceeds a set time threshold.
[0099] The clock security detection device provided in this embodiment of the invention sets a reference clock in the TEE and ensures the accuracy of the reference clock. It uses this reference clock to detect the external clock introduced from the REE as the service clock in the TEE, and determines whether the service clock is reliable. This allows for simple and convenient monitoring of the service clock, ensuring its reliability. The service clock can then be used as a security clock in Timer, WatchDog, RTC, etc. in the TEE, making the corresponding SOC products comply with TBSA specifications.
[0100] Furthermore, in another non-limiting embodiment of the clock security detection device of the present invention, the detection module 403 can also be used to report interruption information when it is determined that the service clock is untrusted.
[0101] The timely reporting of interruption information by the detection module 403 can proactively trigger system anomalies, thereby effectively avoiding adverse effects on the operation of other modules in the system or bringing security risks.
[0102] Accordingly, embodiments of the present invention also provide a chip including the clock security detection device described in any of the above embodiments.
[0103] The clock security detection method, device, and chip provided in this invention apply a clock obtained from an untrusted execution environment to a trusted execution environment through monitoring and protection measures. This satisfies the security requirements of the trusted execution environment while reducing hardware design requirements and facilitating flexible software application.
[0104] In specific implementation, the modules / units included in the various devices and products described in the above embodiments can be software modules / units, hardware modules / units, or a combination of both.
[0105] In practical implementation, the aforementioned clock security detection device can correspond to the chip with the corresponding function in network equipment and / or user equipment, such as SOC (System-On-a-Chip), baseband chip, chip module, etc.
[0106] In specific implementation, the modules / units included in the various devices and products described in the above embodiments can be software modules / units, hardware modules / units, or a combination of both.
[0107] For example, for various devices and products applied to or integrated into a chip, each module / unit can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, each module / unit can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0108] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.
[0109] In the embodiments of this invention, "multiple" refers to two or more.
[0110] The descriptions of "first," "second," etc., appearing in the embodiments of this invention are for illustrative purposes and to distinguish the objects being described. They do not indicate any particular order and do not imply any special limitation on the number of devices in the embodiments of this invention. They do not constitute any limitation on the embodiments of this invention.
[0111] The embodiments provided by this invention can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. It should be understood that in the various embodiments of this invention, the sequence number of the above processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this invention.
[0112] In the several embodiments provided by this invention, it should be understood that the disclosed methods, apparatuses, and systems can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0113] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0114] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically arranged separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0115] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. A clock security detection method, characterized in that, The method includes: A safety-protected reference clock is set in the TEE, and the calibration value of the reference clock is stored in a safety-protected one-time programmable memory in the TEE. After each power-on, the calibration value is read from the one-time programmable memory, and the reference clock is calibrated according to the calibration value to ensure the accuracy of the reference clock. The reference clock is used to detect the service clock in the TEE, which is an external clock from the REE.
2. The method according to claim 1, characterized in that, The method further includes: The reference clock is calibrated using a production line precision clock at different voltages and / or temperatures to obtain the calibration value of the reference clock.
3. The method according to claim 1, characterized in that, The frequency of the reference clock is greater than or less than the frequency of the service clock; The step of detecting the service clock in the TEE using the reference clock includes: When the frequency of the reference clock is greater than the frequency of the service clock, the characteristic parameters of the reference clock within a set period are detected and statistically analyzed based on the clock cycle of the service clock; when the frequency of the reference clock is less than the frequency of the service clock, the characteristic parameters of the service clock within a set period are detected and statistically analyzed based on the clock cycle of the reference clock. The reliability of the service clock is determined based on the characteristic parameters within a set statistical period.
4. The method according to claim 3, characterized in that, The characteristic parameters include: the rising edge and / or falling edge of the clock signal; Determining whether the service clock is secure based on characteristic parameters within a set statistical period includes: If the number of rising and / or falling edges of the clock signal within a set statistical period exceeds a set threshold range, the service clock is determined to be unreliable.
5. The method according to claim 4, characterized in that, The step of determining whether the service clock is secure based on statistical characteristic parameters also includes: If the time for which the characteristic parameter of the service clock is not detected exceeds the set time threshold, then the service clock is determined to be unreliable.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: If it is determined that the service clock is unreliable, an interruption message is reported.
7. A clock security detection device, characterized in that, The device includes: a one-time programmable memory disposed in the TEE and protected by security, a reference clock, a calibration module, and a detection module; The one-time programmable memory is used to store the calibration value of the reference clock; The calibration module is used to read the calibration value from the one-time programmable memory after each power-on, and calibrate the reference clock according to the calibration value to ensure the accuracy of the reference clock. The detection module is used to detect the service clock in the TEE using the reference clock, wherein the service clock is an external clock from the REE.
8. The apparatus according to claim 7, characterized in that, The frequency of the service clock is greater than or less than the frequency of the reference clock; the detection module includes: The feature parameter statistics unit is used to detect and count the feature parameters of the reference clock within a set period based on the clock cycle of the service clock when the frequency of the reference clock is greater than the frequency of the service clock; and to detect and count the feature parameters of the service clock within a set period based on the clock cycle of the reference clock when the frequency of the reference clock is less than the frequency of the service clock. The judgment unit is used to determine whether the service clock is reliable based on the feature parameters within a set period statistically analyzed by the feature parameter statistics unit.
9. The apparatus according to claim 7 or 8, characterized in that, The detection module is also used to report interruption information if it is determined that the service clock is unreliable.
10. A chip comprising a clock security detection device as described in any one of claims 7 to 9.
Citation Information
Patent Citations
Clock correction device and clock correcting method
CN107231150A
Variable clock frequency detection circuit and working method thereof
CN114721899A