State management method and device for security chip

By deleting the firmware program of the security chip during the user program usage stage, reclaiming storage space and performing security verification, the problem of high cost of existing security chip state management methods is solved, and the effect of reducing costs and ensuring safety is achieved.

CN119670167APending Publication Date: 2025-03-21BEIJING CEC HUADA ELECTRONIC DESIGN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411759243.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The existing security chip state management methods are costly and it is difficult to reduce production costs while ensuring safety strength.

Method used

By deleting firmware programs during the user program usage stage, reclaiming the storage space of the secure chip, and ensuring the security of the chip through a series of checksum management processes.

Benefits of technology

On the premise of ensuring chip security, increase the available capacity ratio of chip memory and reduce chip costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119670167A_ABST
    Figure CN119670167A_ABST
Patent Text Reader

Abstract

The invention discloses a state management method and device for a security chip. The state management method comprises the steps that after the security chip is powered on and reset, whether first data of a user program area of the security chip is a specific value or not is judged; when the first data of the user program area is the specific value, judging whether the first firmware program is the same as a pre-stored program or not; when the first firmware program is the same as the pre-stored program, judging whether a second firmware program is correct or not; when the second firmware program is verified to be correct, downloading a user program into a user program area of the memory; and after the user program is downloaded, deleting at least part of the firmware program in the secure data area of the memory. According to the state management method and device for the security chip, at least part of firmware programs can be deleted in the use stage of the user program, so that the storage space of the security chip is recycled, and meanwhile, the security of the chip is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of integrated circuit design, and in particular to a state management method and device for a security chip. Background Art

[0002] In the current electronic information age, the technological innovation in the field of integrated circuit design is changing with each passing day. Among them, the design and application of security chips as the core components to ensure information security are particularly important. However, with the increasing demand for chip security strength, how to reduce the production cost while ensuring the chip security strength performance has become a major challenge facing the industry.

[0003] The life cycle of a chip can be simply divided into two stages after the chip is provided to the customer: the user program download stage and the application use stage. In the program download stage, the main control program on the chip is the firmware program provided by the chip manufacturer; in the application use stage, the main control program on the chip is the customer's user program. If the firmware program and the user program have the same access rights to all chip resources, it means that there is no substantial security chip status management, and the user program can tamper with the firmware program and download illegal user programs. The so-called security chip status management generally refers to a certain method of controlling the access and usage rights of different resources and functions of the security chip.

[0004] Traditional security chip status management methods are often costly, mainly due to complex security algorithms, diverse life cycle divisions, cumbersome testing processes, and storage space isolation of the main control program at each stage. The storage space isolation of the main control program at each stage includes the firmware program and the user program to occupy different storage spaces. The vast majority of the chip life cycle is in the application use stage, and the firmware program is basically not running at this stage. This space can be considered redundant space at this stage. For low-cost security chips in some cost-sensitive fields, redundant space means increased costs. The high cost not only limits the popularity and application of security chips, but also increases the economic burden on enterprises.

[0005] Therefore, developing a low-cost secure chip status management method and device is of great significance to promoting the development of the integrated circuit design field. Summary of the invention

[0006] In view of the above problems, the purpose of the present invention is to provide a state management method and device for a security chip, which can delete the firmware program during the user program use phase to reclaim the storage space of the security chip while ensuring the security of the chip.

[0007] According to one aspect of the present invention, a state management method for a security chip is provided, wherein the security chip comprises a memory, wherein the memory comprises at least a security data area and a user program area, which are respectively used to store a firmware program of the security chip and a downloaded user program, and wherein the state management method for the security chip comprises: after the security chip is powered on and reset, determining whether the first data in the user program area of ​​the security chip is a specific value; when the first data in the user program area is a specific value, determining whether a first firmware program is the same as a pre-stored program; when the first firmware program is the same as the pre-stored program, determining whether a second firmware program is correct; when the second firmware program is verified to be correct, downloading the user program to the user program area of ​​the memory; and after downloading the user program, deleting at least part of the firmware program in the security data area of ​​the memory.

[0008] Optionally, in the step of determining whether the first data of the user program area of ​​the security chip is a specific value, the first data includes the data of the first byte, the first double byte, the first four bytes or the first chip-defined memory minimum erase unit in the user program area.

