Establishing Trust Relationship

1.Firmware header parsing and basic verification

Once the upgrade process begins, the system first reads the firmware header information from the input data stream, which includes firmware identification information, firmware data length, and CRC checksum for integrity verification.

If the firmware header data reading length is abnormal, or if the parsing of key fields fails, the system will immediately suspend the upgrade process and return an error status to prevent subsequent processing of abnormal or illegal firmware data.

2.Firmware version verification

During the upgrade process, the system parses the version number information of the firmware to be upgraded from the relevant fields in the firmware header and reads the currently running firmware version number from the local version information file as the baseline version for upgrade comparison.

Before performing firmware writing, the system compares the current version number with the firmware version number to be upgraded step by step. When the system detects that the firmware version number to be upgraded is lower than the current running version number of the device, it will immediately abort the upgrade process and refuse to continue executing firmware writing and upgrade operations.

This mechanism ensures that the device firmware version number monotonically increases, effectively preventing system errors due to misoperation or abnormal upgrades.

The system is rolled back to a lower firmware version to ensure system stability and functional consistency.

3.Firmware data writing and real-time CRC calculation

After the version number verification is passed, the system begins to read and write the firmware data in segments:

  • The firmware data is read sequentially from the input stream in fixed block sizes;
  • For each received data segment, the system performs cumulative calculations using the CRC32 algorithm while writing it to the storage medium;
  • The CRC check value is continuously updated throughout the firmware data processing process to ensure that all firmware data participates in the integrity verification calculation.This process ensures the consistency and reliability of the firmware data during transmission and writing.

4.CRC check result comparison and integrity verification

After all firmware data has been read and written, the system will compare the calculated CRC check result with the CRC check value carried in the firmware header:

  • If the CRC check results are consistent, it indicates that the firmware data has not been damaged or abnormal during transmission and writing, and the check passes;
  • If the CRC check results are inconsistent, the system will determine that the firmware data integrity check has failed, immediately terminate the upgrade process, and refuse to use the firmware.In addition, after the firmware is written, the system will reread the written firmware data from the storage medium and recalculate the CRC check value for secondary verification to further ensure the integrity of the firmware after storage.

5.Verification failure handling mechanism

During the firmware upgrade process, the system will stop the upgrade and enter the failure handling process if any of the following situations occur:

  • failure to read or parse firmware header information;
  • firmware version number to be upgraded is lower than the current running version;
  • firmware data CRC check mismatch;
  • an abnormality occurs during firmware data reading and writing.When a verification failure occurs, the system will update the upgrade status and notify the upper-level management module to prevent the abnormal firmware from being used, thereby ensuring the security and stability of the device operation.

E-Mail:support@dao-mi.com

Share

Scrollen Sie nach oben