Trusted boot method and apparatus, electronic device, and readable storage medium
View Patent ↗A trusted boot method and apparatus, an electronic device, and a readable memory medium. In the method, an IE FUSE that supports only one data write and an IE FW that supports multiple data writes are designed, whereby a first key written in the IE FUSE is prevented from being tampered with. If a second key generated based on a first signature extracted from the current IE FW is different from the first key, it indicates that IE boot parameters stored in the current IE FW are already different from those initially stored in the IE FW, that is, the parameters have been tampered with. In most cases, the IE boot parameters stored in the IE FW should not be tampered with. Therefore, once tampering is discovered, there are reasons to believe that there is a security risk of malicious attacks.
1. A trusted boot method, comprising:
extracting a first key from an innovation engine (IE) (Filesystem in Userspace) FUSE, wherein the IE FUSE supports only one-time data write, the first key is generated based on an initial IE boot parameter stored in IE Firmware (FW), and the IE FW supports multiple data writes;
extracting a first signature from the IE FW, and generating a second key according to the first signature, wherein the second key is generated based on a current IE boot parameter stored in the IE FW;
determining whether the first key is the same as the second key;
in response to determining that the first key is the same as the second key, determining that the initial IE boot parameter stored in the IE FW is not tampered with, and controlling a Basic Input Output System (BIOS) through an Initial Boot Block (IBB) to boot an Operating System (OS); and
in response to determining that the first key is different from the second key, determining that the initial IE boot parameter stored in the IE FW is tampered with, and terminating a current boot;
wherein before the terminating a current boot, the method further comprises:
querying a preset special boot rule to determine whether there is any allow boot command corresponding to the current IE boot parameter; and
in response to determining that there is an allow boot command corresponding to the current IE boot parameter, controlling the BIOS through the IBB according to the current IE boot parameter to boot the OS, and simultaneously recording the current boot in a boot log as a special boot.
2. The trusted boot method according to claim 1 , wherein before the controlling a BIOS through an IBB to boot an OS, the method further comprises:
verifying whether a current BIOS boot parameter is trusted;
in response to determining that the current BIOS boot parameter is untrusted, terminating the step of controlling a BIOS through an IBB to boot an OS; and
in response to determining that the current BIOS boot parameter is trusted, executing the step of controlling a BIOS through an IBB to boot an OS.
3. The trusted boot method according to claim 2 , wherein the verifying whether a current BIOS boot parameter is trusted comprises:
extracting a third key from the IE FUSE, wherein the third key is generated based on an initial BIOS boot parameter stored in a BIOS boot parameter memory block, and the BIOS boot parameter memory block supports multiple data writes;
extracting a second signature from the BIOS boot parameter memory block, and generating a fourth key according to the second signature, wherein the fourth key is generated based on the current BIOS boot parameter stored in the BIOS boot parameter memory block;
determining whether the third key is the same as the fourth key;
in response to determining that the third key is the same as the fourth key, determining that the current BIOS boot parameter is trusted; and
in response to determining that the third key is different from the fourth key, determining that the current BIOS boot parameter is untrusted.
4. The trusted boot method according to claim 2 , wherein when the current BIOS boot parameter is stored in two memory blocks of Key Manifest (KM) and Boot Policy Manifest (BPM) separately, the verifying whether a current BIOS boot parameter is trusted comprises:
extracting a fifth key from the IE FUSE, wherein the fifth key is generated based on an initial BIOS boot parameter stored in the KM, and the KM supports multiple data writes;
extracting a third signature from the KM, and generating a sixth key according to the third signature, wherein the sixth key is generated based on the current BIOS boot parameter stored in the KM;
determining whether the fifth key is the same as the sixth key;
in response to determining that the fifth key is the same as the sixth key, extracting a seventh key from the KM; extracting a fourth signature from the BPM, and generating an eighth key according to the fourth signature; determining whether the seventh key is the same as the eighth key; in response to determining that the seventh key is the same as the eighth key, determining that the current BIOS boot parameter is trusted, wherein the seventh key is generated based on an initial BIOS boot parameter stored in the BPM, the BPM supports multiple data writes, and the eighth key is generated based on the current BIOS boot parameter stored in the BPM; and
in response to determining that the fifth key is different from the sixth key or the seventh key is different from the eighth key, determining that the current BIOS boot parameter is untrusted.
5. The trusted boot method according to claim 1 , further comprising:
obtaining a boot count of special boots within preset time statistically according to the boot log; and
in response to the boot count exceeding a preset count, giving a replacement prompt through a preset path, so as to replace a current chip device with a new chip device according to the replacement prompt, wherein a new first key generated based on the current IE boot parameter is stored in an IE FUSE of the new chip device.
6. An electronic device, comprising:
a memory, configured to store a computer program;
a processor, configured to execute the computer program to implement a trusted boot method;
wherein the trusted boot method comprises:
extracting a first key from an innovation engine (IE) (Filesystem in Userspace) FUSE, wherein the IE FUSE supports only one-time data write, the first key is generated based on an initial IE boot parameter stored in IE Firmware (FW), and the IE FW supports multiple data writes;
extracting a first signature from the IE FW, and generating a second key according to the first signature, wherein the second key is generated based on a current IE boot parameter stored in the IE FW;
determining whether the first key is the same as the second key;
in response to determining that the first key is the same as the second key, determining that the initial IE boot parameter stored in the IE FW is not tampered with, and controlling a Basic Input Output System (BIOS) through an Initial Boot Block (IBB) to boot an Operating System (OS); and
in response to determining that the first key is different from the second key, determining that the initial IE boot parameter stored in the IE FW is tampered with, and terminating a current boot;
wherein, before the terminating a current boot, the method further comprises:
querying a preset special boot rule to determine whether there is any allow boot command corresponding to the current IE boot parameter; and
in response to determining that there is an allow boot command corresponding to the current IE boot parameter, controlling the BIOS through the IBB according to the current IE boot parameter to boot the OS, and simultaneously recording the current boot in a boot log as a special boot.
7. The electronic device according to claim 6 , wherein before the controlling a BIOS through an IBB to boot an OS, the method further comprises:
verifying whether a current BIOS boot parameter is trusted;
in response to determining that the current BIOS boot parameter is untrusted, terminating the step of controlling a BIOS through an IBB to boot an OS; and
in response to determining that the current BIOS boot parameter is trusted, executing the step of controlling a BIOS through an IBB to boot an OS.
8. The electronic device according to claim 7 , wherein the verifying whether a current BIOS boot parameter is trusted comprises:
extracting a third key from the IE FUSE, wherein the third key is generated based on an initial BIOS boot parameter stored in a BIOS boot parameter memory block, and the BIOS boot parameter memory block supports multiple data writes;
extracting a second signature from the BIOS boot parameter memory block, and generating a fourth key according to the second signature, wherein the fourth key is generated based on the current BIOS boot parameter stored in the BIOS boot parameter memory block;
determining whether the third key is the same as the fourth key;
in response to determining that the third key is the same as the fourth key, determining that the current BIOS boot parameter is trusted; and
in response to determining that the third key is different from the fourth key, determining that the current BIOS boot parameter is untrusted.
9. The electronic device according to claim 7 , wherein when the current BIOS boot parameter is stored in two memory blocks of Key Manifest (KM) and Boot Policy Manifest (BPM) separately, the verifying whether a current BIOS boot parameter is trusted comprises:
extracting a fifth key from the IE FUSE, wherein the fifth key is generated based on an initial BIOS boot parameter stored in the KM, and the KM supports multiple data writes;
extracting a third signature from the KM, and generating a sixth key according to the third signature, wherein the sixth key is generated based on the current BIOS boot parameter stored in the KM;
determining whether the fifth key is the same as the sixth key;
in response to determining that the fifth key is the same as the sixth key, extracting a seventh key from the KM; extracting a fourth signature from the BPM, and generating an eighth key according to the fourth signature; determining whether the seventh key is the same as the eighth key; in response to determining that the seventh key is the same as the eighth key, determining that the current BIOS boot parameter is trusted, wherein the seventh key is generated based on an initial BIOS boot parameter stored in the BPM, the BPM supports multiple data writes, and the eighth key is generated based on the current BIOS boot parameter stored in the BPM; and
in response to determining that the fifth key is different from the sixth key or the seventh key is different from the eighth key, determining that the current BIOS boot parameter is untrusted.
10. The electronic device according to claim 6 , further comprising:
obtaining a boot count of special boots within preset time statistically according to the boot log; and
in response to the boot count exceeding a preset count, giving a replacement prompt through a preset path, so as to replace a current chip device with a new chip device according to the replacement prompt, wherein a new first key generated based on the current IE boot parameter is stored in an IE FUSE of the new chip device.
11. A non-transitory readable storage medium for storing a computer program, which when executed by a processor, causes the processor to implement a trusted boot method;
wherein the trusted boot method comprises:
extracting a first key from an innovation engine (IE) (Filesystem in Userspace) FUSE, wherein the IE FUSE supports only one-time data write, the first key is generated based on an initial IE boot parameter stored in IE Firmware (FW), and the IE FW supports multiple data writes;
extracting a first signature from the IE FW, and generating a second key according to the first signature, wherein the second key is generated based on a current IE boot parameter stored in the IE FW;
determining whether the first key is the same as the second key;
in response to determining that the first key is the same as the second key, determining that the initial IE boot parameter stored in the IE FW is not tampered with, and controlling a Basic Input Output System (BIOS) through an Initial Boot Block (IBB) to boot an Operating System (OS); and
in response to determining that the first key is different from the second key, determining that the initial IE boot parameter stored in the IE FW is tampered with, and terminating a current boot;
wherein before the terminating a current boot, the method further comprises:
querying a preset special boot rule to determine whether there is any allow boot command corresponding to the current IE boot parameter; and
in response to determining that there is an allow boot command corresponding to the current IE boot parameter, controlling the BIOS through the IBB according to the current IE boot parameter to boot the OS, and simultaneously recording the current boot in a boot log as a special boot.
12. The non-transitory readable storage medium according to claim 11 , wherein before the controlling a BIOS through an IBB to boot an OS, the method further comprises:
verifying whether a current BIOS boot parameter is trusted;
in response to determining that the current BIOS boot parameter is untrusted, terminating the step of controlling a BIOS through an IBB to boot an OS; and
in response to determining that the current BIOS boot parameter is trusted, executing the step of controlling a BIOS through an IBB to boot an OS.
13. The non-transitory readable storage medium according to claim 12 , wherein the verifying whether a current BIOS boot parameter is trusted comprises:
extracting a third key from the IE FUSE, wherein the third key is generated based on an initial BIOS boot parameter stored in a BIOS boot parameter memory block, and the BIOS boot parameter memory block supports multiple data writes;
extracting a second signature from the BIOS boot parameter memory block, and generating a fourth key according to the second signature, wherein the fourth key is generated based on the current BIOS boot parameter stored in the BIOS boot parameter memory block;
determining whether the third key is the same as the fourth key;
in response to determining that the third key is the same as the fourth key, determining that the current BIOS boot parameter is trusted; and
in response to determining that the third key is different from the fourth key, determining that the current BIOS boot parameter is untrusted.
14. The non-transitory readable storage medium according to claim 12 , wherein when the current BIOS boot parameter is stored in two memory blocks of Key Manifest (KM) and Boot Policy Manifest (BPM) separately, the verifying whether a current BIOS boot parameter is trusted comprises:
extracting a fifth key from the IE FUSE, wherein the fifth key is generated based on an initial BIOS boot parameter stored in the KM, and the KM supports multiple data writes;
extracting a third signature from the KM, and generating a sixth key according to the third signature, wherein the sixth key is generated based on the current BIOS boot parameter stored in the KM;
determining whether the fifth key is the same as the sixth key;
in response to determining that the fifth key is the same as the sixth key, extracting a seventh key from the KM; extracting a fourth signature from the BPM, and generating an eighth key according to the fourth signature; determining whether the seventh key is the same as the eighth key; in response to determining that the seventh key is the same as the eighth key, determining that the current BIOS boot parameter is trusted, wherein the seventh key is generated based on an initial BIOS boot parameter stored in the BPM, the BPM supports multiple data writes, and the eighth key is generated based on the current BIOS boot parameter stored in the BPM; and
in response to determining that the fifth key is different from the sixth key or the seventh key is different from the eighth key, determining that the current BIOS boot parameter is untrusted.
15. The non-transitory readable storage medium according to claim 11 , further comprising:
obtaining a boot count of special boots within preset time statistically according to the boot log; and
in response to the boot count exceeding a preset count, giving a replacement prompt through a preset path, so as to replace a current chip device with a new chip device according to the replacement prompt, wherein a new first key generated based on the current IE boot parameter is stored in an IE FUSE of the new chip device.