[0009] Optionally, it also includes: when the first data in the user program area is not a specific value, determining whether the firmware program in the security data area of ​​the security chip is deleted; when the firmware program is deleted, the security chip executes the user program; when the firmware program is not deleted, the security chip deletes the firmware program and then executes the user program.

[0010] Optionally, the firmware program includes the first firmware program, the second firmware program and the pre-stored program, and deleting the firmware program includes: deleting all of the first firmware program and / or the second firmware program; or deleting part of the first firmware program and / or the second firmware program.

[0011] Optionally, in the step of determining whether the first firmware program is the same as the pre-stored program, the code of the first firmware program is compared byte by byte with the code of the pre-stored program.

[0012] Optionally, the method further includes: when the first firmware program is different from the pre-stored program, the security chip does not run the program, and returns an error value or performs a reset operation.

[0013] Optionally, in the step of determining whether the second firmware program is correct, the first firmware program is executed, and a verification algorithm is used to verify the second firmware program, and the verification algorithm includes a CRC verification algorithm, a hash algorithm, a symmetric algorithm, or an asymmetric algorithm.

[0014] Optionally, when the second firmware program is not correctly verified, the security chip does not run the program and returns an error value or performs a reset operation.

[0015] Optionally, when the second firmware program is verified to be correct, before the step of downloading the user program into the user program area of ​​the memory, the method further includes: executing the second firmware program to execute the production test function of the security chip.

[0016] According to another aspect of the present invention, a state management device for a security chip is provided, the security chip comprising a processor and a memory, the state management device being located in the processor, wherein the state management device comprises: a basic state judgment unit, for judging whether the first data in the user program area of ​​the security chip is a specific value after the security chip is powered on and reset; a first verification unit, connected to the basic state judgment unit, for judging whether a first firmware program is the same as a pre-stored program when the first data in the user program area is the specific value; a second verification unit, connected to the first verification unit, for verifying whether the second firmware program is correct when the first firmware program is the same as the pre-stored program; a function processing unit, connected to the second verification unit, for executing a production test function of the security chip when the second firmware program is verified to be correct; a download unit, connected to the second verification unit, for downloading a user program to the memory of the security chip when the second firmware program is verified to be correct; a space release unit, connected to the basic state judgment unit and the download unit, for deleting at least part of the firmware program when the user program is downloaded and the firmware program is not deleted; an execution unit, connected to the basic state judgment unit and the space release unit, for executing the user program.

[0017] Optionally, the space releasing unit is further used to determine whether the firmware program in the memory is deleted when the basic state determination unit determines that the first data in the user program area is not a specific value.

[0018] Optionally, in the step in which the basic status judgment unit judges whether the first data of the user program area of ​​the security chip is a specific value, the first data includes the data of the first byte, the first double byte, the first four byte or the first chip-defined memory minimum erase unit in the user program area.

[0019] Optionally, the firmware program includes the first firmware program, the second firmware program and the pre-stored program, and deleting the firmware program includes: deleting all of the first firmware program and / or the second firmware program; or deleting part of the first firmware program and / or the second firmware program.

[0020] The state management method and device of the security chip provided by the present invention will delete all or part of the first firmware program and the second firmware program in the firmware program in the security chip after the user downloads the application program to reclaim the space of the security chip. In the subsequent use process, after the security chip is powered on and reset, it is determined whether the user program has been installed in the security chip. If it has been installed, it indicates that the security chip is in a secure user state; if the user program is not installed in the security chip, the firmware program of the security chip is verified to confirm whether the security chip is in a secure administrator preparation state or in a non-secure state, so that the corresponding operation and the operation of deleting part of the firmware program can be performed under the premise of ensuring the security of the chip, thereby increasing the available capacity ratio of the chip memory and reducing the chip cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0022] Figure 1 A schematic diagram of the structure of a security chip according to an embodiment of the present invention is shown;

[0023] Figure 2 A schematic diagram of the structure of a security chip state management device according to an embodiment of the present invention is shown;

[0024] Figure 3 A flow chart of a security chip status management method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0025] Various embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. In each of the accompanying drawings, the same elements are represented by the same or similar reference numerals. For the sake of clarity, the various parts in the accompanying drawings are not drawn to scale.

[0026] The specific implementation of the present invention is further described in detail below in conjunction with the drawings and examples.

