CN113742784A - System for applying method for accelerating verification of mapping file - Google Patents

System for applying method for accelerating verification of mapping file Download PDF

Info

Publication number
CN113742784A
CN113742784A CN202010462703.1A CN202010462703A CN113742784A CN 113742784 A CN113742784 A CN 113742784A CN 202010462703 A CN202010462703 A CN 202010462703A CN 113742784 A CN113742784 A CN 113742784A
Authority
CN
China
Prior art keywords
image file
digital signature
public key
hash value
verification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010462703.1A
Other languages
Chinese (zh)
Inventor
吴学儒
吴景桐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Realtek Semiconductor Corp
Original Assignee
Realtek Semiconductor Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Realtek Semiconductor Corp filed Critical Realtek Semiconductor Corp
Priority to CN202010462703.1A priority Critical patent/CN113742784A/en
Publication of CN113742784A publication Critical patent/CN113742784A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0863Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Power Engineering (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Storage Device Security (AREA)

Abstract

The present disclosure relates to a system for applying an accelerated verification image file method. A system for accelerating verification of mapping file is prepared as obtaining mapping file from the first non-volatile memory, calculating a hash value for said file, comparing said hash value with public key and digital signature to compare said hash value with said public key and digital signature stored in the second non-volatile memory for verifying mapping file in the first non-volatile memory, loading mapping file by system after verification is passed. Thus, the conventional method of verifying the image file by digital signature can be replaced, and the verification procedure of verifying the image file can be effectively accelerated.

Description

System for applying method for accelerating verification of mapping file
Technical Field
The specification discloses a technology for verifying an image file, in particular to a system for accelerating verification of the image file, which verifies the correctness of a protected image file by verifying the correctness of a hash value, a public key and a digital signature of the image file.
Background
In a System on a Chip (SoC), an embedded System (embedded System) is provided, and the embedded System is usually stored in a flash memory (flash memory) in the form of a firmware image (firmware image). In order to ensure that the used firmware comes from a secure trusted party, the conventional technology performs a security verification on the firmware to be loaded during the program loading process, wherein the verification is usually based on a digital signature (digital signature).
Fig. 1 shows a hardware architecture diagram of an embedded system, in which a system 10 such as a system on a chip (SoC) is shown, main circuit elements include a processor 101, a Read Only Memory (ROM)102, a Static Random Access Memory (SRAM)104, peripheral devices (peripherals)107, and a storage 106, and in addition, the system may need to be externally connected with a flash memory (flash memory)110, and therefore a flash controller (flash controller)105 is provided, and the flash memory 110 may be used for storing image files, such as firmware image files required for booting the system 10, or program codes that can be directly executed, and the like. The above circuit elements may be electrically connected to each other by a bus.
In the embedded system embodiment, a one-time Programming (OTP) memory 103 may be further provided, and the OTP memory 103 is write-once, and has a high cost and a limited storage space, so that only key data for verification, for example, can be stored in the OTP memory 103, but can be stored in another memory, such as the additional flash memory 110 in a specific embodiment.
According to the secure boot process in the embedded system, after the system is started, the system hardware is initialized, usually the power supply, clock, memory controller and peripheral devices of the system are initialized. Thereafter, a system boot program is executed, which is stored in a Read Only Memory (ROM), i.e., the boot program is executed from the ROM, and then verification of the firmware image file stored in a specific memory (e.g., the flash memory 110 shown in fig. 1) is started, which is used to ensure that the firmware image file being loaded is from a trusted party, usually based on a digital signature algorithm.
Referring to fig. 2, a flow of verifying a firmware image file in a conventional boot security verification procedure can be seen.
In step S201, a hash algorithm (hash algorithm) is used to calculate a hash value of the public key corresponding to a firmware image file, and the hash value is compared with the hash value of the public key stored in advance, in step S203, it is determined whether the hash values are consistent, if the hash values are not consistent, i.e. in step S215, the verification procedure of the image file fails; if the two are consistent, it indicates that the verification of the public key is successful, then step S205 is continued, the hash value of the firmware image file is calculated by an algorithm, and in step S207, the hash value of the image file generated by the algorithm in advance is compared to determine whether the verification of the image file is successful or not according to the comparison result.
If the hash value comparison result indicates that the hash value and the hash value are not consistent, in step S215, the verification of the mapping file fails; otherwise, if the comparison result is consistent, the step S209 is continued, and then the digital signature corresponding to the mapping file is verified. The digital signature is verified by verifying the correctness of the public key and the integrity of the firmware image file without tampering, and then the digital signature verification is performed by using the certified public key and the hash value of the firmware image file. When the digital signature fails to be verified, the image file fails to be verified in step S215.
On the contrary, when the digital signature of the image file is successfully verified in the determination of step S211, that is, the firmware image file is successfully verified (step S213), the image file may be loaded into the embedded system, wherein the content may be loaded into other memories on the system, such as the sram 104 shown in fig. 1, or may be directly executed (referred to as execution in place (XIP)) in a flash memory (e.g., the flash memory 110 shown in fig. 1) storing the image file, without being loaded into the system memory. Furthermore, under the extreme security considerations, a check is usually made after the firmware image is loaded to confirm the correctness of the loaded contents.
Common Digital Signature algorithms for validating firmware image files include, but are not limited to, RSA Digital Signature Algorithm, Elliptic Curve Digital Signature Algorithm (ECDSA), and Edward-Curve Digital Signature Algorithm (Edwards-Curve Digital Signature Algorithm, EdDSA). Common hash algorithms include various Non-cryptographic hash functions (Non-cryptographic hash functions) and cryptographic hash functions (Keyed/unwored cryptographic hash functions), such as MD5, SHA-1, SHA-2, and HMAC.
However, security-demanding systems often use digitally signed algorithms to verify the firmware image to be loaded, with higher security levels accompanied by higher computational load. For a system with a high security requirement, the verification of the digital signature needs a lot of operations, so that a long time is often required for the verification of the firmware image when the system is started, and for some devices, such as a video recording monitoring device and an electronic doorbell, the time required from the start of the device to the start of the device is very short, so that the system cannot take both the start speed and the security of the system into consideration. Therefore, for some systems with fast boot requirements, it may be chosen to sacrifice system security, and use an algorithm with fast verification speed but lower security to verify the firmware image file.
Disclosure of Invention
To achieve the goal of accelerated validation of image files without sacrificing security, the specification discloses a system that employs a method of accelerated validation of image files.
In the embodiment of the method for accelerating the verification of the image file executed by the system, the image file is obtained from the first non-volatile memory, a hash algorithm is executed on all or part of the image file to generate a hash value of the image file, and then the hash value of the image file is combined with a public key and a digital signature corresponding to the image file to compare the hash value of the image file, the public key and the digital signature which are backed up and stored in the other second non-volatile memory, so as to verify the image file stored in the first non-volatile memory. The mapping file can be a mapping file of firmware, a program or a file required by the system to execute a program, the first nonvolatile memory can be an external storage device connected with the system, and the second nonvolatile memory can be a nonvolatile memory in the system.
Further, if the comparison result shows that the hash value, the public key and the digital signature of the image file stored in the first non-volatile memory are consistent with the hash value, the public key and the digital signature of the image file backed up in the second non-volatile memory, the image file is verified, and the system can load the image file.
When the image file is judged to be successfully verified, the system is switched to take over by a starting program of the system, and the system loads the image file to complete a starting program.
Preferably, the hash value of the image file, the public key and the digital signature backed up in the second non-volatile memory can form a fast verification data, and then an authentication code is formed through calculation and stored in the second non-volatile memory. Correspondingly, the hash value of the image file, the public key and the digital signature in the first nonvolatile memory can be used for calculating an authentication code to be verified by the same algorithm, so that the authentication code in the second nonvolatile memory can be compared and verified in the same way.
Furthermore, if the comparison result shows that the hash value, the public key and the digital signature of the image file stored in the first non-volatile memory are inconsistent with the hash value, the public key and the digital signature of the image file backed up in the second non-volatile memory, the system can also execute the conventional process of verifying the image file by using the digital signature.
Furthermore, if the image file is successfully verified by the conventional verification process, the hash value, the public key and the digital signature of the image file backed up and stored in the second nonvolatile memory can be updated besides the image file is loaded by the system.
For a better understanding of the features and technical content of the present invention, reference should be made to the following detailed description and accompanying drawings, which are provided for purposes of illustration and description only and are not intended to limit the invention.
Drawings
FIG. 1 shows a hardware architecture diagram of an embedded system;
FIG. 2 shows a secure boot process in a conventional embedded system;
FIG. 3 is a conceptual diagram illustrating a technique for accelerating verification of an image file;
FIG. 4 is a flow diagram of an embodiment of a method for accelerating validation of an image file;
FIG. 5 is a flow diagram illustrating an embodiment of establishing fast authentication data;
FIG. 6 shows a flow diagram of an embodiment of validating the integrity of accelerated verification data;
FIG. 7 illustrates a flow diagram of an embodiment of a method of accelerating validation of an image file; and
FIG. 8 shows a flowchart of an embodiment of a method for applying accelerated validation of an image file.
Detailed Description
The following is a description of embodiments of the present invention with reference to specific embodiments, and those skilled in the art will understand the advantages and effects of the present invention from the disclosure of the present specification. The invention is capable of other and different embodiments and its several details are capable of modification and various other changes, which can be made in various details within the specification and without departing from the spirit and scope of the invention. The drawings of the present invention are for illustrative purposes only and are not intended to be drawn to scale. The following embodiments will further explain the related art of the present invention in detail, but the disclosure is not intended to limit the scope of the present invention.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various elements or signals, these elements or signals should not be limited by these terms. These terms are used primarily to distinguish one element from another element or from one signal to another signal. In addition, the term "or" as used herein should be taken to include any one or combination of more of the associated listed items as the case may be.
The specification discloses a System applying the method for accelerating the verification of the image file, which is applicable to a System needing to verify a specific program, file or firmware in real time, such as a single Chip System (SoC), the method can accelerate the program in the System, such as a boot program, and the method can generate more remarkable acceleration effect for a more complex System, such as a single Chip System with multiple boot programs. The proposed system for applying the method of accelerated verification of image files is applicable to various systems requiring verification of specific programs, files or firmware.
For embedded systems such as the above-mentioned single chip system, including electronic devices using the embedded system, a threat may be faced with that the content of an external storage device (e.g. the flash memory 110 shown in fig. 1) is modified, for example, a hacker replaces the normal firmware of the original device with a malicious program firmware, so as to achieve the purpose of invading the system and stealing confidential data. In the face of such threats, one of the defensive measures is to ensure the security of the image file to be loaded for execution when the relevant electronic device is powered on or starts up a specific program, including ensuring that the content therein is not tampered.
The system applying the method for accelerated verification of image files provided by the specification can meet the requirements of high security and quick start, wherein the technical scheme can refer to the technical concept schematic diagram of accelerated verification of image files shown in fig. 3. The system using the method can have various storage media, such as a first non-volatile memory 30, a second non-volatile memory 34, and a one-time programmable memory (OTP) 32.
Each firmware image file may be issued with a digital signature (digital signature) signed by an issuer through a private key (private key), in which case the image file 301 may be an image file (image file) of a program, file or firmware, and the digital signature 309 of the image file 301 is verified and stored in a specific storage medium, such as a non-volatile memory (NVM), e.g., a flash memory, etc., as shown in fig. 3, i.e., the first nonvolatile memory 30. The image file 301 is the object that needs to be verified after the system boots, and the digital signature 309 is used to ensure that the image file 301 comes from a trusted party. According to an embodiment, the first nonvolatile memory 30 or a specific storage device may be used for storing a public key (public security key)305 required for verifying the digital signature 309.
In the scheme for accelerating the verification of the image file, a hash algorithm (hash algorithm) is performed on the image file 301, a hash value 303 of the image file is obtained through the hash algorithm, the hash value 303 of the image file and a public key 305 and a digital signature (digital signature)309 used for verifying the image file 301 are backed up and stored in a non-volatile memory in the system, as shown in the second non-volatile memory 34, to form a backed-up hash value 303 ', a public key 305 ', and a digital signature 309 '. In one embodiment, the public key 305 may be hashed to generate a public key hash 307, and the public key hash 307 may be stored in the one-time programming memory 32 of the embedded system, so that when the system needs to retrieve the public key 305 to verify the digital signature 309, the public key hash 307 may be used to verify whether the public key 305 is tampered.
Furthermore, in one embodiment, when storing the backup data (303 ', 305', 309 '), the stored backup data of the image file hash value 303', the public key 305 'and the digital signature 309' may be protected by an encryption program. The hash 303 ', the public key 305 ', and the digital signature 309 ' of the image file stored in the second nonvolatile memory 34 can be protected by the key 311, and the key 311 itself can be stored in the one-time programmable memory 32 in the system, and only the trusted program can read the key. It is noted that the set of data (303 ', 305 ', 309 ') stored in the second nonvolatile memory 34 forms a fast verification data (fast verification data).
Through the above processes, backup data (303 ', 305 ', 309 ') including the hash value 303, the public key 305, and the digital signature 309 before the method for accelerating the verification of the image file is performed can be prepared, and during the backup, the backup data can be encrypted by the key 311 and then stored in the second nonvolatile memory 34 to form the fast verification data. Then, when the system is started or a specific program needs to be started, the method for accelerating verification of the image file is executed, and the image acceleration verification data is extracted after decryption, so as to verify the hash value, the public key and the digital signature of the image file to be loaded by fast verification data, which can refer to the flowchart of the embodiment shown in fig. 4 at the same time.
Before the method is run to prepare for loading the required firmware at system startup or executing the image file of a specific program or file, the system needs to execute the image file verification program, wherein an initial program (such as a startup program or a program executing a specific flow) is executed by a processor of the system to run the verification program, and the image file 301 is verified.
At first, the image file 301 is obtained from the first non-volatile memory 30, a hash value 303 of the image file is calculated by a hash algorithm (step S401), and then the hash value is added with the files such as the public key 305 and the digital signature 309 of the original verification image file 301 to compare the fast verification data stored in the second non-volatile memory 34 (step S403) to determine whether the data contents are consistent? (step S405). If necessary, the key 311 is obtained from the one-time programming memory 32, and then the image file hash value 303 ', the public key 305 ', and the digital signature 309 ' in the fast verification data are decrypted to check whether the contents of the image file hash value 303, the public key 305, and the digital signature 309 of the image file 301 stored in the first volatile memory 30 are correct.
When the contents of the mapping file hash value 303, the public key 305 and the digital signature 309 are completely consistent with the contents of the fast verification data (yes), it represents that the mapping file 301 passes the verification, and simultaneously verifies the correctness of the digital signature 309 of the mapping file 301 and the public key 305 for verifying the digital signature 309, so that the mapping file 301 can be directly loaded into the system (step S407). In one embodiment, when the system completes the verification of the image file 301, the verification procedure is switched to a boot procedure, so that the system loads the image file to complete a boot procedure.
On the contrary, if the image hash 303, the public key 305, the digital signature 309 of the image file 301 or the image file 301 itself is tampered, the system can detect the error in the boot or the fast verification mechanism in the specific program, and the verification process of the image file returns to the original verification method (i.e. the calculation process for verifying the digital signature), and the original system security can still be maintained. For example, in step S409, if the determination in step S405 shows that the verification is not successful, the verification process returns to the conventional verification process for verifying the image file by using the digital signature, that is, directly verifying the image file 301 stored in the first nonvolatile memory 30 by using the digital signature algorithm, if at least one of the comparison result shows that the image file hash value 303, the public key 305 and the digital signature 309 of the image file 301 do not match the backup data stored in the second nonvolatile memory 34 (at least one comparison result does not match the backup data), and this verification process is used to ensure that the image file being loaded is from a trusted party (e.g., step S205 in fig. 2) (step S409).
In step S409, when returning to the conventional verification process, the public key 305 needs to be retrieved and the correctness of the public key 305 can be verified before the public key 305 is retrieved, which includes reading the public key 305 corresponding to the mapping file 301 stored in the first nonvolatile memory 30, calculating a hash value of the public key 305, and comparing the hash value with the hash value 307 of the public key stored in the one-time programming memory 32 to confirm the correctness of the public key 305. The public key 305 with the correct content is used to verify the correctness of the digital signature 309, wherein a conventional digital signature algorithm is used to verify whether the digital signature 309 corresponding to the image file 301 is correct, and after the digital signature 309 is verified to be correct, the image file 301 can be loaded into the system.
It should be noted that the main basis for the fast verification of the image file in the method is the fast verification data consisting of the hash value 303 ', the public key 305 ' and the digital signature 309 ' of the image file stored in the second non-volatile memory 34, wherein the data can be stored in the memory after being encrypted. Another embodiment of comparing the fast verification data to confirm the correctness of the image file is to calculate the fast verification data to form an authentication code, which may be called an encrypted hash authentication code (HMAC), and store the encrypted hash authentication code in the second non-volatile memory 34 as a verification basis, where the second non-volatile memory 34 is the storage 106 shown in fig. 1. When verification is performed later, through the above-mentioned process, another authentication code to be verified, that is, another encrypted hash authentication code, is calculated by using the same algorithm with the image file hash value 303, the public key 305 and the digital signature 309 obtained from the numerical values in the first nonvolatile memory 30, and the encrypted hash authentication code stored in the second nonvolatile memory 34 is compared with the other authentication code to generate a verification result.
In the embodiment of the method for accelerating the verification of the image file, the verification program can replace a complex conventional digital signature operation method, namely, the time for verifying the digital signature in the prior art is reduced, and the verification program in a specific program to be executed by a system can be effectively accelerated, such as a starting program can be effectively accelerated. It is noted that the image fast verification data stored in the second non-volatile memory 34 needs to be updated only when the firmware, program or file in the image file is updated or the system is attacked to cause data corruption, and under normal conditions, the fast verification mechanism can shorten the image file verification time to speed up the system program and maintain security.
According to an embodiment, the above-mentioned fast verification data and the encrypted hash authentication code (HMAC) calculated from the fast verification data can be stored in the second nonvolatile memory 34, but can be stored in different memories according to the actual operation, for example, when the fast verification data is protected by encryption or the encrypted hash authentication code, the related data can still be stored in the first nonvolatile memory 30.
Referring to fig. 3, referring to the system hardware architecture embodiment shown in fig. 1, according to a system embodiment of the method for applying accelerated verification of an image file, the image file 301 is stored in a first nonvolatile memory 30, the first nonvolatile memory 30 may be an external storage device connected to the system, such as the flash memory 110 shown in fig. 1, the image file 301 is calculated by a hash (hash) to obtain a hash value in advance, the hash value is used to verify the integrity of the image file 301, the image file 301 is generally accompanied by a digital signature 309, and the digital signature 309 is used to verify that the image file 301 is really from a trusted party. In one embodiment, the public key 305 required to verify the image file 301 may also be stored in the flash memory 110, and the public key hash value 307 is stored in the one-time programming memory 32 as disclosed in the embodiment of fig. 3. When the image file is successfully verified, the image file is loaded, wherein the program code is loaded into the static random access memory (104, fig. 1) of the system for execution, or directly executed on the flash memory 110.
FIG. 5 is a flow diagram illustrating an embodiment of establishing fast authentication data.
When the image file originally to be loaded by the system is modified or a newly created image file is created, a trusted image file and the verification value thereof need to be created, and a hash value of the image file can be calculated by a hash algorithm for all or part of the image file with correct contents (step S501). It should be noted that the generated hash value of the image file can be calculated according to all or part of the image file, and then the hash value should be generated according to the equivalent content when verifying.
Next, the generated hash value of the image file, the public key and the digital signature corresponding to the image file are encrypted by using the key and an encryption algorithm (step S503), and the encrypted content is stored in a specific storage medium, such as a non-volatile memory, to become the fast verification data (step S505).
The fast verification data for verifying the correctness of the image file at a later time may be non-original values, and in an embodiment, a code for verification, i.e., an encrypted hash authentication code, may be further calculated according to the content of the fast verification data by a specific algorithm (step S507), and finally the code is stored in the storage medium (step S509).
It should be noted that the order of encryption and hash calculation in the above steps is not limited to the described embodiment. The mode of forming the encrypted hash information authentication code in the steps can encrypt the quick verification data and then calculate the code; alternatively, the keys used by the encryption algorithm may include a key to calculate an encrypted hash authentication code and a key to encrypt the fast verification data, which may be stored in a one-time programmable memory in the system; or the key used for encryption can be derived from the key stored in the one-time programmable memory before use. However, the key stored in the OTP memory can be restricted from being read by a hardware lock, e.g., only allowing access to the program that loads the image file during boot-up.
FIG. 6 is a flowchart illustrating an embodiment of verifying the integrity of the accelerated verification data, which is mainly used to verify the integrity of the fast verification data stored in the specific non-volatile memory of the system, wherein the main contents of the fast verification data are the hash value, the public key and the digital signature of the image file to be verified.
When the system starts a program, such as a boot program, or executes a specific program, the process provides for confirming the integrity of the fast verification data therein, and then continues to verify the image file therein after confirming the integrity. It is noted that the process of verifying the fast verification data in the process can be performed by a program recorded in the rom or a specific memory in the system, so as to ensure the security.
In the process, initially, in step S601, it is determined whether the fast verification data applied in the program exists, and if the fast verification data does not exist in the storage medium in the system or the external storage medium, the process is ended, which means that the fast verification data fails to be verified (step S619).
However, when the fast verification data is confirmed, in step S603, an authentication code for comparison is generated by the algorithm, and the authentication code is an encrypted hash authentication code for verification calculated by a specific algorithm using the hash value of the image file, the public key and the digital signature in the storage medium as described in the above embodiments.
At this time, in step S605, the calculated authentication code is compared with the authentication code that has been stored in the specific memory in advance, and it is determined whether the authentication code calculated at present is identical with the authentication code stored in advance according to the comparison result, and if not, the process is similarly ended, and the verification of the quick verification data fails (step S619).
If the comparison result shows that the authentication codes are consistent, step S607 is executed, and step S607 is to solve the problem that decryption is needed if there is an encryption condition, otherwise, the step of decryption can be skipped. When it is determined that the fast verification data is not encrypted, the process proceeds to step S611; if the encrypted data is available, step S609 is executed to decrypt the fast authentication data to obtain the unencrypted fast authentication data.
In step S611, data such as a public key and a digital signature are obtained from the fast verification data, and the public key and the digital signature corresponding to the mapping document to be verified are compared to determine whether they are consistent. If the public key is not consistent with the digital signature, it indicates that there is a misfalsification, and the process is terminated, indicating that the verification of the fast verification data fails (step S619).
If the comparison result shows that the two images are consistent, step S613 is executed to continue verifying the image file, including calculating a hash value of the image file for the image file to be verified, and then step S615 is executed to compare hash values of the image file stored in the quick verification data of the system in advance. If the two are not consistent, it indicates that the image file to be verified is falsified, and the process is ended (step S619). Otherwise, if the comparison result is consistent, in step S617, it indicates that the verification of the fast verification data is successful, and the subsequent process of accelerating the verification of the image file can be continued.
FIG. 7 shows a flow of another embodiment of the method for accelerated verification of an image file, which can return to the conventional verification process when the proposed method for accelerated verification of an image file is subjected to file tampering or is incorrect, and can rebuild the fast verification data again in the conventional verification process, so that the system can still operate in the flow of fast verification of an image file when it is needed next time.
In this example, step S701 is started to determine whether the system can successfully verify the image file by the method of accelerating verification of the image file, that is, the image file to be loaded is verified by using the above-mentioned fast verification data, and if the image file can be successfully verified, step S709 is continuously executed in addition to updating the fast verification data (step S707), so that the system loads the image file. Otherwise, if the image file cannot be verified by the method for accelerating verification of the image file, the process continues to step S703, the system exits the process for accelerating verification of the image file, and automatically executes the conventional verification procedure, and then in step S705, determines whether the system can successfully verify the image file.
If the verification fails, as shown in step S711, indicating that the verification of the image file fails, then a verification failure handling procedure is performed, including, if the image file can be successfully verified by a conventional verification method, continuing to step S709 to load the image file; or the flow is terminated.
Specifically, when the conventional verification method can successfully verify the image file, one reason of which is to indicate that the content of the image file is legally changed (e.g. modified by a trusted party), such as version update, error correction, etc., in this process, step S707 is executed, and the system uses the program therein to update the fast verification data for fast verifying the image file, that is, the hash value, the public key and the digital signature of the image file stored in the second nonvolatile memory mentioned in the above embodiment are updated as the basis for fast verifying the image file next time.
FIG. 8 is a flowchart of an embodiment of a system boot process for applying the method for accelerated verification of an image file, which is applied to the boot process in a system, when the system is booted, a boot loader is executed (step S801), and the boot loader running therein will execute system initialization (step S803) prior to the Read Only Memory (ROM)81, including initializing the hardware in the system, such as power supply, clock, memory, etc., then, step S805 is performed to verify the firmware image file that the system needs to load, and the verification step is performed according to the above embodiment, and mainly includes comparing the image file hash value (in this case, the firmware image file hash value) stored in the storage medium with the fast verification data composed of the public key and the digital signature to confirm the correctness of the firmware image file, instead of the conventional process of verifying the digital signature of the image file. After verification, in step S807, the system boots from the rom, and loads the required firmware image file into the Random Access Memory (RAM).
The process then prepares another boot program to load an image file of a specific program in the random access memory 82, and similarly verifies the image file by comparing the hash value of the image file, the public key and the digital signature to form fast verification data (step S809), and after verification is completed, the image file can be loaded into the random access memory (step S811), and subsequent steps including executing the loaded program can be performed (step S813).
By the verification program, the corresponding mapping files can be quickly verified no matter how much firmware, program or file is needed in any program after the system is started.
In summary, according to the embodiments of the system for accelerating the verification of the image file, it can be known that the method can accelerate the verification procedure for verifying the image file, i.e. in a computer program (such as a boot program), because the speed of verifying the firmware is accelerated, the computer program can be accelerated. For example, when a system in a power saving mode is to be woken up, the method can accelerate the time from waking up to the completion of booting when the system is woken up and the firmware needs to be verified; moreover, when the process of verifying the firmware image file can be accelerated, the calculation time used by the system is shorter, and the effect of saving electricity is achieved, and particularly, the effect of saving electricity is more remarkable when the system needs to be started and closed for multiple times; also, when the method is applied to a more complex system, such as a system with multiple boot programs, such as a complex system on a chip (SoC), the method can produce a more significant acceleration effect.
The disclosure is only a preferred embodiment of the invention and should not be taken as limiting the scope of the invention, so that the invention is not limited by the disclosure of the specification and drawings.
[ notation ] to show
10 system
101 processor
102 read-only memory
103 one-time programmable memory
104 static random access memory
105 flash memory controller
106 storage
107 peripheral devices
110 flash memory
30 first non-volatile memory
301 mapping file
303,303' hash value of image file
32 one-time programmable memory
305, 305' disclose secret keys
307 hash of public key
309,309' digital signature
34 second non-volatile memory
311 secret key
81 read-only memory
82 random access memory
Process for verifying mapping file in step S201-S215
Step S401-S409 fast verification mapping file flow
Process for updating fast verification data in steps S501-S509
Step S601-S619 flow for rapidly verifying mapping file
Step S701-S711 flow for quickly verifying mapping file
Application process for quickly verifying mapping file in steps S801-S813

Claims (10)

1. A system for applying a method of accelerated validation of image files, comprising:
a processor; and
a second non-volatile memory for storing the hash value of the image file, the public key and the digital signature, wherein the public key is used for verifying whether the digital signature is correct, and the digital signature is used for verifying whether the image file is from a trusted party along with the image file;
the method for accelerating the verification of the image file by the processor comprises the following steps:
obtaining an image file by a first non-volatile memory connected with the system, and executing a hash algorithm on all or part of the image file to generate an image file hash value; and
the mapping file hash value is combined with a public key and a digital signature corresponding to the mapping file, and the mapping file hash value, the public key and the digital signature which are backed up and stored in the second nonvolatile memory are compared;
if the comparison result shows that the mapping file hash value, the public key and the digital signature stored in the first non-volatile memory are consistent with the mapping file hash value, the public key and the digital signature stored in the second non-volatile memory, the mapping file passes verification, and the system loads the mapping file.
2. The system according to claim 1, wherein the backup image hash value, the public key and the digital signature are stored in the second non-volatile memory by an encryption program using a secret key, and when performing the comparison, the backup image hash value, the public key and the digital signature are obtained after decryption.
3. The system for applying the method of accelerated verification of image files of claim 1, wherein the system comprises a one-time programmable memory, the secret key being stored in the one-time programmable memory.
4. The system for applying the method of accelerated verification of image files according to claim 3, wherein the public key is processed by the hash algorithm to generate a hash value of the public key, and the hash value is stored in the one-time programmable memory, and when the system needs to take out the public key to verify the digital signature, the hash value of the public key is used to verify the public key.
5. The system of claim 1, wherein the image file is an image file of a firmware, a program or a file required by the system to execute a program.
6. The system for applying the method of accelerated verification of image files of claim 5, wherein the system is an embedded system having a flash memory controller, and the first non-volatile memory is an external flash memory connected to the system via the flash memory controller.
7. The system according to claim 6, wherein the embedded system is a single chip system having multiple boot-up programs.
8. The system according to claim 1, wherein the hash value of the image file backed up in the second non-volatile memory, the public key and the digital signature form a fast verification data, which is then calculated to form an authentication code, and the authentication code is stored in the second non-volatile memory; when the mapping file hash value is combined with the public key corresponding to the mapping file and the digital signature for comparison, the mapping file hash value, the public key and the digital signature in the first non-volatile memory are used for calculating an authentication code to be verified by the same algorithm, and the authentication code stored in the first non-volatile memory is compared to generate a verification result.
9. The system according to any one of claims 1 to 8, wherein in the method for accelerated verification of an image file, if the comparison result shows that the hash value of the image file, the public key, and the digital signature stored in the first non-volatile memory are inconsistent with the hash value of the image file, the public key, and the digital signature stored in the second non-volatile memory, the process of verifying the image file with the digital signature is performed.
10. The system of claim 9, wherein if the image file is successfully verified by a conventional verification process, the hash value, the public key and the digital signature of the image file stored in the second nonvolatile memory are updated in addition to the image file loaded by the system.
CN202010462703.1A 2020-05-27 2020-05-27 System for applying method for accelerating verification of mapping file Pending CN113742784A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010462703.1A CN113742784A (en) 2020-05-27 2020-05-27 System for applying method for accelerating verification of mapping file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010462703.1A CN113742784A (en) 2020-05-27 2020-05-27 System for applying method for accelerating verification of mapping file

Publications (1)

Publication Number Publication Date
CN113742784A true CN113742784A (en) 2021-12-03

Family

ID=78723575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010462703.1A Pending CN113742784A (en) 2020-05-27 2020-05-27 System for applying method for accelerating verification of mapping file

Country Status (1)

Country Link
CN (1) CN113742784A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130290694A1 (en) * 2012-04-30 2013-10-31 Cisco Technology, Inc. System and method for secure provisioning of virtualized images in a network environment
CN103914658A (en) * 2013-01-05 2014-07-09 展讯通信(上海)有限公司 Safe starting method of terminal equipment, and terminal equipment
US20190042765A1 (en) * 2017-08-02 2019-02-07 Samsung Electronics Co., Ltd. Security devices, electronic devices and methods of operating electronic devices
CN109583189A (en) * 2018-12-13 2019-04-05 深圳忆联信息系统有限公司 Firmware method for secure loading, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130290694A1 (en) * 2012-04-30 2013-10-31 Cisco Technology, Inc. System and method for secure provisioning of virtualized images in a network environment
CN103914658A (en) * 2013-01-05 2014-07-09 展讯通信(上海)有限公司 Safe starting method of terminal equipment, and terminal equipment
US20190042765A1 (en) * 2017-08-02 2019-02-07 Samsung Electronics Co., Ltd. Security devices, electronic devices and methods of operating electronic devices
CN109583189A (en) * 2018-12-13 2019-04-05 深圳忆联信息系统有限公司 Firmware method for secure loading, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US9965268B2 (en) Method and apparatus for preventing software version rollback
US8782388B2 (en) Information processing apparatus, method, and computer-readable storage medium that encrypt data in a blob based on a hash value
US7421588B2 (en) Apparatus, system, and method for sealing a data repository to a trusted computing platform
US8732445B2 (en) Information processing device, information processing method, information processing program, and integrated circuit
US7681024B2 (en) Secure booting apparatus and method
US7711944B2 (en) Method and apparatus for securely updating and booting code image
US20020157010A1 (en) Secure system and method for updating a protected partition of a hard drive
TWI760752B (en) System for accelerating verification procedure for image file
TW201500960A (en) Detection of secure variable alteration in a computing device equipped with unified extensible firmware interface (UEFI)-compliant firmware
JP6925542B2 (en) Software verification device, software verification method and software verification program
CN109445705B (en) Firmware authentication method and solid state disk
US11455115B2 (en) Storage device
EP3588354A1 (en) Automatic verification method and system
US20160350537A1 (en) Central processing unit and method to verify mainboard data
CN115357908B (en) Network equipment kernel credibility measurement and automatic restoration method
WO2023212178A1 (en) Sram physically unclonable function (puf) memory for generating keys based on device owner
CN114995918A (en) Starting method and configuration method and device of baseboard management controller and electronic equipment
WO2016024967A1 (en) Secure non-volatile random access memory
US11941159B2 (en) Configuration data deletion based on tamper status
CN113742784A (en) System for applying method for accelerating verification of mapping file
CN111695164B (en) Electronic apparatus and control method thereof
US11520662B2 (en) Recovery from corruption
US20230129942A1 (en) Method for locking a rewritable non-volatile memory and electronic device implementing said method
CN116089967B (en) Data rollback prevention method and electronic equipment
CN117193863B (en) Method, device, system and processor for starting host bootstrap program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination