Firmware updating method, device and equipment, vehicle, storage medium and program product
By dividing the controller storage medium into software partitions and performing data consistency verification, the problem of controller startup failure caused by firmware updates was solved, and the integrity and security of firmware data were guaranteed.
Patent Information
- Application Number
- CN202610106605.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-08
AI Technical Summary
During the controller firmware update process, when new firmware data overwrites old firmware data, it may cause write errors or interruptions, resulting in controller startup failure.
The controller's storage medium is divided into multiple software partitions. When updating firmware data, the new firmware data is written to a partition with a different read address than the current firmware data. After the write is completed, an integrity check is performed to ensure data consistency, and then the read address is switched.
This reduces controller startup failures caused by firmware updates, ensures the integrity and correctness of firmware data, and improves the security and efficiency of firmware updates.
Smart Images

Figure CN121996273A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of embedded software technology, and in particular to a firmware update method, apparatus, device, vehicle, storage medium, and program product. Background Technology
[0002] Updating the firmware of the controller can fix functional security vulnerabilities, defend against cyberattack risks, optimize the performance of the vehicle system, and add intelligent functions, enabling dynamic iteration of the functions of the automotive electronic system throughout its entire life cycle. It is a core technical means to ensure the stability, security, and intelligent experience of vehicle equipment.
[0003] The controller's firmware is typically stored in the memory corresponding to the controller. In related technologies, when updating the controller's firmware, the new firmware data overwrites the old firmware data, and after the firmware data writing is complete, the new firmware data is read to start the controller's functions. This method has the potential to result in the controller failing to start after a firmware update. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a firmware update method, apparatus, device, vehicle, storage medium, and program product to ensure that the controller operates normally after the firmware update.
[0005] In a first aspect, embodiments of this application provide a firmware update method, including:
[0006] In response to receiving a firmware update command for the controller, the system obtains the first firmware data of the target firmware to be updated in the controller and determines that the firmware read address corresponding to the target firmware is the first software partition.
[0007] The first firmware data is written to the second software partition, which is different from the first software partition.
[0008] In response to the completion of the first firmware data writing, read the second firmware data that has been written to the second software partition in relation to the first firmware data, and verify whether the second firmware data is consistent with the first firmware data;
[0009] If the second firmware data is consistent with the first firmware data, the firmware read address of the target firmware is switched to the second software partition.
[0010] This allows the original firmware data in the controller to be retained while updating the firmware data. Even if the firmware data update fails, the controller can still start based on the original firmware data, reducing the startup failure problem caused by the firmware update. Furthermore, the written firmware data is verified after it is written, which ensures the integrity of the firmware data update. After confirming the integrity and correctness of the firmware data update, the firmware read address is switched to ensure the normal startup of the controller function.
[0011] In one possible implementation, verifying whether the second firmware data is consistent with the first firmware data includes:
[0012] Obtain firmware verification data, which is the verification data generated by the application verification algorithm based on the first firmware data;
[0013] Based on the firmware verification data, verify whether the second firmware data is consistent with the first firmware data.
[0014] This enables efficient consistency verification between the first firmware data and the second firmware data.
[0015] In one possible implementation, the verification algorithm is a secure hash algorithm, which verifies whether the second firmware data is consistent with the first firmware data based on the firmware verification data, including:
[0016] Apply a secure hash algorithm to obtain the hash value corresponding to the second firmware data;
[0017] If the hash value matches the firmware verification data, it is determined that the second firmware data is consistent with the first firmware data.
[0018] If the hash value is inconsistent with the firmware verification data, it is determined that the second firmware data is inconsistent with the first firmware data.
[0019] This fully utilizes the security performance of the secure hash algorithm to perform highly secure consistency verification of the first firmware data and the second firmware data.
[0020] In one possible implementation, the controller is equipped with a hardware security module. The controller's firmware update package includes firmware data of a first firmware and firmware data of a second firmware corresponding to the hardware security module. The second firmware is other firmware in the controller besides the first firmware. In response to receiving a firmware update command for the controller, the controller obtains the first firmware data of the target firmware to be updated, including:
[0021] In response to receiving a firmware update command for the controller, obtain the firmware update package;
[0022] Compare the firmware data in the firmware update package with the application firmware data corresponding to the first and second firmware respectively to see if there are any differences.
[0023] If there are differences, the firmware with the different firmware data is taken as the target firmware, and the firmware data corresponding to the target firmware is obtained from the firmware update package as the first firmware data.
[0024] This allows for the upgrading of multiple firmware versions in the controller based on a single firmware update command, improving firmware update efficiency and firmware data version management efficiency.
[0025] In one possible implementation, the firmware update package also includes firmware verification information, and before writing the first firmware data to the second software partition, it further includes:
[0026] Verify the validity of the first firmware data based on the firmware verification information.
[0027] This ensures the effectiveness of firmware updates and reduces the likelihood of controller failures caused by errors in the initial firmware data, which could lead to startup failures after the firmware update.
[0028] In one possible implementation, before writing the first firmware data to the second software partition, the method further includes:
[0029] The validity of the firmware update command is determined based on the authentication information carried in the firmware update command.
[0030] This prevents malicious firmware tampering and improves the security of firmware updates.
[0031] In one possible implementation, determining the validity of the firmware update command based on the authentication information carried by the firmware update command includes:
[0032] If the authentication information carried by the firmware update command is consistent with the one-device-one-key authentication information stored in the controller, the firmware update command is deemed valid. Different controllers have different one-device-one-key authentication information.
[0033] This can improve the security of firmware updates.
[0034] In one possible implementation, after switching the firmware read address of the target firmware to the second software partition, the method further includes:
[0035] Enable write protection for the second software partition.
[0036] This reduces the chance of firmware being tampered with after an update, thus enhancing the security of firmware updates.
[0037] In one possible implementation, before writing the first firmware data to the second software partition, the method further includes:
[0038] The version number corresponding to the first firmware data is determined to be newer than the version number corresponding to the firmware data in the first software partition.
[0039] This effectively prevents firmware data from being rolled back.
[0040] In one possible implementation, before writing the first firmware data to the second software partition, the method further includes:
[0041] Confirm that the vehicle is not in operation.
[0042] This reduces the possibility of the vehicle being attacked during firmware updates, ensuring vehicle security.
[0043] Secondly, embodiments of this application provide a firmware update device applied to a controller. The storage medium corresponding to the controller has a physical partition, which includes multiple software partitions divided by preset partition addresses. The firmware update device includes:
[0044] The acquisition module is used to respond to receiving a firmware update instruction for the controller, acquire the first firmware data of the target firmware to be updated in the controller, and determine that the firmware read address corresponding to the target firmware is the first software partition, wherein the first software partition is any software partition.
[0045] The writing module is used to write the first firmware data to the second software partition, which is different from the first software partition.
[0046] The verification module is used to respond to the completion of the first firmware data writing, read the second firmware data that has been written to the second software partition in response to the first firmware data, and verify whether the second firmware data is consistent with the first firmware data.
[0047] The switching module is used to switch the firmware read address of the target firmware to the second software partition if the second firmware data is consistent with the first firmware data.
[0048] In one possible implementation, the verification module is specifically used for:
[0049] Obtain firmware verification data, which is the verification data generated by the application verification algorithm based on the first firmware data;
[0050] Based on the firmware verification data, verify whether the second firmware data is consistent with the first firmware data.
[0051] In one possible implementation, the verification algorithm is a secure hash algorithm, and the verification module is further used for:
[0052] Apply a secure hash algorithm to obtain the hash value corresponding to the second firmware data;
[0053] If the hash value matches the firmware verification data, it is determined that the second firmware data is consistent with the first firmware data.
[0054] If the hash value is inconsistent with the firmware verification data, it is determined that the second firmware data is inconsistent with the first firmware data.
[0055] In one possible implementation, the controller is equipped with a hardware security module. The controller's firmware update package contains firmware data of a first firmware and a second firmware corresponding to the hardware security module. The second firmware is any firmware in the controller other than the first firmware. The acquisition module is specifically used for:
[0056] In response to receiving a firmware update command for the controller, obtain the firmware update package;
[0057] Compare the firmware data in the firmware update package with the application firmware data corresponding to the first and second firmware respectively to see if there are any differences.
[0058] If there are differences, the firmware with the different firmware data is taken as the target firmware, and the firmware data corresponding to the target firmware is obtained from the firmware update package as the first firmware data.
[0059] In one possible implementation, the firmware update package also includes firmware verification information. Before writing the first firmware data to the second software partition, the verification module is further used to:
[0060] Verify the validity of the first firmware data based on the firmware verification information.
[0061] In one possible implementation, before writing the first firmware data to the second software partition, the verification module is further configured to:
[0062] The validity of the firmware update command is determined based on the authentication information carried in the firmware update command.
[0063] In one possible implementation, the verification module is also used for:
[0064] If the authentication information carried by the firmware update command is consistent with the one-device-one-key authentication information stored in the controller, the firmware update command is deemed valid. Different controllers have different one-device-one-key authentication information.
[0065] In one possible implementation, after switching the firmware read address of the target firmware to the second software partition, the switching module is further configured to:
[0066] Enable write protection for the second software partition.
[0067] In one possible implementation, before writing the first firmware data to the second software partition, the verification module is further configured to:
[0068] The version number corresponding to the first firmware data is determined to be newer than the version number corresponding to the firmware data in the first software partition.
[0069] In one possible implementation, before writing the first firmware data to the second software partition, the verification module is further configured to:
[0070] Confirm that the vehicle is not in operation.
[0071] Thirdly, embodiments of this application provide a firmware update device, including: a memory and a processor;
[0072] The memory stores the instructions that the computer executes;
[0073] The processor executes computer execution instructions stored in memory, causing the processor to perform firmware update methods as described in the various embodiments of the first aspect.
[0074] Fourthly, embodiments of this application provide a vehicle, including: a vehicle body and a controller;
[0075] The controller is used to execute firmware update methods as described in the various embodiments of the first aspect.
[0076] Fifthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed, are used to implement the firmware update method as described in the various embodiments of the first aspect.
[0077] Sixthly, embodiments of this application provide a computer program product, including a computer program that, when executed, implements the firmware update method as described in various embodiments of the first aspect.
[0078] The firmware update method, apparatus, device, vehicle, storage medium, and program product provided in this application are applied to a controller. The storage medium corresponding to the controller has physical partitions, which contain multiple software partitions divided by preset partition addresses. In response to receiving a firmware update instruction for the controller, the method obtains the first firmware data of the target firmware to be updated in the controller and determines the firmware read address corresponding to the target firmware as the first software partition. The first software partition can be any software partition, which can preserve the original firmware data in the controller while updating the firmware data. Even if the firmware data update fails, the controller can still start based on the original firmware data, reducing the startup failure problem caused by the firmware update. The first firmware data is written to a second software partition, which is different from the first software partition. In response to the completion of the first firmware data writing, the method reads the second firmware data already written to the second software partition for the first firmware data and verifies whether the second firmware data is consistent with the first firmware data. If the second firmware data is consistent with the first firmware data, the firmware read address of the target firmware is switched to the second software partition. This can ensure the integrity and correctness of the firmware data update. Furthermore, the firmware read address is switched only after confirming the integrity and correctness of the firmware data update, ensuring that the controller starts normally after the firmware update.
[0079] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0080] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0081] Figure 1 This is a schematic diagram of a firmware update scenario provided in an embodiment of this application;
[0082] Figure 2 A flowchart illustrating the firmware update method provided in this application embodiment;
[0083] Figure 3 This is a schematic diagram of the firmware update device structure provided in the embodiments of this application;
[0084] Figure 4 This is a schematic diagram of the structure of the firmware update device provided in the embodiments of this application;
[0085] Figure 5 This is a schematic diagram of the vehicle structure provided in an embodiment of this application. Detailed Implementation
[0086] Some embodiments of this disclosure will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. Various changes, modifications, and equivalents of the methods, apparatus, and / or systems described herein will become apparent upon understanding this disclosure. For example, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein, but can be changed as will become apparent upon understanding this disclosure, except for operations that must be performed in a particular order. Furthermore, for clarity and brevity, descriptions of features known in the art may be omitted.
[0087] The embodiments described in the following examples of this disclosure are not representative of all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0088] In related technologies, during the firmware update process, new firmware data overwrites old firmware data. If a write error occurs or the write process is interrupted during the writing of new firmware data, the controller will not have any usable complete firmware data, and the controller will fail to start after power-on.
[0089] To address the technical problems in related technologies, the firmware update method provided in this application divides the physical partition of the storage medium corresponding to the controller into multiple software partitions using preset partition addresses. When updating firmware data, the firmware data is written to a software partition with a different firmware read address than the current controller firmware, ensuring that the new firmware data does not overwrite the existing firmware data in the controller. During the firmware update process, integrity verification is performed on the firmware data written to the software partition to ensure that the firmware data is completely written to the software partition. After verification, the firmware read address of the controller is switched, achieving a complete and accurate firmware update and reducing the possibility of controller startup failures due to firmware updates.
[0090] Figure 1 This is a schematic diagram illustrating a firmware update scenario provided in an embodiment of this application. Figure 1As shown, the storage medium corresponding to the controller has physical partitions. Each physical partition contains multiple software partitions divided by preset partition addresses. For example, these include software partition A and software partition B. It is understood that the storage medium corresponding to the controller can be a storage medium integrated inside the controller, or it can be an external storage medium that can interact with the controller. This application does not limit the configuration of the storage medium. The firmware read address of the controller can be switched between multiple software partitions. For example, the firmware read address of the controller can be the firmware read address corresponding to software partition A, or it can be switched to the firmware read address corresponding to software partition B.
[0091] In some implementations, the controller also includes a hardware security module to provide security services for the vehicle. The firmware data of the hardware security module is stored on a storage medium corresponding to the controller, and firmware updates of the hardware security module are performed by the controller.
[0092] Figure 2 This is a flowchart illustrating the firmware update method provided in an embodiment of this application. Figure 2 As shown, the firmware update method provided in this application embodiment can be applied to, for example... Figure 1 The firmware update methods for the controller shown include:
[0093] S201. In response to receiving a firmware update instruction for the controller, the system obtains the first firmware data of the target firmware to be updated in the controller and determines that the firmware read address corresponding to the target firmware is the first software partition.
[0094] Specifically, the firmware update command for the controller can be either a firmware update command for the application within the controller or a firmware update command for the hardware security module within the controller. The firmware update command specifies the target firmware to be updated, as well as the corresponding new firmware data, i.e., the first firmware data. Simultaneously with acquiring the first firmware data, the firmware read address for the target firmware on the current controller is determined. For example, if the firmware read address for the target firmware on the current controller is the firmware read address corresponding to software partition A, then software partition A is determined to be the first software partition.
[0095] S202. Write the first firmware data to the second software partition, which is different from the first software partition.
[0096] For example, if the current controller's firmware read address for the target firmware is the firmware read address corresponding to software partition A, then the second software partition is a software partition other than software partition A. For example, the second software partition is software partition B. The first firmware data is written to the second software partition so that the firmware data stored in software partition A will not be overwritten. Before the controller's firmware read address is switched to software partition B, the controller can still read the firmware data in software partition A to start the function.
[0097] S203. In response to the completion of writing the first firmware data, read the second firmware data that has been written to the second software partition in relation to the first firmware data, and verify whether the second firmware data is consistent with the first firmware data.
[0098] During the firmware data writing process, hardware failures, environmental interference, and other factors may cause the data written to the storage medium to deviate from expectations. To verify that the first firmware data has been written completely and accurately to the second software partition, after the first firmware data is written, the second firmware data written to the second software partition in response to the first firmware data is read, and the consistency between the second firmware data and the first firmware data is verified.
[0099] In one implementation, the second firmware data is verified to be consistent with the first firmware data using pre-calculated verification data.
[0100] S204. If the second firmware data is consistent with the first firmware data, switch the firmware read address of the target firmware to the second software partition.
[0101] It is understandable that if the second firmware data is consistent with the first firmware data, it means that the first firmware data has been accurately and completely written into the second software partition. Switching the firmware read address of the target firmware to the second software partition will allow the controller to read the updated firmware data from the second software partition when reading the target firmware after startup.
[0102] The firmware update method provided in this application writes the first firmware data to a software partition that is different from the current firmware read address of the controller. This allows the original running firmware data in the controller to be retained while updating the firmware data. Even if the first firmware data update fails, the controller can still start based on the original running firmware data, reducing the startup failure problem caused by firmware update. The data written to the software partition is verified to ensure the integrity and correctness of the firmware data update. After confirming the integrity and correctness of the firmware data update, the firmware read address is switched to ensure that the controller starts normally after the firmware update.
[0103] In one possible implementation, verifying whether the second firmware data is consistent with the first firmware data includes:
[0104] Obtain firmware verification data, which is the verification data generated by the application verification algorithm based on the first firmware data;
[0105] Based on the firmware verification data, verify whether the second firmware data is consistent with the first firmware data.
[0106] Specifically, based on the verification algorithm, verification data corresponding to the first firmware data is generated. Then, the same verification algorithm is used to generate verification data corresponding to the second firmware data. If the verification data corresponding to the first firmware data and the verification data corresponding to the second firmware data are completely identical, it indicates that the second firmware data and the first firmware data are identical.
[0107] The firmware update method provided in this application embodiment is based on a verification algorithm to verify the consistency between the first firmware data and the second firmware data, thereby improving the efficiency and accuracy of the verification.
[0108] In one possible implementation, the verification algorithm is a secure hash algorithm, which verifies whether the second firmware data is consistent with the first firmware data based on the firmware verification data, including:
[0109] Apply a secure hash algorithm to obtain the hash value corresponding to the second firmware data;
[0110] If the hash value matches the firmware verification data, it is determined that the second firmware data is consistent with the first firmware data.
[0111] If the hash value is inconsistent with the firmware verification data, it is determined that the second firmware data is inconsistent with the first firmware data.
[0112] For example, the secure hash algorithm can be the SHA-256 secure hash algorithm, which can output a fixed-length hash value based on the input data, and the hash value is irreversible and collision resistant.
[0113] Specifically, the firmware verification data is based on a secure hash algorithm. It generates a hash value from the first firmware data and utilizes the irreversible nature of hash values. Even if the firmware verification data is leaked, the first firmware data cannot be obtained from the firmware verification data, thus improving firmware security.
[0114] Collision resistance of hash values means that for a given set of input data, it is impossible to find another different set of input data that produces the same hash value. In other words, if the input data are different, the hash values output by the secure hash algorithm will definitely be different. If the second firmware data is completely identical to the first firmware data, then the hash value generated by the secure hash algorithm based on the second firmware data should be completely identical to the firmware verification data. If the hash value generated by the secure hash algorithm based on the second firmware data is inconsistent with the firmware verification data, it indicates a difference between the second and first firmware data, suggesting a write error. In this case, the second firmware data in the second software partition may be unusable. To prevent abnormal controller startup, the firmware read address of the controller should be kept at the first software partition, and an exception log should be triggered.
[0115] The firmware update method provided in this application fully utilizes the irreversible nature of the secure hash algorithm to verify the second firmware data without exposing the first firmware data, thereby improving firmware security. Furthermore, based on the anti-collision algorithm of the secure hash algorithm, efficient consistency verification of the first and second firmware data is achieved.
[0116] In one possible implementation, the controller is equipped with a hardware security module. The controller's firmware update package includes firmware data of a first firmware and firmware data of a second firmware corresponding to the hardware security module. The second firmware is other firmware in the controller besides the first firmware. In response to receiving a firmware update command for the controller, the controller obtains the first firmware data of the target firmware to be updated, including:
[0117] In response to receiving a firmware update command for the controller, obtain the firmware update package;
[0118] Compare the firmware data in the firmware update package with the application firmware data corresponding to the first and second firmware respectively to see if there are any differences.
[0119] If there are differences, the firmware with the different firmware data is taken as the target firmware, and the firmware data corresponding to the target firmware is obtained from the firmware update package as the first firmware data.
[0120] Specifically, a hardware security module is a physical hardware device dedicated to protecting sensitive data, encryption keys, and cryptographic operations. It features an isolated operating environment independent of the host system and a high-strength security protection mechanism. It provides core cryptographic services such as key generation, storage, backup, encryption / decryption, and signature / verification. Through tamper-proof design, secure erasure, and strict access control technologies, it effectively resists physical attacks, logical attacks, and unauthorized access, ensuring that keys never leave the device's protected area.
[0121] like Figure 1As shown, a hardware security module can be integrated into the controller to provide safety services for the vehicle. In this case, the firmware data stored in the controller's corresponding storage medium can be divided into two categories: one is the firmware data of the first firmware corresponding to the hardware security module, and the other is the firmware data of other firmware besides the first firmware, i.e., the firmware data corresponding to the second firmware.
[0122] The firmware update method provided in this application update the controller by concatenating the firmware data corresponding to the first firmware and the second firmware to form a firmware update package. This ensures that the versions of the first firmware and the second firmware are compatible, avoiding controller malfunctions caused by incorrect version compatibility when the first firmware and the second firmware are managed independently.
[0123] During each firmware update for the controller, not all firmware may be updated. Therefore, the first and second firmware data are compared with the currently applied application firmware data. If there are differences, it means that a firmware update is required.
[0124] In a specific example, the firmware data corresponding to the first firmware is obtained from the firmware update package, and the application firmware data corresponding to the first firmware is obtained from the storage medium. If the contents of the two are completely identical, the first firmware does not need to be updated; if the contents of the two are different, it is determined that the first firmware needs to be updated, the first firmware is determined to be the target firmware, and the firmware data corresponding to the first firmware in the firmware update package is determined to be the first firmware data.
[0125] The processing of the second firmware is similar to the example above. It is understandable that the firmware data corresponding to the first and second firmware in the firmware update package can differ from the corresponding application firmware data in the storage medium. In this case, both the first and second firmware are target firmware, and the firmware data corresponding to the first and second firmware in the firmware update package are both first firmware data; only the location of the first firmware data corresponding to different firmware in the storage medium is different.
[0126] The firmware update method provided in this application uses a firmware update package mechanism to achieve version correspondence between the first firmware and the second firmware, avoiding controller malfunctions caused by incorrect version correspondence when the first firmware and the second firmware are managed independently, and providing convenience for firmware version management in the controller.
[0127] In one possible implementation, the firmware update package also includes firmware verification information, and before writing the first firmware data to the second software partition, it further includes:
[0128] Verify the validity of the first firmware data based on the firmware verification information.
[0129] Specifically, the firmware update package includes firmware data corresponding to the first firmware, firmware verification information corresponding to the first firmware, second firmware data, and firmware verification information corresponding to the second firmware data. The firmware verification information corresponding to the first firmware is generated based on the firmware data corresponding to the first firmware, and the firmware verification information corresponding to the second firmware is generated based on the firmware data corresponding to the second firmware.
[0130] To prevent the firmware data in the firmware update package from being tampered with during or after the controller receives the firmware update package, firmware verification information is used to verify the validity of the firmware data.
[0131] Specifically, as described in the above embodiments, the firmware data corresponding to the first firmware is obtained from the firmware update package, and the application firmware data corresponding to the first firmware is obtained from the storage medium. If there is a difference between the two contents, it is determined that the first firmware needs to be updated, the first firmware is determined to be the target firmware, the firmware data corresponding to the first firmware in the firmware update package is determined to be the first firmware data, and the firmware verification information corresponding to the first firmware is used to verify the first firmware data.
[0132] If the second firmware needs to be updated, the firmware data corresponding to the second firmware in the firmware update package is determined to be the first firmware data, and the first firmware data is verified using the firmware verification information corresponding to the second firmware.
[0133] The firmware update method provided in this application verifies firmware data based on firmware verification information carried in the firmware update package, preventing firmware data from being tampered with and improving the security of firmware updates.
[0134] In one possible implementation, before writing the first firmware data to the second software partition, the method further includes:
[0135] The validity of the firmware update command is determined based on the authentication information carried in the firmware update command.
[0136] After receiving the firmware update command, the controller first extracts the authentication information carried in the firmware update command, such as the sender's digital certificate, digital signature, and one-device-one-key verification information. Then, through the hardware security module or the preset security verification mechanism, the verification information is verified at multiple levels: first, the legality and validity of the digital certificate are verified; then, the consistency between the command data and the signature is compared through the signature verification process; at the same time, the one-device-one-key verification information is verified to match the controller's ownership. After confirming that all authentication information is true, complete, and consistent with the preset rules through multi-dimensional verification, the controller finally determines that the firmware update command has a legitimate sending source, has not been tampered with, and meets the authorization requirements, thus confirming the command is valid and allowing it to enter the subsequent firmware update process.
[0137] The firmware update method provided in this application determines the validity of the firmware update command based on the authentication information carried in the firmware update command, thereby ensuring the security of the firmware update.
[0138] In one possible implementation, determining the validity of the firmware update command based on the authentication information carried by the firmware update command includes:
[0139] If the authentication information carried by the firmware update command is consistent with the one-device-one-key authentication information stored in the controller, the firmware update command is deemed valid. Different controllers have different one-device-one-key authentication information.
[0140] Specifically, after receiving the firmware update command, the vehicle-mounted controller first extracts the authentication information from the command. Then, the controller invokes its built-in hardware security module to read the pre-stored unique one-device-one-key authentication information from its non-volatile storage. This information is derived from a unique key encrypted and written at the factory. The authentication information for different controllers is completely different due to the differences in the keys associated with the device serial number / VIN code. To ensure the isolation of the one-device-one-key authentication information, the hardware security module's built-in encryption algorithm verifies the consistency between the authentication information carried in the command and the locally pre-stored one-device-one-key authentication information. If the match is correct and no abnormalities such as information tampering or identity forgery are detected, the firmware update command is deemed legitimate, unaltered, and fully matches the target controller's identity and permissions. Ultimately, the firmware update command is deemed valid, allowing the initiation of subsequent firmware integrity verification and update processes.
[0141] The firmware update method provided in this application uses a unique password verification information to verify the validity of the firmware update command, thereby preventing the firmware data in the controller from being illegally tampered with and improving the security of firmware updates.
[0142] In one possible implementation, after switching the firmware read address of the target firmware to the second software partition, the method further includes:
[0143] Enable write protection for the second software partition.
[0144] After switching the firmware read address of the target firmware to the second software partition, mechanisms such as hash verification and data integrity verification are used to confirm that the firmware data has not been tampered with, is not missing, and is completely consistent with the target version. Then, the write protection activation process of the storage medium is automatically triggered: on the one hand, a write protection lock command is issued by calling the hardware security module; on the other hand, the write protection status flag of the storage medium is updated at the software level. This dual mechanism blocks any subsequent unauthorized write operation requests. After write protection is enabled, only read-only access is maintained, prohibiting modification, erasure, overwriting, or other operations on the second software partition, thus fundamentally resisting security risks such as malicious tampering, accidental writing, and virus injection.
[0145] The firmware update method provided in this application, after switching the firmware read address of the target firmware to the second software partition, enables write protection of the second software partition to ensure the integrity and stability of the firmware and ensure that the firmware data is not illegally modified during the subsequent operation of the controller.
[0146] In one possible implementation, before writing the first firmware data to the second software partition, the method further includes:
[0147] The version number corresponding to the first firmware data is determined to be newer than the version number corresponding to the firmware data in the first software partition.
[0148] It is understandable that firmware version rollback carries multiple potential risks and negative impacts: On the one hand, rollback operations may cause new functions to fail, patched security vulnerabilities to reappear, exposing the controller to known security threats. Furthermore, the rolled-back old firmware may be incompatible with subsequently updated hardware modules, communication protocols, or supporting software, leading to device malfunctions, data interaction failures, or even system crashes. On the other hand, if the configuration data, cached information, or key-derived data of the new firmware version are not completely cleared during the rollback process, conflicts between the old and new versions may occur, resulting in parameter errors, authentication failures, and other problems. Frequent rollbacks also increase the wear and tear on the storage medium, potentially leading to firmware corruption and device malfunction due to operational errors, affecting the controller's stability, security, and normal operating efficiency. Therefore, this embodiment of the application prevents firmware version rollback by comparing version numbers before writing firmware data.
[0149] The firmware update method provided in this application determines that the version number corresponding to the first firmware data is newer than the version number corresponding to the firmware data in the first software partition before the first firmware data is written to the second software partition. This effectively avoids the security risks caused by firmware version rollback and enhances the security of firmware updates.
[0150] In one possible implementation, before writing the first firmware data to the second software partition, the method further includes:
[0151] Confirm that the vehicle is not in operation.
[0152] Understandably, vehicle security services are provided by a hardware security module. When the hardware security module undergoes a firmware update, the controller corresponding to the module enters Random Access Memory (RAM) mode. The hardware security module cannot read the firmware stored in the storage medium, and therefore cannot provide security services. To prevent security attacks on the vehicle during firmware updates, firmware updates should be performed when the vehicle is not in operation.
[0153] The firmware update method provided in this application determines that the vehicle is in a non-operating state before writing the first firmware data to the second software partition, thereby reducing the risk of the vehicle being attacked when the hardware security module cannot provide security services.
[0154] Figure 3 This is a schematic diagram of the firmware update device provided in an embodiment of this application. Figure 3 As shown, this application embodiment provides a firmware update device 30, applied to a controller. The storage medium corresponding to the controller has a physical partition, which includes multiple software partitions divided by preset partition addresses. The firmware update device 30 includes:
[0155] The acquisition module 301 is used to, in response to receiving a firmware update instruction for the controller, acquire the first firmware data of the target firmware to be updated in the controller, and determine that the firmware read address corresponding to the target firmware is the first software partition, wherein the first software partition is any software partition.
[0156] The writing module 302 is used to write the first firmware data to the second software partition, which is different from the first software partition.
[0157] The verification module 303 is used to respond to the completion of the first firmware data writing, read the second firmware data that has been written to the second software partition in response to the first firmware data, and verify whether the second firmware data is consistent with the first firmware data.
[0158] The switching module 304 is used to switch the firmware read address of the target firmware to the second software partition if the second firmware data is consistent with the first firmware data.
[0159] In one possible implementation, the verification module 303 is specifically used for:
[0160] Obtain firmware verification data, which is the verification data generated by the application verification algorithm based on the first firmware data;
[0161] Based on the firmware verification data, verify whether the second firmware data is consistent with the first firmware data.
[0162] This enables efficient consistency verification between the first firmware data and the second firmware data.
[0163] In one possible implementation, the verification algorithm is a secure hash algorithm, and the verification module 303 is specifically used for:
[0164] Apply a secure hash algorithm to obtain the hash value corresponding to the second firmware data;
[0165] If the hash value matches the firmware verification data, it is determined that the second firmware data is consistent with the first firmware data.
[0166] If the hash value is inconsistent with the firmware verification data, it is determined that the second firmware data is inconsistent with the first firmware data.
[0167] This fully utilizes the security performance of the secure hash algorithm to perform highly secure consistency verification of the first firmware data and the second firmware data.
[0168] In one possible implementation, the controller is equipped with a hardware security module. The controller's firmware update package contains firmware data of a first firmware and a second firmware corresponding to the hardware security module. The second firmware is any firmware other than the first firmware in the controller. The acquisition module 301 is specifically used for:
[0169] In response to receiving a firmware update command for the controller, obtain the firmware update package;
[0170] Compare the firmware data in the firmware update package with the application firmware data corresponding to the first and second firmware respectively to see if there are any differences.
[0171] If there are differences, the firmware with the different firmware data is taken as the target firmware, and the firmware data corresponding to the target firmware is obtained from the firmware update package as the first firmware data.
[0172] This allows for the upgrading of multiple firmware versions in the controller based on a single firmware update command, improving firmware update efficiency and firmware data version management efficiency.
[0173] In one possible implementation, the verification module 303 is further configured to:
[0174] Verify the validity of the first firmware data based on the firmware verification information.
[0175] This ensures the effectiveness of firmware updates and reduces the likelihood of controller failures caused by errors in the initial firmware data, which could lead to startup failures after the firmware update.
[0176] In one possible implementation, the verification module 303 is further configured to:
[0177] The validity of the firmware update command is determined based on the authentication information carried in the firmware update command.
[0178] This prevents malicious firmware tampering and improves the security of firmware updates.
[0179] In one possible implementation, the verification module 303 is further configured to:
[0180] If the authentication information carried by the firmware update command is consistent with the one-device-one-key authentication information stored in the controller, the firmware update command is deemed valid. Different controllers have different one-device-one-key authentication information.
[0181] This can improve the security of firmware updates.
[0182] In one possible implementation, the switching module 304 is further configured to:
[0183] Enable write protection for the second software partition.
[0184] This reduces the chance of firmware being tampered with after an update, thus enhancing the security of firmware updates.
[0185] In one possible implementation, the verification module 303 is further configured to:
[0186] The version number corresponding to the first firmware data is determined to be newer than the version number corresponding to the firmware data in the first software partition.
[0187] This effectively prevents firmware data from being rolled back.
[0188] In one possible implementation, the verification module 303 is further configured to:
[0189] Confirm that the vehicle is not in operation.
[0190] Figure 4 This is a schematic diagram of the firmware update device provided in an embodiment of this application. Figure 4 As shown, the vehicle-mounted key management device 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the vehicle-mounted key management device 40 further includes a communication interface 403. The processor 401, memory 402, and communication interface 403 are connected via a communication bus 404.
[0191] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.
[0192] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0193] Figure 5 This is a structural schematic diagram of a vehicle provided in an embodiment of this application. Figure 5 As shown, this application embodiment provides a vehicle 50, including: a vehicle body 501 and a controller 502;
[0194] The controller 502 is used to execute firmware update methods in various possible implementations as described in the above embodiments.
[0195] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0196] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0197] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0198] Furthermore, the term “exemplary” is used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as “exemplary” is not necessarily to be construed as advantageous compared to other aspects or designs. Rather, the use of the term “exemplary” is intended to present the concept in a concrete manner. As used herein, the term “or” is intended to mean an inclusive “or” rather than an exclusive “or.” That is, unless otherwise specified or clear from the context, “X applies A or B” is intended to mean any of the natural inclusive arrangements. That is, “X applies A or B” satisfies any of the foregoing instances if X applies A; X applies B; or both X applies A and B. Additionally, unless otherwise specified or clear from the context to refer to the singular form, the articles “a” and “an” as used in this application and the appended claims are generally understood to mean “one or more.”
[0199] Similarly, although this disclosure has been shown and described with respect to one or more implementations, equivalent variations and modifications will occur to those skilled in the art upon reading and understanding this specification and the accompanying drawings. This disclosure includes all such modifications and variations and is limited only by the scope of the claims. In particular, with respect to the various functions performed by the components described above (e.g., elements, resources, etc.), unless otherwise indicated, the terminology used to describe such components is intended to correspond to any component (functionally equivalent) that performs the specific function of the described component, even if structurally not equivalent to the disclosed structure. Furthermore, although specific features of this disclosure may have been disclosed with respect to only one of several implementations, such features may be combined with one or more other features of other implementations, as may be desired and advantageous to any given or particular application. Moreover, with regard to the terms “comprising,” “owning,” “having,” “having,” or variations thereof as used in the detailed description or claims, such terms are intended to be inclusive in a manner similar to the term “including.”
[0200] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0201] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A firmware update method, characterized in that, include: In response to receiving a firmware update instruction for the controller, the system obtains the first firmware data of the target firmware to be updated in the controller and determines that the firmware read address corresponding to the target firmware is the first software partition. The first firmware data is written to a second software partition, which is different from the first software partition. In response to the completion of the first firmware data writing, read the second firmware data that has been written to the second software partition in relation to the first firmware data, and verify whether the second firmware data is consistent with the first firmware data; If the second firmware data is consistent with the first firmware data, the firmware read address of the target firmware is switched to the second software partition.
2. The firmware update method according to claim 1, characterized in that, The verification of whether the second firmware data is consistent with the first firmware data includes: Obtain firmware verification data, wherein the firmware verification data is verification data generated by the application verification algorithm based on the first firmware data; Based on the firmware verification data, verify whether the second firmware data is consistent with the first firmware data.
3. The firmware update method according to claim 2, characterized in that, The verification algorithm is a secure hash algorithm. The step of verifying whether the second firmware data is consistent with the first firmware data based on the firmware verification data includes: The secure hash algorithm is applied to obtain the hash value corresponding to the second firmware data; If the hash value matches the firmware verification data, then the second firmware data is determined to be consistent with the first firmware data. If the hash value is inconsistent with the firmware verification data, it is determined that the second firmware data is inconsistent with the first firmware data.
4. The firmware update method according to any one of claims 1 to 3, characterized in that, The controller is equipped with a hardware security module. The firmware update package of the controller contains firmware data of a first firmware and a second firmware corresponding to the hardware security module. The second firmware is other firmware in the controller besides the first firmware. The step of obtaining the first firmware data of the target firmware to be updated in the controller in response to receiving a firmware update instruction for the controller includes: In response to receiving a firmware update instruction for the controller, the firmware update package is obtained; Compare the firmware data in the firmware update package with the application firmware data corresponding to the first firmware and the second firmware, respectively, to see if there are any differences. If there is a difference, the firmware with the difference in firmware data is taken as the target firmware, and the firmware data corresponding to the target firmware is obtained from the firmware update package as the first firmware data.
5. The firmware update method according to claim 4, characterized in that, The firmware update package also includes firmware verification information, and before writing the first firmware data to the second software partition, it further includes: The validity of the first firmware data is verified based on the firmware verification information.
6. The firmware update method according to any one of claims 1 to 3, characterized in that, Before writing the first firmware data to the second software partition, the process also includes: The firmware update command is deemed valid based on the authentication information carried by the firmware update command.
7. The firmware update method according to claim 6, characterized in that, The step of determining the validity of the firmware update instruction based on the authentication information carried in the firmware update instruction includes: If the authentication information carried by the firmware update command is consistent with the one-device-one-key authentication information stored in the controller, the firmware update command is determined to be valid. Different controllers have different one-device-one-key authentication information.
8. The firmware update method according to any one of claims 1 to 3, characterized in that, After switching the firmware read address of the target firmware to the second software partition, the method further includes: Enable write protection for the second software partition.
9. The firmware update method according to any one of claims 1 to 3, characterized in that, Before writing the first firmware data to the second software partition, the process also includes: It is determined that the version number corresponding to the first firmware data is newer than the version number corresponding to the firmware data in the first software partition.
10. The firmware update method according to any one of claims 1 to 3, characterized in that, Before writing the first firmware data to the second software partition, the process also includes: Confirm that the vehicle is not in operation.
11. A firmware update device, characterized in that, Applied to a controller, the storage medium corresponding to the controller has physical partitions, the physical partitions containing multiple software partitions divided by preset partition addresses, the firmware update method includes: The acquisition module is configured to, in response to receiving a firmware update instruction for the controller, acquire the first firmware data of the target firmware to be updated in the controller, and determine that the firmware read address corresponding to the target firmware is a first software partition, wherein the first software partition is any software partition in the above. A writing module is used to write the first firmware data to a second software partition, the second software partition being different from the first software partition; The verification module is used to respond to the completion of the first firmware data writing, read the second firmware data that has been written to the second software partition in response to the first firmware data, and verify whether the second firmware data is consistent with the first firmware data; The switching module is used to switch the firmware read address of the target firmware to the second software partition if the second firmware data is consistent with the first firmware data.
12. The firmware update device according to claim 11, characterized in that, The verification module is specifically used for: Obtain firmware verification data, wherein the firmware verification data is verification data generated by the application verification algorithm based on the first firmware data; Based on the firmware verification data, verify whether the second firmware data is consistent with the first firmware data.
13. The firmware update device according to claim 12, characterized in that, The verification algorithm is a secure hash algorithm, and the verification module is further used for: The secure hash algorithm is applied to obtain the hash value corresponding to the second firmware data; If the hash value matches the firmware verification data, then the second firmware data is determined to be consistent with the first firmware data. If the hash value is inconsistent with the firmware verification data, it is determined that the second firmware data is inconsistent with the first firmware data.
14. The firmware update apparatus according to any one of claims 11 to 13, characterized in that, The controller is equipped with a hardware security module. The firmware update package of the controller contains firmware data of a first firmware and a second firmware corresponding to the hardware security module. The second firmware is other firmware in the controller besides the first firmware. The acquisition module is specifically used for: In response to receiving a firmware update instruction for the controller, the firmware update package is obtained; Compare the firmware data in the firmware update package with the application firmware data corresponding to the first firmware and the second firmware, respectively, to see if there are any differences. If there is a difference, the firmware with the difference in firmware data is taken as the target firmware, and the firmware data corresponding to the target firmware is obtained from the firmware update package as the first firmware data.
15. The firmware update device according to claim 14, characterized in that, The firmware update package also includes firmware verification information. Before writing the first firmware data to the second software partition, the verification module is further used to: The validity of the first firmware data is verified based on the firmware verification information.
16. The firmware update apparatus according to any one of claims 11 to 13, characterized in that, Before writing the first firmware data to the second software partition, the verification module is further configured to: The firmware update command is deemed valid based on the authentication information carried by the firmware update command.
17. The firmware update device according to claim 16, characterized in that, The verification module is also used for: If the authentication information carried by the firmware update command is consistent with the one-device-one-key authentication information stored in the controller, the firmware update command is determined to be valid. Different controllers have different one-device-one-key authentication information.
18. The firmware update apparatus according to any one of claims 11 to 13, characterized in that, After switching the firmware read address of the target firmware to the second software partition, the switching module is further configured to: Enable write protection for the second software partition.
19. The firmware update apparatus according to any one of claims 11 to 13, characterized in that, Before writing the first firmware data to the second software partition, the verification module is also used to: It is determined that the version number corresponding to the first firmware data is newer than the version number corresponding to the firmware data in the first software partition.
20. The firmware update apparatus according to any one of claims 11 to 13, characterized in that, Before writing the first firmware data to the second software partition, the verification module is also used to: Confirm that the vehicle is not in operation.
21. A firmware update device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the firmware update method as described in any one of claims 1 to 10.
22. A vehicle, characterized in that, include: Vehicle body and controller; The controller is used to perform the firmware update method as described in any one of claims 1 to 10.
23. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed, are used to implement the firmware update method as described in any one of claims 1-10.
24. A computer program product, characterized in that, Includes a computer program, which, when executed, implements the firmware update method according to any one of claims 1-10.