[0027] Figure 1 A schematic diagram of the structure of a security chip according to an embodiment of the present invention is shown; Figure 2 A schematic structural diagram of a security chip status management device according to an embodiment of the present invention is shown.

[0028] refer to Figure 1 The security chip 20 includes a processor 21 and a memory 22 , and the security chip state management device 200 is located in the processor 21 .

[0029] The memory 22 of the security chip 20 includes at least two areas, one is a secure data area for storing the security chip firmware program, and the other is a user program area for storing the user program. The program in the user program area cannot access the secure data area, while the program in the secure data area can access the user program area in the security administrator state. The firmware program in the secure data area includes at least two parts, a first firmware program in one part, for example, a program for executing the state management method of the security chip, and a second firmware program in another part, for example, a program for executing the downloading of the user program or processing the chip production function. Therefore, after the security chip downloads the user program, at least the second firmware program can be deleted to free up the memory space, thereby increasing the available space for the user.

[0030] Firmware program refers to the device "driver" stored inside the device, which controls the hardware bottom layer and communicates with other devices. Security firmware refers to the firmware required for the operation of the security and confidentiality module. The firmware programs mentioned in this application are all security firmware.

[0031] In addition, the security data area also includes a third part, which is used to store a pre-stored program. The pre-stored program is used to implement the verification of the first firmware program in the aforementioned security chip state management method and is also a part of the firmware program.

[0032] In the process of executing the security chip state management method by the security chip state management device, the states of the security chip 20 are divided into four types, namely, secure user state, secure administrator preparatory state, secure administrator state and non-secure state. In the secure user state, the security chip 20 executes the user program; in the non-secure state, the security chip 20 will no longer run, and the security chip 20 is expressed to be in a non-secure state by returning an error value or performing a reset operation; the security administrator preparatory state is a temporary state of the process.

[0033] Furthermore, if Figure 2 As shown, the security chip state management device 200 includes: a basic state judgment unit 210, a first verification unit 220, a second verification unit 230, a function processing unit 240, a download unit 250, an execution unit 270 and a space release unit 260.

[0034] The basic state judgment unit 210 is used to judge whether the user program is installed in the user program area after the security chip is powered on and reset, and then obtain the secure user state or the secure administrator preparatory state. Among them, in the step of judging whether the user program is installed in the user program area, if the data of the first byte, the first double byte, or the first four bytes of the user program area, or the first chip-defined minimum erase unit of the memory 22 is a specific value, it indicates that the user program is not written in the user program area of ​​the memory 22 of the security chip 20, and the security administrator preparatory state is entered; if the data of the first byte, the first double byte, or the first four bytes of the user program area, or the first chip-defined minimum erase unit of the memory 22 is not a specific value, it indicates that the user program has been written in the user program area of ​​the memory 22 of the security chip 20, and the secure user state is entered.

[0035] The first verification unit 220 is connected to the basic state judgment unit 210. After the security chip 20 enters the security administrator preparatory state, the first verification unit 220 verifies the first firmware program in the security data area storage area of ​​the memory 22. The first verification unit 220 compares and verifies the first firmware program stored in the security data area of ​​the memory 22 with the code of the pre-stored program stored in the security data area of ​​the memory 22 byte by byte. If the verification is correct, the security chip 20 is still in the security administrator preparatory state and needs to perform the next verification; if the verification is incorrect, it indicates that there is a problem with the first firmware program stored in the security data area of ​​the memory 22, and enters the non-secure state.

[0036] The second verification unit 230 is connected to the first verification unit 220. When the first verification unit 220 still determines that the security chip 20 is in the security administrator preparatory state, the second verification unit 230 verifies the second firmware program in the security data area storage area of ​​the memory 22. The second verification unit 230 verifies the code of the second firmware program by executing the first firmware program using a CRC verification algorithm, a hash algorithm, a symmetric algorithm, or an asymmetric algorithm. If the verification is correct, it indicates that the firmware program of the security chip 20 is correct, but it is in the security administrator state where the user program has not been downloaded; if the verification is incorrect, it indicates that there is a problem with the second firmware program stored in the security data area of ​​the memory 22, and it enters a non-secure state.

[0037] The second firmware is a traditional chip firmware, and its functions generally include chip production testing and downloading user programs. User programs can generally be downloaded repeatedly if they meet security conditions, and the security condition is to pass security authentication.

