A method, system, storage medium, and electronic device for protecting a chip's JTAG debug port.
By using a dynamic key burning protection method, a unique key is generated for each product, which solves the network security risks and limitations of the JTAG debug port, and achieves high security and flexibility in JTAG debug port protection, meeting the needs of automotive network security.
Patent Information
- Application Number
- CN202510001655.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2045-01-02
AI Technical Summary
Existing technologies have network security risks and limitations in protecting the JTAG debug port, cannot effectively prevent unauthorized access or tampering, and lack solutions for re-enabling the JTAG debug port.
By using a dynamic key protection method, a unique key is generated for each product. A one-to-one key is generated using the product feature number and encryption algorithm, which is then programmed into the MCU. Before the product is shipped, the JTAG debugging port is closed, and a local activation interface is reserved, allowing only local decryption and activation.
It implements unique key protection for each product to prevent remote access, ensuring security and flexibility, and allows local reactivation of the JTAG debug port when necessary, meeting automotive cybersecurity requirements.
Smart Images

Figure CN119760798B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip security protection technology, and in particular to a method for protecting the JTAG debug port of a chip. Background Technology
[0002] With the continuous evolution of communication technology, users can now seamlessly interact with various vehicle systems and remote servers using computers. Automotive cybersecurity faces numerous security threats. To ensure that data content in vehicle communications is not illegally obtained or leaked, there is an urgent need for analysis of potential vulnerabilities and corresponding prevention and control measures or design methods. A widely adopted approach is to apply key encryption technology. At every stage of data flow, even if an attacker manages to intercept all communication data, as long as they do not possess the corresponding decryption key, this data (i.e., ciphertext) remains unreadable to them.
[0003] One existing technical solution uses a mechanism that combines the encryption module and algorithm of a cloud server with three protection modes: JTAG passthrough, password protection, and permanent shutdown, to better protect the JTAG access process. This solution mainly relies on the cloud to perform a series of complex encryption protection operations on the key and interact with the local device to protect the JTAG access process. However, this method still has certain network security risks, and a series of protections for the cloud need to be considered.
[0004] Another existing technical solution improves the security and reliability of the programming file and chip by performing encryption and decryption operations on the programming file without storing the key on the ground and by disabling the JTAG debugging port by flashing the ECU. This technical solution can perform encryption and decryption operations on the programming file without storing the key on the ground and disable the JTAG debugging port after programming, but it does not consider a solution to re-enable the JTAG debugging port to achieve further debugging and analysis, which may have certain limitations in practical applications. Summary of the Invention
[0005] To address the problems in the prior art, this invention proposes a method for protecting the JTAG debug port of a chip.
[0006] The specific technical solution is as follows:
[0007] A method for protecting a chip's JTAG debug port, comprising:
[0008] Obtain the product feature number, use the product feature number as the basic segment to generate a one-to-one key, and use a different encryption algorithm for each segment key;
[0009] Configure the registers of the chip in the product, develop the protection function module of the chip to generate protection software code, and the chip will compile the software code that integrates the protection function to form a programming file;
[0010] The one-to-one key is written into the MCU of the chip by dynamically burning the file, and then the MCU is powered down and powered on again after the burning is completed.
[0011] Furthermore, specific sections of the encryption algorithm are equipped with key interfaces that allow for exclusive control of the key by inputting different content.
[0012] Furthermore, the processing of the burning file also includes: importing the burning file into the programmer, the host computer of the burning device extracting the product feature number and automatically generating a verification key locally through encryption algorithm software.
[0013] Furthermore, dynamic programming includes: starting the programming program, transmitting the key through the programmer to a specific address range of the programming file and programming it into the MCU.
[0014] Furthermore, after the MCU is powered on again, it re-attempts to access the JTAG debug port using multiple methods and performs protection function verification based on the access results:
[0015] If all access attempts fail, protection for the JTAG debug port will be enabled.
[0016] If access is successful in either method, the entire program will be erased and dynamically burned again.
[0017] Furthermore, the chip's ECU has a reserved communication interface for reactivating the JTAG debug port, which can only connect to the local host computer and communication tools.
[0018] A chip JTAG debug port protection system, applicable to the aforementioned chip JTAG debug port protection method, includes:
[0019] Key generation module: Obtains product feature code and generates a one-to-one key based on the product feature code;
[0020] Protection module: Generates software code with JTAG key protection functionality;
[0021] Programming module: Compiles the software code generated by the protection function module to form a programming file, and dynamically programs the one-to-one key into the MCU through the programming file;
[0022] ECU: Includes MCU, which verifies whether the protection function of the JTAG debug port is effective and provides a communication interface for local decryption and activation of the JTAG debug port.
[0023] Furthermore, the protection function module is connected to the programming module, and the programming module and the key generation module are connected to the MCU.
[0024] A storage medium storing a computer program, which, when executed by a processor, implements the aforementioned chip JTAG debug port protection method.
[0025] An electronic device includes a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor performs the aforementioned chip JTAG debug port protection method.
[0026] The above technical solution has the following advantages or technical effects:
[0027] 1. The present invention achieves the effect that each product has its own unique key by dynamically burning the key to protect the JTAG debugging port of the chip, and that the JTAG debugging port cannot be accessed or touched by any remote means after shipment.
[0028] 2. The MCU of this invention also reserves a communication interface. When there is an actual need, the JTAG debug port can still be activated and decrypted using a key and a pre-designed method after the product is returned. This ensures the security and reliability of the product during use, while also retaining the flexibility to activate and use the JTAG debug port under necessary conditions. Attached Figure Description
[0029] Figure 1 This is a flowchart of the method of the present invention;
[0030] Figure 2 This is a flowchart of the JTAG debug port decryption and activation chip of this invention;
[0031] Figure 3 This is a schematic diagram of the system connection of the present invention. Detailed Implementation
[0032] To make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0033] Example 1:
[0034] like Figure 1 As shown, a method for protecting a chip's JTAG debug port includes:
[0035] The product feature number is obtained and used as the base segment to generate a one-to-one key. Each key segment uses a different encryption algorithm. A key interface has also been developed for specific segments of the encryption algorithm, allowing for exclusive control of the key by inputting different content as needed. The product feature number refers to the product feature number of the BMS control board.
[0036] Based on the chip's own resources and architecture, specific registers of the chip in the product are configured, and protection function modules of the chip are developed to generate protection software code. The chip then compiles the software code that integrates the protection function to form a programming file.
[0037] A one-to-one key is dynamically programmed into the vehicle controller MCU via a programming file. After programming, the MCU is powered down and then powered on again. Once the programming is complete and the MCU restarts, the JTAG debug port connection is closed. At this point, the JTAG debug port cannot be accessed or touched by any external means of remote communication, and the protection function is activated. After protecting the JTAG port with the dynamically programmed key, the corresponding session and unlocking service are closed before the product is shipped. This prevents access to or contact with the JTAG port via any means of remote communication, and also prevents malicious access or tampering with the controller data.
[0038] There are seven common types of automotive cybersecurity, and the corresponding countermeasures are shown in Table 1 below:
[0039] Table 1: Types of Automotive Cybersecurity and Their Measures
[0040] type Security Threat Vulnerabilities measure Backend server Information cracking, insider attacks, unauthorized access, etc. Implement security controls on backend systems to minimize the risk of internal attacks, reduce unauthorized access, and prevent data breaches. Through system design and access control, prevent unauthorized personnel from accessing personal or critical system data. Vehicle remote communication Signal interference, code injection, replay attacks, etc. Use secure mechanisms (such as HSMs) to store keys. Use access control technologies and design to protect system data / code. Prevent unauthorized personnel from accessing personal or system-critical data. Measures should be taken to detect malicious internal messages or activities. Detection and recovery measures should be implemented to address denial-of-service attacks. Measures should be taken to prevent and detect unauthorized access. Measures should be taken to protect the system from viruses or malware. Vehicles should verify the authenticity and integrity of information they receive. Vehicle function upgrade The upgrade package was maliciously modified, and the OTA upgrade process was attacked, including by DoS attacks. Use secure software to update procedures. Store keys securely. Implement security controls for backend systems. Human error Personnel failing to follow established procedures in information security work, etc. Define and control user roles and access permissions. At the organizational level, ensure that security processes are defined and followed, including logging operations and access related to security function management. Near-field communication USB, OBD, WIFI, NFC, etc. Implement security controls for systems with remote access permissions. Implement security controls for external interfaces. Use security controls to minimize the foreseeable risks associated with third-party software installed on vehicles. Software should undergo security assessment, certification, and integrity protection. Vehicle data and codes Malicious access or tampering with vehicle data, system diagnostic data, etc. Employ access control technologies to protect system data and code. Use access control technologies to prevent unauthorized personnel from accessing personal or system-critical data. Employ secure measures (such as security modules) to store keys. Correlate data from different sources to mitigate data manipulation attacks on sensors or transmitted data.
[0041] It can be seen that the potential threats to automotive cybersecurity require adequate security mechanisms and access control technologies to address them. Protecting access to the JTAG debug port (a commonly used programming debug port for Joint Test Action Group chips) is a very important protective measure against cybersecurity threats.
[0042] Existing technologies protect JTAG access by encrypting and protecting the key in the cloud and interacting with the local device. However, this method still involves external connections, and there are certain network security risks from the perspectives of exposure and controllability. This invention protects the JTAG debug port by dynamically burning the key and then closing the corresponding session and unlocking service before the product is shipped. This prevents access to the JTAG debug port through any remote communication. It can only be reactivated through local interaction and decryption after the product is returned, thus providing higher security.
[0043] When the programming file with integrated JTAG key protection is imported into the programmer, the programmer's host computer can also extract the product feature number and automatically generate a verification key locally using the developed encryption algorithm software. After the programmer starts running, the key will be automatically transmitted to the specific address range of the programming file and programmed into the MCU of the vehicle controller according to the preset method, thus realizing the dynamic programming function.
[0044] After programming is complete, the programmer automatically powers down and then back on the MCU. Upon power-up, the MCU re-attempts to access the JTAG debug port using multiple methods and verifies the protection function based on the access results: if all access attempts fail, the protection for the JTAG debug port takes effect; if any access method succeeds, the entire program is erased, and dynamic programming is performed again. By dynamically programming the key protection chip's JTAG port, automatic protection function verification is performed, effectively preventing human error or oversight.
[0045] After JTAG encryption is implemented, the product enters the subsequent production stage. At this point, basic software interactions can still occur through specific communication interfaces and sessions, bypassing the JTAG debug port. However, before final shipment, all local and remotely accessible sessions and services in the application environment will be permanently disabled via software commands. This ensures that the MCU's internal JTAG debug port is inaccessible by any remote or conventional local means after shipment and during subsequent use, meeting automotive cybersecurity requirements. If problems arise during product use requiring in-depth analysis via JTAG debugging, the product must be replaced and returned to the manufacturer for decryption, JTAG activation, and analysis by the manufacturer's designated technical team.
[0046] The controller ECU (Electronic Control Unit) has a reserved communication interface for reactivating the JTAG debug port. This communication interface can only connect to the local host computer and communication tools, and is used to enable interaction, conversation, and services with the local host computer and communication tools. For example... Figure 2 As shown, after the problematic product is returned to the manufacturer, the technical team can first identify the product's unique identifier, then determine the corresponding key interface content, and finally input it into the developed encryption algorithm software to extract the automatically generated verification key. The technical team interacts with the specific communication interface through a local host computer, communication tools, and wiring harness. Under the reserved session and service, the verification key is transmitted to the MCU according to a predefined sequence and method. When the MCU internally verifies the transmitted verification key against the key written during encryption and confirms their consistency, the JTAG debug port is reactivated. After ensuring software maturity and reaching an agreement with the user, there is no need to upgrade the controller software or interact with the backend server. This short-range communication method requires knowledge of the specific product's unique identifier, encryption algorithm, communication interface, and session to access the JTAG port, offering high security and reliability.
[0047] Existing technologies can encrypt and decrypt files without storing the key on the chip and disable the JTAG debug port after burning, but they do not consider a solution to reactivate the JTAG debug port for further debugging and analysis. This invention configures the JTAG protection mode through software code and applies it to the burning file. After burning, the JTAG debug port can be disabled, but it can still be reactivated later by transmitting the key generated based on the product feature number and encryption algorithm to the chip through the reserved communication interface and protocol to meet the needs of further debugging and analysis.
[0048] This invention protects the JTAG debug port by dynamically burning a key and then closes the corresponding session and unlocking service before the product is shipped. This makes it impossible to access or contact the JTAG debug port through any remote communication. It can only be reactivated through local interaction and decryption after the product is returned, which has higher security and a certain degree of flexibility.
[0049] Existing technologies can effectively protect the burning file by encrypting and decrypting it without storing the key on the disk. However, since the burning file is unique, the key is also unique, and from a probabilistic perspective, there is still a certain risk of it being cracked. This invention can generate a key one-to-one based on the product feature number and the encryption algorithm. Then, based on the burning file with JTAG key protection implemented through software code, the key is dynamically combined with a specific address segment of the burning file during the burning process. This achieves the same effect as disabling the JTAG debugging port after burning, but the key to reactivate the JTAG debugging port is different for each case. It is necessary to know the specific product feature number, encryption algorithm, communication interface, and session in order to access the JTAG debugging port, thus providing higher security and reliability.
[0050] Example 2:
[0051] like Figure 3 As shown, a chip JTAG debug port protection system includes: a key generation module, a protection function module, a programming module, and an ECU. The ECU includes an MCU. The protection function module is communicatively connected to the programming module, and the programming module and the key generation module are communicatively connected to the MCU.
[0052] Key generation module: Obtains product feature code and generates a one-to-one key based on the product feature code;
[0053] Protection module: Generates software code with JTAG key protection functionality;
[0054] Programming module: Compiles the software code generated by the protection function module to form a programming file, and dynamically programs the one-to-one key into the MCU through the programming file;
[0055] ECU: Includes MCU, which verifies whether the protection function of the JTAG debug port is effective and provides a communication interface for local decryption and activation of the JTAG debug port.
[0056] The system in this embodiment is applicable to the method in Embodiment 1. The MCU in this embodiment is the MCU of the vehicle controller. By protecting the JTAG debug port of the vehicle controller MCU, the requirements of automotive network security can be met.
[0057] Example 3:
[0058] A storage medium is disposed within an on-board controller, on which a computer program is stored, which, when executed by a processor, implements the method of Embodiment 1.
[0059] Example 4:
[0060] An electronic device, specifically an in-vehicle controller, includes a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor performs the method of embodiment 1.
[0061] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, systems, storage media, electronic devices, and computer program products according to the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0062] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0063] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0064] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A method for protecting a chip's JTAG debug port, characterized in that, include: Obtain the product feature number, use the product feature number as the basic segment to generate a one-to-one key, and use a different encryption algorithm for each segment key; Configure the registers of the chip in the product, develop the protection function module of the chip to generate protection software code, and the chip will compile the software code that integrates the protection function to form a programming file; The one-to-one key is written into the MCU of the chip by dynamically burning the file, and the MCU is powered down and then powered on again after the burning is completed. After the MCU is powered on again, it will re-attempt access to the JTAG debug port in multiple ways and perform protection function verification based on the access results: If all access attempts fail, protection for the JTAG debug port will be enabled. If access is successful in either method, the entire program will be erased and dynamically burned again. The chip's ECU has a reserved communication interface for reactivating the JTAG debug port. This communication interface can only be connected to the local host computer and communication tools.
2. The chip JTAG debug port protection method according to claim 1, characterized in that, The encryption algorithm has a key interface in certain sections that allows for exclusive control of the key by inputting different content.
3. The chip JTAG debug port protection method according to claim 1, characterized in that, The processing of the burning file also includes: importing the burning file into the programmer, and the host computer of the burning device extracting the product feature number and automatically generating a verification key locally through encryption algorithm software.
4. The chip JTAG debug port protection method according to claim 3, characterized in that, The dynamic programming includes: starting the programming program, transmitting the key through the programmer to a specific address range of the programming file and programming it into the MCU.
5. A chip JTAG debug port protection system, applicable to the chip JTAG debug port protection method according to any one of claims 1 to 4, characterized in that, include: Key generation module: Obtains product feature code and generates a one-to-one key based on the product feature code; Protection module: Generates software code with JTAG key protection functionality; Programming module: Compiles the software code generated by the protection function module to form a programming file, and dynamically programs the one-to-one key into the MCU through the programming file; ECU: Includes MCU, which verifies whether the protection function of the JTAG debug port is effective and provides a communication interface for local decryption and activation of the JTAG debug port.
6. The chip JTAG debug port protection system according to claim 5, characterized in that, The protection function module is communicatively connected to the programming module, and the programming module and the key generation module are communicatively connected to the MCU.
7. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a chip JTAG debug port protection method as described in any one of claims 1 to 4.
8. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements a chip JTAG debug port protection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
MCU-based FPGA property right protection and remote updating system and method
CN108875318A
Core code protection method of embedded chip
CN116049776A
Method and device for detecting information safety production consistency of vehicle and electronic equipment
CN119109818A