Chip debugging function control method and system, electronic equipment and storage medium
By generating and encrypting random numbers during the chip authorization process, two-way authentication between the target device and the chip is achieved, the problem of poor authorization security in the prior art is solved, and the security of chip debugging and the reliability of the authorization process are improved.
Patent Information
- Application Number
- CN202411392869.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-10
AI Technical Summary
In the prior art, the authorization process of chips depends on servers and specific security chips, and is poor in security and it is difficult to prevent forged authorization certificates from being used without authorization.
By generating random numbers and encrypting them into random secret texts, sending them to the target device for decryption and adding them to the authorization certificate, and starting the debugging function of the chip after the authorization certificate passes verification, two-way authentication between the target device and the chip is achieved to ensure the authorization certificate uniqueness.
It improves the security of chip debugging, prevents the use of forged authorization certificates, realizes two-way authentication and uniqueness of authorization certificates, and enhances the reliability of the authorization process.
Smart Images

Figure CN119292846A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic chip debugging, and in particular to a control method, system, electronic device and storage medium for a chip debugging function. Background Art
[0002] During chip debugging, it is crucial to ensure the security and controllability of debugging to prevent unauthorized access and operation. Before starting the chip's debugging function, the chip needs to be authorized.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] In the related art, authorization of the chip needs to rely on a server and a specific security chip for one-way authentication, which has poor security.
[0005] Therefore, how to improve the security of chip debugging is a technical problem that those skilled in the art currently need to solve. Summary of the invention
[0006] The purpose of this application is to provide a control method, system, electronic device and storage medium for a chip debugging function, which can improve the security of chip debugging.
[0007] In order to solve the above technical problems, the present application provides a method for controlling a chip debugging function, which is applied to a board provided with a chip. The method for controlling the chip debugging function includes:
[0008] If an authorization request transmitted by a target device is received, a random number is generated, and the random number is encrypted to obtain a random ciphertext; wherein the target device is a debugging device or a server;
[0009] Sending the random ciphertext to the target device so that the target device adds the decryption result of the random ciphertext to the authorization certificate;
[0010] Receiving the authorization certificate sent by the target device and verifying the authorization certificate;
[0011] If the authorization certificate passes the verification, the identifier of the chip is added to the authorization certificate, and the debugging function of the chip is started using the authorization certificate, so that the debugging device can debug the chip.
[0012] Optionally, after starting the debugging function of the chip by using the authorization certificate, the method further includes:
[0013] Determine whether the authorization duration is set in the authorization certificate;
[0014] If yes, start the duration control function of the chip; wherein the duration control function of the chip is used to delete the locally stored authorization certificate when the authorization duration in the authorization certificate is less than or equal to a preset value, so as to turn off the debugging function of the chip;
[0015] If not, the duration control function of the chip is turned off.
[0016] Optionally, after determining whether the authorization duration is set in the authorization certificate, the method further includes:
[0017] If the authorization duration is set in the authorization certificate, query the heartbeat signal of the chip according to the preset period;
[0018] If the heartbeat signal of the chip in the current period is queried, the authorization period in the authorization certificate is subtracted from the period corresponding to the preset period to obtain a new authorization period.
[0019] Optionally, after starting the debugging function of the chip by using the authorization certificate, the method further includes:
[0020] If an authorization revocation instruction issued by the target device is received, the locally stored authorization certificate is deleted, and a response message indicating that the authorization certificate has been deleted is returned.
[0021] Optionally, after adding the identifier of the chip to the authorization certificate, the method further includes:
[0022] Encrypting the authorization certificate to obtain an encrypted certificate;
[0023] The encrypted certificate is written into the storage device of the board, and the encrypted certificate is transmitted to the debugging device for archiving.
[0024] Optionally, also include:
[0025] If the authorization mode of the authorization certificate is multi-board authorization, the debugging function of the chip is started after the authorization certificate and the decryption result are verified.
[0026] Optionally, verifying the authorization certificate includes:
[0027] Determine whether the authorization certificate is complete, and obtain a first determination result;
[0028] Determine whether the decryption result in the authorization certificate is consistent with the random number, and obtain a second determination result;
[0029] If both the first judgment result and the second judgment result are yes, it is determined that the authorization certificate and the decryption result have passed the verification;
[0030] If the first judgment result and the second judgment result are not both yes, it is determined that the authorization certificate and the decryption result have not passed the verification.
[0031] The present application also provides a control system for a chip debugging function, which is applied to a board provided with a chip, and the chip debugging function control system includes:
[0032] A request processing module, configured to generate a random number and encrypt the random number to obtain a random ciphertext if an authorization request transmitted by a target device is received; wherein the target device is a debugging device or a server;
[0033] An interaction module, configured to send the random ciphertext to the target device so that the target device adds the decryption result of the random ciphertext to the authorization certificate;
[0034] A verification module, used for receiving the authorization certificate sent by the target device and verifying the authorization certificate;
[0035] The debugging function starting module is used to add the identifier of the chip to the authorization certificate if the authorization certificate passes the verification, and start the debugging function of the chip using the authorization certificate, so that the debugging device can debug the chip.
[0036] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps of the control method for implementing the above-mentioned chip debugging function are implemented.
[0037] The present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor calls the computer program in the memory, the steps of executing the control method of the above-mentioned chip debugging function are implemented.
[0038] Compared with the prior art, the technical solution provided by this application has at least the following beneficial effects:
[0039] The present application provides a control method for a chip debugging function. In the present method, after a board equipped with a chip receives an authorization request transmitted by a target device, a random number can be generated and encrypted to obtain a random ciphertext, ensuring that only a legitimate target device can decrypt and use the random number. The target device adds the decryption result to the authorization certificate, and the chip verifies the authorization certificate to prevent forged authorization certificates from being used. After the authorization certificate and the decryption result are verified, the present application adds the chip identifier to the authorization certificate, and then uses the authorization certificate with the added identifier to start the chip debugging function. The above process realizes two-way authentication between the target device and the chip, and also uses the chip identifier to ensure the uniqueness of the authorization certificate, so the present application can improve the security of chip debugging. The present application also provides a control system for chip debugging function, a storage medium and an electronic device, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 A flowchart of a method for controlling a chip debugging function provided in an embodiment of the present application;
[0042] Figure 2 A schematic diagram of the structure of a debugging authorization system provided in an embodiment of the present application;
[0043] Figure 3 A schematic diagram of the structure of a control system for a chip debugging function provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] See below Figure 1 , Figure 1 A flowchart of a method for controlling a chip debugging function provided in an embodiment of the present application.
[0046] Specific steps may include:
[0047] S101: if an authorization request transmitted by a target device is received, a random number is generated, and the random number is encrypted to obtain a random ciphertext;
[0048] Among them, this embodiment can be applied to a board equipped with a chip (such as a microcontroller unit MCU, a central processing unit CPU, a memory chip, etc.), which is connected to a target device, and the target device is a debugging device or a server. The debugging device can be a terminal device such as a mobile phone or a tablet computer installed with a chip debugging application. When the target device is a debugging device, the chip can be authorized offline; when the target device is a server, the chip can be authorized online.
[0049] Before this step, the chip on the board can be set to a waiting state, ready to receive an authorization request from the target device. After receiving the authorization request, a random number generator (RNG) can be used to generate a random number, which is then encrypted. The encrypted random number is the random ciphertext.
[0050] In this embodiment, an asymmetric encryption algorithm can be used to encrypt the random number, ensuring that only the target device holding the corresponding private key can decrypt it. The chip can obtain the public key of the target device in advance to encrypt the random number. The public key can be pre-stored in the secure storage of the chip or obtained through a secure channel during the first communication.
[0051] S102: Sending the random ciphertext to the target device so that the target device adds the decryption result of the random ciphertext to the authorization certificate;
[0052] Among them, the chip can send the random ciphertext to the target device through a secure communication protocol to ensure the security of the transmission process and prevent the random ciphertext from being intercepted or tampered with during the transmission process.
[0053] After receiving the random ciphertext, the target device can decrypt the random ciphertext to obtain a decryption result. The target device can also add the decryption result to the authorization certificate. There can be a field in the authorization certificate specifically used to store the above decryption result so as to compare it with the random number generated by S101 in the subsequent verification process. The target device can also send the authorization certificate with the decryption result added to the chip.
[0054] S103: receiving the authorization certificate sent by the target device, and verifying the authorization certificate;
[0055] The chip may receive the authorization certificate of the target device through a secure communication protocol, and the authorization certificate received by the chip has a decryption result added thereto. This step may verify the authorization certificate to which the decryption result is added.
[0056] During the verification process, the integrity of the authorization certificate may be verified, and the decryption result in the authorization certificate may also be verified using the random number generated in S101.
[0057] Through this step, the chip can ensure that the received authorization certificate is valid, has not been tampered with, and contains the correct decryption result. The above process ensures the authenticity, integrity and validity of the authorization certificate, thereby improving the security of the entire debugging process.
[0058] If the authorization certificate fails to pass the verification, the current process ends and waits for receiving a new authorization request. In the process of S101 to S103, the debugging function of the chip is in a closed state.
[0059] S104: If the authorization certificate passes the verification, the identifier of the chip is added to the authorization certificate, and the debugging function of the chip is started using the authorization certificate, so that the debugging device can debug the chip.
[0060] Among them, this step is based on the verification of the authorization certificate. The chip identifier can be added to the authorization certificate to ensure that the authorization certificate is for the chip and prevent the authorization certificate from being used by other chips. The identifier of the above chip can be the chip's unique identifier UID (Unique Identifier), serial number Serial Number, product code Product Code, etc.
[0061] After the chip identifier is added to the authorization certificate, the chip uses the authorization certificate with the identifier to start the debugging function. The enabling condition of the debugging function in the chip is: there is a verified authorization certificate with its own identifier in the chip. Specifically, the chip can determine whether the authorization certificate is verified and has the same identifier as its own chip; if so, the debugging function is started; if not, the debugging function remains closed.
[0062] After the board equipped with the chip receives the authorization request transmitted by the target device, the present embodiment can generate a random number and encrypt the random number to obtain a random ciphertext, ensuring that only a legitimate target device can decrypt and use the random number. The target device adds the decryption result to the authorization certificate, and the chip verifies the authorization certificate to prevent the forged authorization certificate from being used. After the authorization certificate and the decryption result are verified, the present embodiment adds the chip identifier to the authorization certificate, and then uses the authorization certificate with the added identifier to start the debugging function of the chip. The above process realizes two-way authentication between the target device and the chip, and also uses the chip identifier to ensure the uniqueness of the authorization certificate, so the present embodiment can improve the security of chip debugging.
[0063] As for Figure 1 In the further introduction of the corresponding embodiment, the authorization certificate can be set with an authorization duration to control the duration of the chip enabling the debugging function; if the authorization duration is not set in the authorization certificate, the chip can enable the debugging function without time limit. In order to ensure security, it can be limited to only when the server authorizes the chip (that is, the target device is the server), allowing the authorization certificate to not set the authorization duration.
[0064] Correspondingly, after using the authorization certificate to start the debugging function of the chip, it is also possible to determine whether the authorization duration is set in the authorization certificate; if so, start the duration control function of the chip; if not, turn off the duration control function of the chip.
[0065] The duration control function of the above chip is used to delete the locally stored authorization certificate when the authorization duration in the authorization certificate is less than or equal to a preset value, so as to turn off the debugging function of the chip.
[0066] Specifically, this embodiment can periodically update the authorization duration, and the authorization duration after each update is shorter than the authorization duration before the update; this embodiment can also determine whether the authorization duration in the authorization certificate is less than or equal to the preset value after updating the authorization duration; if the authorization duration is less than or equal to the preset value, the locally stored authorization certificate is deleted to turn off the debugging function of the chip.
[0067] As a feasible implementation method, after determining whether the authorization duration is set in the authorization certificate, if the authorization duration is set in the authorization certificate, the authorization duration can be updated in the following manner: query the heartbeat signal of the chip according to the preset period; if the heartbeat signal of the chip in the current period is queried, the authorization duration in the authorization certificate is subtracted from the duration corresponding to the preset period to obtain a new authorization duration. Specifically, if the heartbeat signal is queried in the current period, it indicates that the chip is operating normally in the current period. At this time, the authorization duration in the authorization certificate can be subtracted from the duration corresponding to the preset period to obtain a new authorization duration.
[0068] For example, the preset cycle is 1 minute, and the initial authorization duration in the authorization certificate is 60 minutes. In the first minute, the heartbeat signal is queried, and the authorization duration is reduced from 60 minutes to 59 minutes; in the second minute, the heartbeat signal is queried, and the authorization duration is reduced from 59 minutes to 58 minutes; and so on, until the authorization duration is exhausted. Through the above mechanism, reliable control of the authorization duration can be ensured, avoiding the problem of tampering with the authorization duration by adjusting the local clock.
[0069] As for Figure 1Further introduction to the corresponding embodiment, after the authorization certificate is used to start the debugging function of the chip, if an authorization revocation instruction issued by the target device is received, the locally stored authorization certificate is deleted, and a response message indicating that the authorization certificate has been deleted is returned. In this way, the target device can actively revoke the authorization certificate, which improves the control flexibility of the chip debugging function.
[0070] As for Figure 1 Further introduction to the corresponding embodiment, after adding the identifier of the chip to the authorization certificate, the authorization certificate can also be encrypted to obtain an encryption certificate; the encryption certificate is written to the storage device of the board, and the encryption certificate is transmitted to the debugging device for archiving. If the target device is a server, after the encryption certificate is transmitted to the debugging device, the debugging device can verify the encryption certificate, and after the verification is passed, debug the corresponding chip based on the identification code in the encryption certificate. If the authorization period is set in the authorization certificate, after updating the authorization period in the authorization certificate, the authorization certificate after the updated authorization period can be encrypted and overwritten to the storage device of the board.
[0071] As for Figure 1 Further introduction to the corresponding embodiment, the authorization mode of the authorization certificate includes single-board authorization and multi-board authorization (i.e., not limited to a single board). If the authorization mode of the authorization certificate is single-board authorization, operations S101~S103 are executed; if the authorization mode of the authorization certificate is multi-board authorization, the debugging function of the chip is started after the authorization certificate and the decryption result are verified. At this time, the authorization device can debug any chip that stores the above-mentioned authorization certificate.
[0072] As for Figure 1 For further introduction to the corresponding embodiment, the authorization certificate can be verified in the following manner: determine whether the authorization certificate is complete to obtain a first judgment result; determine whether the decryption result in the authorization certificate is consistent with the random number to obtain a second judgment result; if the first judgment result and the second judgment result are both yes, then determine that the authorization certificate and the decryption result have passed the verification; if the first judgment result and the second judgment result are not both yes, then determine that the authorization certificate and the decryption result have not passed the verification.
[0073] The process described in the above embodiment is explained below by using a security debugging control solution of an embedded MCU (Microcontroller Unit) in actual application.
[0074] In the related art, there are the following defects in the process of controlling the debugging function of the chip:
[0075] (1) The authentication process relies on the server and a specific security chip and cannot support offline scenarios well; (2) The certificate destruction after authorization is unreliable, and the management method is not suitable for embedded software debugging scenarios; (3) The current embedded software has poor adjustability during the testing phase when it is in the release state; (4) The authentication process is a one-way authentication, and two-way authentication and binding are not implemented in the authentication process.
[0076] In view of the defects of the above-mentioned related technologies, this application provides a secure debugging control solution for embedded MCU. Figure 2 , Figure 2 A structural diagram of a debugging authorization system provided by an embodiment of the present application, the system includes a server, a debugging device and an MCU chip, and the MCU chip is used as a debugged object. The server is used to implement the certificate application process, the debugging device is used to implement the certificate issuance process, and the MCU chip is used to implement the certificate management process. The debugging device can obtain the original certificate from the server and issue the certificate for communication. The authorization mode in this embodiment includes designated single-board authorization and unlimited single-board authorization, and the authorization type includes limited life span and unlimited life span (only for internal testing). The debugging device and the server can implement certificate authorization and certificate revocation; certificate revocation does not require application for a certificate, can be executed directly, and the certificate cannot be recycled. The MCU chip performs a series of operations, covering the issuance of certificates from the request, identity authentication by answering the challenge seed (using asymmetric encryption), and then processing and integrating the received seed into the certificate. After completing this process, the MCU chip issues an authorization certificate and verifies the certificate to ensure its correctness and seed consistency. Next, the MCU chip encrypts the certificate and stores it in a device with a power-off preservation function, associates the UID at the same time, and then answers the UID information by asymmetric encryption, finally completing the debugging and successfully starting the authorization process.
[0077] In order to ensure subsequent maintainability, this embodiment can define debugging authorization modes including specified boards and unlimited boards. The UID of the MCU chip on the board is recorded in the server, so the authorization object can be specified by the UID of the MCU chip; when batch authorization or non-directional authorization is required, the unlimited board method can be used. In order to solve the feasibility problem of testers, this embodiment defines two modes for authorization time: unlimited and limited (for ease of management and control, the unlimited mode can only be authorized online). Debug authorization can be directly authorized online by connecting the server to the MCU chip.
[0078] In order to achieve offline authorization, this embodiment supports applying for an authorization certificate online through an authorization device, and then the authorization device authorizes the MCU chip. When the debugging purpose is achieved, the debugging authorization can be actively revoked on site through the authorization device. Once revoked, the MCU chip will not be debuggable, and the authorization certificate stored in the MCU chip will no longer be available. After each successful authorization, the authorization device will bind the certificate to the UID, and after actively revoking the debugging authorization, the authorization certificate will no longer be available, but will be sent back to the server when connecting to the server again.
[0079] The MCU chip can obtain the authorization request through the authorization transmission protocol. The MCU chip generates a random number D1 through the internal random number generation unit, encrypts the random number D1 through the asymmetric encryption algorithm to obtain the random ciphertext M1, and transmits the random ciphertext M1 to the authorization device through the authorization transmission protocol. After receiving it, the authorization device decrypts the seed (i.e. the decryption result of the random ciphertext M1) and fills it into the authorization certificate, and then re-encrypts the certificate and transmits it to the MCU chip. The MCU chip decrypts the authorization certificate to determine the integrity of the authorization certificate and the consistency of the seed and the random number D1. After verification, the UID is filled into the authorization certificate, the authorization certificate is re-encrypted and the encrypted authorization certificate is written to the secure storage device, and the encrypted authorization certificate is sent back to the authorization device. The authorization device archives the encrypted authorization certificate and destroys the original certificate, thus completing the entire authorization process. The secure storage device is the storage device of the board.
[0080] After the MCU chip is authorized, the debugging function will be kept open, and then the system heartbeat will be queried at a period of 1 minute, the authorization heartbeat duration in the certificate will be modified (this logic is not executed for types with an infinite life cycle), and the certificate will be overwritten to the secure storage device. When the MCU chip recognizes that the authorization heartbeat is exhausted, the certificate will be destroyed and the debugging function will be turned off. The above authorization heartbeat duration is the authorization duration.
[0081] This embodiment implements the switch control of the MCU chip debugging function on the embedded product, ensuring that debugging can be performed through the debugging port only under authorized conditions; in this embodiment, the authorization of the debugging switch needs to be controlled, requiring two-way binding and directional authorization to solve the problem of multiple reuses of one authorization; in this embodiment, the device debugging function after authorization needs to be revocable, solving the problem of cracking periodic authorization by adjusting the local clock due to dependence on the real-time clock, and solving the problem of not being able to actively revoke authorization after authorization. This embodiment can solve the problem of low testing efficiency of internal testers due to high debugging function control, and can also solve the problem of replay authorization of authorization certificates.
[0082] The above embodiment can implement the authorization protocol by applying the communication port, and perform switch authorization control on the debug port based on the protocol. The above embodiment can implement the management and control of the authorization object based on the two-way binding certificate of challenge seed + asymmetric encryption + UID, confirm the identity of the authorizer by checking the seed, determine the identity of the authorized person by UID, and whether the certificate has been used. The above embodiment can directly implement the debugging authorization revocation through the authorization protocol, maintain the life cycle of the certificate by querying the system clock, and ensure the reliability of the certificate availability time by a secure storage device. In the above embodiment, the server prohibits offline issuance of the authorization certificate by issuing an unlimited authorization certificate (forcibly obtaining UID information, issuing a directional authorization certificate after binding, and the certificate cannot be used even if it is read out). The above embodiment can define the challenge seed in the authorization certificate, and the seed is decrypted and compared each time the certificate is used, and the certificate installation can only be executed if it is consistent with the authorization. That is, the authorization is installed in a secure storage device, cannot be read out, and has been bound to the UID, ensuring that the authorization certificate cannot be used without restriction.
[0083] As a feasible implementation method, this embodiment can add an MD5 checksum to the authorization certificate to ensure data consistency and prevent tampering; this embodiment can also implement certificate encryption based on asymmetric encryption of RSA (an asymmetric encryption algorithm) or SM2 (elliptic curve public key cryptography algorithm) to ensure data confidentiality; this embodiment can also write the encrypted authorization certificate to a secure storage device (such as an internal flash memory) and enable RDP L1 to prevent reading. RDP L1 indicates the read protection level.
[0084] As a feasible implementation, this embodiment can add a CRC code (cyclic redundancy check code) to the certificate for consistency verification of the certificate data; this embodiment can also compress the original certificate data based on the MiniLzo encryption algorithm, reducing the size of the certificate, which is suitable for embedded systems with small memory, and can store the certificate in the backup register of the secure storage device (RDP L1 needs to be turned on); this embodiment can use a symmetric encryption algorithm to encrypt the compressed certificate, which has higher performance. CRC code is a cyclic redundancy check code, and MiniLzo is a lightweight compression and decompression library.
[0085] This embodiment has high scalability, is applicable to a variety of specific encryption, compression, and secure storage solutions, and has high scalability.
[0086] This embodiment can support the issuance of authorization certificates through server authorization or through pre-authorized authorization devices in offline authorization mode, and also supports active revocation of certificates. This embodiment no longer relies on an insecure real-time clock, but maintains the certificate life cycle through the system clock heartbeat; this embodiment implements two-way authentication and binding through challenge seeds and UIDs, prevents unauthorized debugging and replay authorization, and can record authorization to the server for subsequent auditing.
[0087] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a control system for a chip debugging function provided in an embodiment of the present application. The system can be applied to a board provided with a chip. The chip debugging function control system includes:
[0088] The request processing module 301 is used to generate a random number and encrypt the random number to obtain a random ciphertext if an authorization request transmitted by a target device is received; wherein the target device is a debugging device or a server;
[0089] An interaction module 302 is used to send the random ciphertext to the target device so that the target device adds the decryption result of the random ciphertext to the authorization certificate;
[0090] The verification module 303 is used to receive the authorization certificate sent by the target device and verify the authorization certificate;
[0091] The debugging function starting module 304 is used to add the identifier of the chip to the authorization certificate if the authorization certificate passes the verification, and start the debugging function of the chip using the authorization certificate, so that the debugging device can debug the chip.
[0092] After the board equipped with the chip receives the authorization request transmitted by the target device, the present embodiment can generate a random number and encrypt the random number to obtain a random ciphertext, ensuring that only a legitimate target device can decrypt and use the random number. The target device adds the decryption result to the authorization certificate, and the chip verifies the authorization certificate to prevent the forged authorization certificate from being used. After the authorization certificate and the decryption result are verified, the present embodiment adds the chip identifier to the authorization certificate, and then uses the authorization certificate with the added identifier to start the debugging function of the chip. The above process realizes two-way authentication between the target device and the chip, and also uses the chip identifier to ensure the uniqueness of the authorization certificate, so the present embodiment can improve the security of chip debugging.
[0093] Furthermore, it also includes:
[0094] A duration control module is used to determine whether an authorization duration is set in the authorization certificate after the debugging function of the chip is started using the authorization certificate; if so, the duration control function of the chip is started; wherein the duration control function of the chip is used to delete the locally stored authorization certificate when the authorization duration in the authorization certificate is less than or equal to a preset value so as to turn off the debugging function of the chip; if not, the duration control function of the chip is turned off.
[0095] Furthermore, it also includes:
[0096] The duration update module is used to determine whether the authorization duration is set in the authorization certificate. If the authorization duration is set in the authorization certificate, query the heartbeat signal of the chip according to a preset period; and if the heartbeat signal of the chip in the current period is queried, subtract the authorization duration in the authorization certificate from the duration corresponding to the preset period to obtain a new authorization duration.
[0097] Furthermore, it also includes:
[0098] The active revocation response module is used to delete the locally stored authorization certificate and return a response message indicating that the authorization certificate has been deleted if an authorization revocation instruction issued by the target device is received after the debugging function of the chip is started using the authorization certificate.
[0099] Furthermore, it also includes:
[0100] The storage module is used to encrypt the authorization certificate to obtain an encrypted certificate after adding the identifier of the chip to the authorization certificate; it is also used to write the encrypted certificate into the storage device of the board and transmit the encrypted certificate to the debugging device for archiving.
[0101] Furthermore, it also includes:
[0102] The debugging function starting module 304 is also used to start the debugging function of the chip after the authorization certificate and the decryption result are verified if the authorization mode of the authorization certificate is multi-board authorization.
[0103] Furthermore, the process of verifying the authorization certificate by the verification module 303 includes: determining whether the authorization certificate is complete to obtain a first judgment result; determining whether the decryption result in the authorization certificate is consistent with the random number to obtain a second judgment result; if the first judgment result and the second judgment result are both yes, then determining that the authorization certificate and the decryption result have passed the verification; if the first judgment result and the second judgment result are not both yes, then determining that the authorization certificate and the decryption result have not passed the verification.
[0104] Since the embodiments of the system part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the system part, which will not be repeated here.
[0105] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0106] The present application also provides an electronic device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.
[0107] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of this application.
[0108] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for controlling a chip debugging function, characterized in that: Applied to a board provided with a chip, the debugging function control method of the chip includes: If an authorization request transmitted by a target device is received, a random number is generated, and the random number is encrypted to obtain a random ciphertext; wherein the target device is a debugging device or a server; Sending the random ciphertext to the target device so that the target device adds the decryption result of the random ciphertext to the authorization certificate; Receiving the authorization certificate sent by the target device and verifying the authorization certificate; If the authorization certificate passes the verification, the identifier of the chip is added to the authorization certificate, and the debugging function of the chip is started using the authorization certificate, so that the debugging device can debug the chip.
2. The control method of chip debugging function according to claim 1, characterized in that: After starting the debugging function of the chip by using the authorization certificate, the method further includes: Determine whether the authorization duration is set in the authorization certificate; If yes, start the duration control function of the chip; wherein the duration control function of the chip is used to delete the locally stored authorization certificate when the authorization duration in the authorization certificate is less than or equal to a preset value, so as to turn off the debugging function of the chip; If not, the duration control function of the chip is turned off.
3. The control method of chip debugging function according to claim 2, characterized in that: After determining whether the authorization duration is set in the authorization certificate, the method further includes: If the authorization duration is set in the authorization certificate, query the heartbeat signal of the chip according to the preset period; If the heartbeat signal of the chip in the current period is queried, the authorization period in the authorization certificate is subtracted from the period corresponding to the preset period to obtain a new authorization period.
4. The control method of chip debugging function according to claim 1, characterized in that: After starting the debugging function of the chip by using the authorization certificate, the method further includes: If an authorization revocation instruction issued by the target device is received, the locally stored authorization certificate is deleted, and a response message indicating that the authorization certificate has been deleted is returned.
5. The control method of chip debugging function according to claim 1, characterized in that: After adding the identifier of the chip to the authorization certificate, the method further comprises: Encrypting the authorization certificate to obtain an encrypted certificate; The encrypted certificate is written into the storage device of the board, and the encrypted certificate is transmitted to the debugging device for archiving.
6. The control method of chip debugging function according to claim 1, characterized in that: Also includes: If the authorization mode of the authorization certificate is multi-board authorization, the debugging function of the chip is started after the authorization certificate and the decryption result are verified.
7. The control method of chip debugging function according to claim 1, characterized in that: Verifying the authorization certificate includes: Determine whether the authorization certificate is complete, and obtain a first determination result; Determine whether the decryption result in the authorization certificate is consistent with the random number, and obtain a second determination result; If both the first judgment result and the second judgment result are yes, it is determined that the authorization certificate and the decryption result have passed the verification; If the first judgment result and the second judgment result are not both yes, it is determined that the authorization certificate and the decryption result have not passed the verification.
8. A control system for chip debugging function, characterized in that: Applied to a board equipped with a chip, the debugging function control system of the chip includes: A request processing module, configured to generate a random number and encrypt the random number to obtain a random ciphertext if an authorization request transmitted by a target device is received; wherein the target device is a debugging device or a server; An interaction module, configured to send the random ciphertext to the target device so that the target device adds the decryption result of the random ciphertext to the authorization certificate; A verification module, used for receiving the authorization certificate sent by the target device and verifying the authorization certificate; The debugging function starting module is used to add the identifier of the chip to the authorization certificate if the authorization certificate passes the verification, and start the debugging function of the chip using the authorization certificate, so that the debugging device can debug the chip.
9. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and when the processor calls the computer program in the memory, the steps of the control method of the chip debugging function as claimed in any one of claims 1 to 7 are implemented.
10. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the control method of the chip debugging function according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method and device for de-multiplexing chip debugging pin of single-chip microcomputer
CN120972643A