[0038] The function processing unit 240 is connected to the second verification unit 230. When the second verification unit 230 determines that the security chip 20 is in the security administrator state, the function processing unit 240 completes the production test function of the security chip 20 through the second firmware program.

[0039] The download unit 250 is connected to the second verification unit 230. When the second verification unit 230 determines that the security chip 20 is in the security administrator state, the download unit 250 downloads the security code of the user program to the memory 22 of the security chip 20 through the second firmware program. Specifically, the code of the downloaded user program is located in the user program area of ​​the memory 22.

[0040] The space release unit 260 is connected to the basic state judgment unit 210 and the download unit 250, and further determines whether the firmware program in the memory 22 is deleted when the basic state judgment unit 210 determines that it is in the secure user state. When it is determined that it is not deleted, the space release unit 260 deletes all or part of the code of the first firmware program and / or the second firmware program in the secure data area of ​​the memory 22, thereby releasing the storage space of the memory 22, and the released storage space can be used by the user program.

[0041] Among them, when the memory capacity of the security chip of the present application is the same as the memory capacity of the security chip of the prior art, since at least part of the firmware program of the security chip in the present application can be deleted, the user-available capacity in the memory capacity of the present application is increased, thereby increasing the user-available capacity ratio of the memory of the security chip of the present application; and in the case of the same user capacity during the user use stage, the firmware program of the present application will delete part of the vacated space for the user after downloading the user program, so the capacity occupied by the firmware program is less than that of the prior art, so that the total memory capacity can be reduced. In summary, the security chip state management device of the present application can reduce the cost of the chip.

[0042] The execution unit 270 is connected to the basic state judgment unit 210 and the space release unit 260, and executes the user program after the basic state judgment unit 210 determines that the user program has been installed in the user program area of ​​the memory 22. Of course, after confirming that the space release unit 260 deletes at least part of the firmware program, the execution unit 270 can execute the user program downloaded in the user program area of ​​the memory 22 to implement the user program function. The user can directly run the user program without deleting the firmware program after downloading the user program according to needs, or can delete the firmware program after downloading the user program and then run the user program.

[0043] Figure 3 A flow chart of a method for managing a security chip status according to an embodiment of the present invention is shown.

[0044] The method for managing the security chip status of the present application can be used for managing the security chip 20 when it is powered on for the first time after manufacturing or when it is powered on again after power failure. The method can be executed by the security chip status management device 200. Generally, the security chip status management device 200 is integrated in the processor 21 of the security chip 20, for example.

[0045] Combination Figures 1 to 3 The method for managing the state of a security chip of the present application specifically comprises the following steps:

[0046] Step S111: The security chip is powered on and reset.

[0047] In this step, after the security chip 20 is powered on, the security chip status management method is automatically triggered, and the basic status judgment unit 210 in the security chip status management device 200 starts to judge the status of the security chip 20 to reduce the risk of data leakage and improve the security of the chip.

[0048] Among them, the basic status judgment unit 210 in the security chip status management device 200 starts to judge whether the user program is downloaded to the memory 22 after power-on. If it is downloaded, it is judged that the security chip 20 is not in the secure user state. If it is not downloaded, it is judged that the security chip is in the secure administrator preparation state.

[0049] Step S112: Determine whether the first data in the user program area is a specific value.

[0050] In this step, after the security chip 20 is powered on, the data content of the user program area in the memory 22 is judged, and then it is judged whether the user program has been downloaded into the memory 22. If it has been downloaded, it is judged that the security chip 20 is not in the secure user state. If it has not been downloaded, it is judged that the security chip is in the secure administrator preparation state.

[0051] Specifically, in the process of confirming whether the user program is installed in the memory 22 of the security chip 20, it is first determined whether the first data in the user program area is a specific value. In this embodiment, after the security chip 20 is produced and before the user program is written, the data stored in the user program area is a specific value, so as to facilitate the state management of the security chip 20 thereafter.

[0052] Therefore, if the first data in the user program area is a specific value, it is considered that the user program has not been written into the security chip 20 and it is in the security administrator preparation state, and then step S113 is executed; if the first data in the user program area is not a specific value, it is considered that the user program has been written into the security chip 20, the original specific value is replaced, and it is in the secure user state, and then step S117 is executed.

