The invention relates to the technical field of
firmware upgrading, in particular to an LZ77-based embedded
firmware security upgrading method and
system, which comprises the following steps: electrifying to obtain guide information and a
version identifier, judging a trigger condition and writing in an upgrading mode, generating a start mark to perform LZ77 compression, executing decryption and CRC (
Cyclic Redundancy Check) check, and reconstructing a
firmware comparison signature. And updating the guide pointer or recovering the snapshot, and monitoring
voltage evaluation abnormity to trigger
recovery interruption. According to the method, the
storage efficiency of the space occupied by the snapshot data is improved through
compression ratio evaluation before writing, a
data integrity screening mechanism is established in combination with AES
encryption head decoding and CRC comparison in the data block receiving process, the
data security guarantee in the firmware writing stage is enhanced, decoding
recovery is achieved through an original snapshot structure under the condition that comparison fails, and the
data integrity screening efficiency is improved. Power supply state dynamic evaluation is realized by combining
voltage change
rate analysis, snapshot
recovery and firmware
rollback are triggered through an abnormal trend, and the safety
processing capability in a
voltage abnormal environment is improved.