[0053] In addition, in the step of determining whether the first data in the user program area is a specific value, for example, to determine whether the data of the first byte, the first double byte, the first four bytes, or the first chip-defined memory minimum erase unit in the user program area is a specific value, the specific value is, for example, all FFs or 0xFFFFFFFF. In other embodiments, the specific value for determination may also be set to other values, which is not limited in this application.

[0054] Step S113: Determine whether the first firmware program is the same as the pre-stored program.

[0055] In this step, since the first data in the user program area is a specific value, it is considered that the security chip 20 has not downloaded the user program, and it is necessary to continue to determine whether the firmware program of the security chip 20 is correct. Therefore, the first verification unit 220 determines whether the first firmware program in the security chip 20 is the same as the pre-stored program.

[0056] Among them, the first firmware program is compared and verified byte by byte with the data code of the pre-stored program in the security data area of ​​the security chip. If the verification is incorrect, it indicates that the security chip 20 is in a non-secure state, and step S115 is executed; if the verification is correct, it indicates that the security chip 20 is in a security administrator preparation state, and step S114 is executed.

[0057] Step S114: Determine whether the second firmware program is correct.

[0058] In this step, since the first verification unit 220 verifies that the first firmware program is correct, the second firmware program is further verified by the second verification unit 230. In the process of verifying the second firmware program, the first firmware program is verified.

[0059] Specifically, for example, the first firmware program is executed, and the code of the second firmware program is verified by the first firmware program using a CRC (Cyclic Redundancy Check) verification algorithm, a hash algorithm, a symmetric algorithm or an asymmetric algorithm. If the verification is correct, the security chip is in the security administrator state, and step S116 is executed; if the verification is incorrect, step S115 is executed.

[0060] Step S115: The security chip is in a non-secure state.

[0061] In this step, since the first firmware program or the second firmware program of the security chip fails to pass the verification, it is determined that the security chip is in an unsafe state. The security chip 20 in the unsafe state does not run the program, and returns an error value to the user or performs operations such as reset to indicate that the security chip 20 is no longer safe.

[0062] In other embodiments, the security chip 20 in the non-secure state may further check the reasons causing the non-secure state when indicating the non-secure state, and then take measures to perform security recovery.

[0063] Step S116: Download user programs and / or process chip production functions.

[0064] In this step, the first verification unit 220 and the second verification unit 230 determine that the first firmware program and the second firmware program of the security chip 20 are both correct, and the user program is not downloaded in the security chip 20, then the security chip 20 executes the step of downloading the user program or processing the chip production function.

[0065] The download unit 250 of the security chip 20 downloads the user program code to the user program area in the memory 22 of the security chip 20 through the second firmware program. The processing chip production function refers to the function processing unit 240 completing the test function of the security chip 20 after production through the second firmware program.

[0066] Step S117: Determine whether the firmware program is deleted.

[0067] In this step, since the user program has been downloaded to the security chip 20, it is necessary to further determine whether the deletable firmware program has been deleted. If the space release unit 260 determines that the firmware program has been deleted, step S119 is executed; if the firmware program has not been deleted, step S118 is executed.

[0068] Step S118: Release the firmware space.

[0069] In this step, the security chip 20 is in a state where the user program has been downloaded but the firmware program has not been deleted, so it is in a secure user state. For the firmware program in the security chip 20, the space release unit 260 can selectively delete it to release the storage space in the memory 22, thereby increasing the user's available storage space.

[0070] In this embodiment, the deleted firmware program is, for example, the entire first firmware program and / or the second firmware program, or may be part of the first firmware program and / or the second firmware program, but at least part of the second firmware program.

[0071] Step S119: Execute the user program.

[0072] In this step, the security chip 20 has downloaded the user program and released the space occupied by the firmware program, so the execution unit 270 of the security chip 20 executes the downloaded user program.

[0073] The method and device for managing the state of a security chip provided by the present invention will delete all or part of the first firmware program and the second firmware program in the firmware program in the security chip after the user downloads the application program to reclaim the space of the security chip. In the subsequent use process, after the security chip is powered on and reset, it is determined whether the user program has been installed in the security chip. If it has been installed, it indicates that the security chip is in a secure user state; if the user program is not installed in the security chip, the firmware program of the security chip is verified to confirm whether the security chip is in a secure administrator preparation state or in a non-secure state, so that the corresponding operation and the operation of deleting part of the firmware program can be performed under the premise of ensuring the security of the chip, thereby increasing the available capacity ratio of the chip memory and reducing the chip cost.

[0074] According to the embodiments of the present invention as described above, these embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made based on the above description. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can make good use of the present invention and the modified use based on the present invention. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for managing the state of a security chip, wherein the security chip comprises a memory, wherein the memory comprises at least a security data area and a user program area, respectively used to store a firmware program of the security chip and a downloaded user program, wherein the method for managing the state of the security chip comprises: After the security chip is powered on and reset, determining whether the first data in the user program area of ​​the security chip is a specific value; When the first data in the user program area is a specific value, determining whether the first firmware program is the same as the pre-stored program; When the first firmware program is identical to the pre-stored program, determining whether the second firmware program is correct; When the second firmware program is verified to be correct, downloading the user program into the user program area of ​​the memory; as well as After downloading the user program, at least part of the firmware program in the secure data area of ​​the memory is deleted.

2. The state management method according to claim 1, wherein: In the step of determining whether the first data of the user program area of ​​the security chip is a specific value, the first data includes the data of the first byte, the first double byte, the first four bytes or the first chip-defined memory minimum erase unit in the user program area.

3. The state management method according to claim 1, wherein: Also includes: When the first data in the user program area is not a specific value, determining whether the firmware program in the security data area of ​​the security chip is deleted; When the firmware program is deleted, the security chip executes the user program; When the firmware program has not been deleted, the security chip deletes the firmware program and then executes the user program.

4. The state management method according to claim 3, wherein: The firmware program includes the first firmware program, the second firmware program and the pre-stored program, and deleting the firmware program includes: Deleting all of the first firmware program and / or the second firmware program; or Delete part of the first firmware program and / or the second firmware program.

5. The state management method according to claim 4, wherein: In the step of determining whether the first firmware program is the same as the pre-stored program, the code of the first firmware program is compared and verified byte by byte with the code of the pre-stored program.

6. The state management method according to claim 5, wherein: Also includes: When the first firmware program is different from the pre-stored program, the security chip does not run the program and returns an error value or performs a reset operation.

7. The state management method according to claim 6, wherein: In the step of determining whether the second firmware program is correct, the first firmware program is executed, and the second firmware program is verified using a verification algorithm. The verification algorithm includes a CRC verification algorithm, a hash algorithm, a symmetric algorithm or an asymmetric algorithm.

8. The state management method according to claim 7, wherein: When the second firmware program is not correctly verified, the security chip does not run the program and returns an error value or performs a reset operation.

9. The state management method according to claim 8, wherein: When the second firmware program is verified to be correct, before the step of downloading the user program into the user program area of ​​the memory, the method further includes: The second firmware program is executed to perform a production test function of the security chip.

10. A state management device for a security chip, the security chip comprising a processor and a memory, the state management device being located in the processor, wherein: The state management device comprises: a basic state judgment unit, for judging whether the first data in the user program area of ​​the security chip is a specific value after the security chip is powered on and reset; A first checking unit connected to the basic state judging unit, for judging whether the first firmware program is the same as the pre-stored program when the first data in the user program area is a specific value; a second verification unit connected to the first verification unit, and verifying whether the second firmware program is correct when the first firmware program is the same as the pre-stored program; a function processing unit connected to the second verification unit, and executing a production test function of the security chip when the second firmware program is verified to be correct; a downloading unit connected to the second verification unit, and downloading a user program into the memory of the security chip when the second firmware program is verified to be correct; a space releasing unit, connected to the basic state judging unit and the downloading unit, for deleting at least part of the firmware program when the user program is downloaded and the firmware program is not deleted; An execution unit, connected to the basic state judgment unit and the space release unit, is used to execute the user program.

11. The state management device according to claim 10, wherein: The space releasing unit is further configured to determine whether the firmware program in the memory is deleted when the basic state determining unit determines that the first data in the user program area is not a specific value.

12. The state management device according to claim 10, wherein: In the step in which the basic status judgment unit judges whether the first data of the user program area of ​​the security chip is a specific value, the first data includes the data of the first byte, the first double byte, the first four bytes or the first chip-defined memory minimum erase unit in the user program area.

13. The state management device according to claim 10, wherein: The firmware program includes the first firmware program, the second firmware program and the pre-stored program, and deleting the firmware program includes: Deleting all of the first firmware program and / or the second firmware program; or Delete part of the first firmware program and / or the second firmware program.