Peripheral component interconnect express device starting method and apparatus, and storage medium
By verifying the firmware of PCIe devices through the BIOS, the problem of computer devices being unable to verify the integrity of PCIe devices is solved, ensuring secure device startup and reducing security risks.
Patent Information
- Application Number
- CN202010849505.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-21
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2040-08-21
AI Technical Summary
In the existing technology, computer devices cannot effectively verify the integrity of PCIe (Peripheral Component Interconnect) devices, which may lead to the implantation of malicious code and threaten the security of computer devices.
The BIOS verifies the firmware of PCIe devices to ensure their integrity, only boots PCIe devices with verified firmware, and controls them to a reset or power-down state or marks them as disabled to boot when verification fails.
It effectively avoids the security threats posed by PCIe devices to computer equipment, reduces the risks caused by firmware tampering, and ensures the secure startup and normal operation of the device.
Smart Images

Figure CN114077739B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, and storage medium for starting up a fast peripheral component interconnect device. Background Technology
[0002] With the development of network technology, computer equipment has increasingly stringent requirements for network security. In order to ensure the network security of computer equipment, during the system initialization process, the Trusted Platform Module (TPM) chip in the computer equipment verifies some components inside the computer equipment, and the computer equipment starts the verified components.
[0003] Taking the startup of the basic input output system (BIOS) of a computer device as an example, the current process of starting the BIOS is as follows: During system initialization, the TPM chip reads the BIOS firmware and performs integrity verification on the read firmware. If the read firmware passes the verification, the firmware has not been tampered with, and the computer device starts the BIOS. If the read firmware fails the verification, the firmware may have been tampered with, and the computer device does not start the BIOS, thus avoiding starting a tampered BIOS.
[0004] However, TPM chips can only perform integrity verification on some components in computer devices, such as the BIOS and baseboard management controller (BMC), but not on the peripheral component interconnect express (PCIe) devices mounted on the computer device. Therefore, the PCIe devices booted by the computer device are not necessarily safe. For example, the PCIe devices may have been infected with malicious code. When the operating system in the computer device communicates with the PCIe devices infected with malicious code, it may lead to the operating system being attacked by malicious code, thereby threatening the security of the computer device. Therefore, in order to avoid the threat to the security of computer devices by PCIe devices, there is an urgent need for a method that can safely boot PCIe devices. Summary of the Invention
[0005] This application provides a method, apparatus, and storage medium for quickly booting up a peripheral interconnect device, which can prevent PCIe devices from threatening the security of computer equipment. The technical solution is as follows:
[0006] Firstly, a method for quickly booting a PCIe device with interconnected peripheral components is provided, the method comprising:
[0007] The computer device's input / output system BIOS obtains the firmware of the PCIe device; the BIOS verifies the firmware; if the firmware passes verification, the BIOS boots the PCIe device.
[0008] This method verifies the firmware of PCIe devices through the BIOS to determine whether the firmware has been tampered with. The BIOS can only boot PCIe devices with verified firmware, thereby preventing computer devices from booting PCIe devices with tampered firmware and reducing the security risks posed by PCIe devices to computer devices.
[0009] In one possible implementation, the method further includes:
[0010] If the firmware fails verification, the BIOS will not boot the PCIe device.
[0011] Based on the above possible implementation methods, by not booting PCIe devices whose firmware has not passed verification, the computer device is prevented from booting PCIe devices whose firmware has been tampered with, thereby reducing the security risks posed by PCIe devices to the computer device.
[0012] In one possible implementation, the BIOS not booting the PCIe device includes:
[0013] The BIOS controls the PCIe device to be in a reset state or a power-off state.
[0014] Alternatively, the BIOS may mark the PCIe device as disabled to start, the disabled state indicating that the PCIe device should not be started.
[0015] Based on the above possible implementation methods, the PCIe device with unverified firmware can be controlled by the BIOS to be in a reset state or a power-off state, or the PCIe device containing the unverified firmware can be marked as a disabled boot state, thereby completely blocking the PCIe device with unverified firmware.
[0016] In one possible implementation, the computer device's input / output system BIOS obtains the firmware of the PCIe device by:
[0017] The BIOS reads an image of the firmware from the extended read-only memory ROM of the PCIe device.
[0018] In one possible implementation, the firmware includes signature data, and the method further includes:
[0019] The BIOS reads the image type of the image and the certificate type of the signature data from the read-only ROM. The image type is used to indicate the code type of the image, and the certificate type is used to indicate the encryption algorithm used when calculating the signature data.
[0020] In one possible implementation, the firmware includes firmware code and signature data for the firmware code;
[0021] The computer device's input / output system BIOS obtains the firmware of the PCIe device by:
[0022] The BIOS obtains the signature data of the firmware code from the driver of the PCIe device; the BIOS reads the firmware code from the PCIe device.
[0023] In one possible implementation, the BIOS reading the firmware code from the PCIe device includes:
[0024] The BIOS reads an image of the firmware code from the extended ROM of the PCIe device.
[0025] In one possible implementation, before the BIOS reads the image of the firmware code from the extended ROM of the PCIe device, the method further includes:
[0026] The BIOS reads the image type of the image and the certificate type of the signature data from the extended ROM. The image type indicates the code type of the image, and the certificate type indicates the encryption algorithm used when calculating the signature data.
[0027] In one possible implementation, the BIOS obtains the signature data of the firmware code from the driver of the PCIe device, including:
[0028] The BIOS reads the image of the driver from the extended ROM of the PCIe device;
[0029] The BIOS obtains the signature data of the firmware code from the driver image.
[0030] In one possible implementation, before the BIOS verifies the firmware, the method further includes:
[0031] The BIOS verifies the driver; if the driver passes verification, the BIOS executes the step of reading the firmware code from the PCIe device.
[0032] In one possible implementation, the BIOS stores the public key of the PCIe device, which is used to verify the firmware.
[0033] In one possible implementation, the method further includes:
[0034] The BIOS modifies the public key of the stored PCIe device based on public key modification instructions.
[0035] Secondly, a PCIe device boot apparatus is provided for executing the PCIe device boot method described above. Specifically, the PCIe device boot apparatus includes a functional module for executing the PCIe device boot method provided in the first aspect or any of the optional embodiments of the first aspect.
[0036] Thirdly, a computer-readable storage medium is provided, which stores at least one piece of program code that is loaded and executed by a processor to perform the operations performed by the PCIE device startup method described above.
[0037] Fourthly, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium, a processor of a computer device reading the computer instructions from the computer-readable storage medium, the processor executing the computer instructions, causing the computer device to perform the methods provided in the first aspect or various optional implementations of the first aspect.
[0038] Fifthly, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one piece of program code loaded by the processor to cause the computer device to implement the method provided in the first aspect or any alternative of the first aspect. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings required in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0041] Figure 2 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0042] Figure 3 This is a flowchart of a PCIe device boot method provided in an embodiment of this application;
[0043] Figure 4 This is a spatial diagram of an extended ROM provided in an embodiment of this application;
[0044] Figure 5 This is a schematic diagram illustrating the startup of a PCIe device according to an embodiment of this application;
[0045] Figure 6 This is a flowchart of another PCIe device boot method provided in an embodiment of this application;
[0046] Figure 7 This is a schematic diagram illustrating another PCIe device startup method provided in an embodiment of this application;
[0047] Figure 8 This is a flowchart of a PCIe device boot method provided in an embodiment of this application;
[0048] Figure 9 This is a schematic diagram of the structure of a PCIE device startup device provided in an embodiment of this application. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0050] Figure 1 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. See also... Figure 1 The computer device 100 includes multiple peripheral component interconnect express (PCIe) devices 101. The PCIe devices 101 include network cards, redundant arrays of independent disks (RAID) cards, graphics cards, peripheral component interconnect (PCI) solid state drive (SSD) cards, and accelerator cards, etc. This application embodiment does not specifically limit the PCIe devices 101.
[0051] Each PCIe device 101 includes a driver 1011 and firmware 1012. The driver 1011 is the PCIe device driver, which can be called by the BIOS running within the computer device 100 to enable data interaction between the BIOS and the PCIe device. During the initialization phase, the driver 1011 is also used to configure the parameters of the PCIe device. Optionally, the driver 1011 is a Unified Extensible Firmware Interface (UEFI) driver. The firmware 1012 is used to implement the functions of the PCIe device 101. For example, the target firmware of a network card is used to implement network connection, packet forwarding, and protocol offloading functions of the network card. Optionally, the firmware 1012 includes firmware code and signature data of the firmware code. The firmware code is the code used to implement the functions of the PCIe device 101, and the signature data is a digital signature of the firmware code, used to determine whether the firmware code has been tampered with; that is, the signature data is used to ensure the integrity of the firmware code. In another possible implementation, firmware 1012 does not include the signature data of the firmware code, which is stored in driver 1011. In this case, the firmware code can be regarded as firmware 1012.
[0052] The computer device 100 contains a BIOS that obtains the firmware 1012 of the PCIe device 101 and verifies it. If the firmware 1012 passes verification, the BIOS boots the PCIe device 101 containing the firmware 1012; otherwise, it does not boot. The BIOS obtains the firmware 1012 of the PCIe device 101 in two ways: Method 1 involves the BIOS reading the firmware 1012, including signature data and firmware code, from the PCIe device 101. Method 2 involves the BIOS reading the driver 1011 from the PCIe device 101, obtaining the signature data of the firmware code from the driver 1011, and then reading the firmware code from the PCIe device.
[0053] Optionally, the BIOS stores public keys for multiple PCIe devices 101, each public key corresponding to a target identifier of a PCIe device. A public key is used to verify the firmware of the PCIe device indicated by the corresponding target identifier. A target identifier is used to indicate a PCIe device; this target identifier is either the device identifier of the PCIe device or the slot identifier of the slot where the PCIe device is located. Optionally, when the BIOS receives a public key modification instruction, the BIOS modifies the stored public keys of the PCIe devices based on the instruction. The public key modification instruction includes at least one target public key and a target identifier corresponding to each target public key. For any target identifier corresponding to any of the at least one target public key, the BIOS modifies the stored public key corresponding to that target identifier to that target public key. Optionally, the BIOS also stores BIOS firmware, which is code used to implement BIOS functions. Optionally, the BIOS is a UEFI BIOS.
[0054] The computer device 100 also includes a processor 102, which can run on the random access memory (RAM) or read-only memory (ROM) of the processor 102. The processor 102 is connected to the PCIe device 101 via a target communication interface, enabling the BIOS to interact with the PCIe device through this interface. The target communication interface is a PCIe interface. The processor 102 includes a central processing unit (CPU), a graphics processing unit (GPU), and an artificial intelligence (AI) processor, etc. This embodiment does not specifically limit the processor 102.
[0055] It should be noted that in some embodiments, the driver and firmware of a PCIe device are separate, that is, the driver and firmware of a PCIe device are two separate parts, for example... Figure 1 The PCIe device 101 is shown. In some other embodiments, the driver for the PCIe device is located in the firmware, that is, the firmware includes the driver, firmware code, and signature data of the firmware code.
[0056] Figure 2This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 200 can vary significantly due to different configurations or performance. It includes one or more processors 201 and one or more memories 202. The computer device 200 also includes one or more PCIe devices 203. The memory 202 stores at least one line of program code, which is loaded and executed by the processor 201 to implement the PCIe device boot method provided in the following method embodiments. Of course, the computer device 200 may also have wired or wireless network interfaces and input / output interfaces for input / output. The computer device 200 may also include other components for implementing device functions, which will not be elaborated here.
[0057] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including program code that can be executed by a processor in a computer device to perform the PCIe device boot method in the following embodiments. For example, the computer-readable storage medium may be ROM, RAM, compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0058] To further explain the process by which the BIOS obtains the firmware of the PCIe device via Method 1, verifies the obtained firmware, and determines whether to boot the PCIe device based on the verification result, please refer to [reference needed]. Figure 3 The flowchart shown is a PCIe device boot method provided in an embodiment of this application. It is applied to computer devices including PCIe devices.
[0059] 301. PCIe devices store the firmware and drivers for PCIe devices.
[0060] The PCIe device can be any PCIe device, and the firmware includes firmware code and signature data. The driver includes target driver code and target signature data, wherein the driver code is the code that implements the driver function, and the target signature data is the digital signature of the driver code, used to ensure the integrity of the driver code.
[0061] In one possible implementation, the PCIe device acquires the firmware and drivers of the PCIe device, and stores the acquired firmware and drivers as ROM images in the PCIe device's expansion ROM. This expansion ROM contains any number of code images (i.e., ROM images) required for different system and processor architectures, for example... Figure 4The illustration shown is a spatial diagram of an extended ROM provided in this application embodiment. The extended ROM stores N+1 ROM images, designated as image 0 to image N. Each ROM image corresponds to an extended ROM header and a peripheral component interconnect (PCI) data structure, where N is an integer greater than 0. The extended ROM header and PCI data structure are used to store the information required for the corresponding ROM image. The extended ROM header stores the ROM signature and a pointer to the PCI data structure. The PCI data structure includes a pointer field, a length field, an image type field, a certificate type field, and other fields. The pointer field stores a device list pointer to indicate the devices supported by the extended ROM; the length field stores the length of the PCI data structure and the length of the ROM image corresponding to the PCI data structure; the image type field indicates the code type of the image, such as the driver type or firmware type; and the certificate type field stores the type of encryption algorithm used when calculating the signature data.
[0062] Optionally, the process of the PCIe device obtaining the firmware is as follows: the PCIe device calculates the firmware code based on a first digest calculation algorithm to obtain first digest data of the firmware code, and encrypts the first digest data based on the PCIe device's private key and a first encryption algorithm to obtain signature data of the firmware code; the PCIe device combines the firmware code and the signature data to form firmware. Optionally, the process of the PCIe device obtaining the driver is as follows: the PCIe device calculates the driver code based on a second digest calculation algorithm to obtain second digest data of the driver code, and encrypts the second digest data based on the PCIe device's private key and a second encryption algorithm to obtain target signature data; the PCIe device combines the driver code and the target signature data to form the driver.
[0063] The first digest calculation algorithm is an algorithm negotiated between the PCIe device and the BIOS for calculating the first digest data, and the second digest calculation algorithm is an algorithm negotiated between the PCIe device and the BIOS for calculating the second digest data. The first / second digest calculation algorithms include hash algorithms, message digest (MD) algorithms, secure hash algorithms (SHA), message authentication code (MAC) algorithms, and other digest calculation algorithms. This application embodiment does not specifically limit the first / second digest calculation algorithm. The first encryption algorithm is an encryption algorithm negotiated between the PCIe device and the BIOS for encrypting the first digest data. The second encryption algorithm is an encryption algorithm negotiated between the PCIe device and the BIOS for encrypting the second digest data. The first / second encryption algorithms include a digital signature algorithm (DSA), an elliptic curve digital signature algorithm (ECDSA), or the RSA encryption algorithm proposed by Ron Rivest, Adi Shamir, and Leonard Adleman. This application embodiment does not specifically limit the first / second encryption algorithm. The inverse algorithm of the first encryption algorithm is the first decryption algorithm, which is used to decrypt the signature data of the firmware code, and the decrypted data can be recorded as the first decrypted data. The inverse algorithm of the second encryption algorithm is the second decryption algorithm, which is used to decrypt the target signature data of the driver code, and the decrypted data can be recorded as the second decrypted data.
[0064] Optionally, the process by which the PCIe device combines the firmware code and the signature data into firmware is as follows: the PCIe device stores the signature data at a first target location in the firmware code to obtain the firmware. Optionally, the process by which the PCIe device combines the driver code and the target signature data into a driver is as follows: the PCIe device stores the target signature data at a second target location in the driver code to obtain the driver. Wherein, the first target location is the location in the firmware code negotiated between the PCIe device and the BIOS for storing the signature data. Optionally, the first target location can be any location in the firmware code, such as the beginning, middle, or end of the firmware code. The second target location is the location in the driver code negotiated between the PCIe device and the BIOS for storing the target signature data. Optionally, the second target location can be any location in the driver code, such as the beginning, middle, or end of the driver code. This application embodiment does not specifically limit the first / second target locations.
[0065] Upon acquiring the firmware, the PCIe device stores it as a ROM image in an extended ROM and configures the extended ROM header and PCI data structure corresponding to the firmware image. The extended ROM header stores a pointer to the PCI data structure, which includes a pointer field, a length field, an image type field, and a certificate type field. The pointer field indicates the devices supported by the extended ROM; the length field stores the length of the PCI data structure and the image's length; the image type field stores the image type, indicating the image's code type; and the certificate type field stores the certificate type for the image's data signature, indicating the encryption algorithm used to calculate the signature data. For example... Figure 4 The image N in the image is the image of the firmware. The PCIe device configures the pointer of the PCI data structure corresponding to the image N in the extended ROM header corresponding to the image N. For the PCI data structure corresponding to the image N, the PCIe device stores the length of the PCI data structure and the length of the firmware in the length field, stores the code type of the firmware code in the image type field, and stores the type of the first encryption algorithm in the certificate type field.
[0066] Once the driver is acquired, the PCIe device stores it as another ROM image in the extended ROM and configures the extended ROM header and PCI data structure corresponding to the driver image. For example... Figure 4Image 0 in the image is the image of the driver. The PCIe device configures the pointer of the PCI data structure corresponding to image 0 in the extended ROM header corresponding to image 0. For the pointer of the PCI data structure corresponding to image 0, the PCIe device length field stores the length of the PCI data structure and the length of the driver, the image type field stores the code type of the driver code, and the certificate type field stores the type of the second encryption algorithm.
[0067] It should be noted that the firmware image stored in the extended ROM can be located after the driver image. For example, the firmware image may be the image following the driver image, or it may be the last image stored in the extended ROM. After the PCIe device has stored all the images in the extended ROM, it stores the starting address of the extended ROM in the extended ROM base address field within the PCIe device's base address registers (BAR) space. This allows the computer's BIOS to read the starting address of the extended ROM from the extended ROM base address field.
[0068] 302. The BIOS reads the PCIe device driver from the PCIe device.
[0069] When the computer device is powered on or reset, the BIOS starts running. The BIOS enumerates each PCIe device installed on the computer device. When the BIOS enumerates a PCIe device, it reads the driver of the PCIe device from the PCIe device.
[0070] The BIOS can read the driver image from the extended read-only memory (ROM) of the PCIe device, thereby enabling it to read the driver for the PCIe device. In one possible implementation, the BIOS accesses the extended ROM base address field in the BAR space of the PCIe device through the target communication interface. The BIOS reads the start address of the extended ROM from the extended ROM base address field and accesses the extended ROM based on the start address. For any image stored in the extended ROM, the BIOS can read the image type from the image type field of the corresponding PCI data structure. If the read image type is the code type of the driver code, then the image is the driver image. When the image is the driver image, the BIOS can also read the certificate type of the target signature data from the certificate type field of the corresponding PCI data structure. Based on the second encryption algorithm indicated by the certificate type, the BIOS determines the inverse algorithm of the second encryption algorithm as the second decryption algorithm, and the BIOS can also read the driver image of the PCIe device from the extended ROM. If the image type read is not the driver code type, the BIOS reads the image type of the next image following that image, until the driver image is obtained. (Continuing with...) Figure 4 Based on this, the BIOS reads image 0 (i.e., the driver) from the extended ROM.
[0071] 303. The BIOS verifies the driver it reads.
[0072] The BIOS verifies the driver based on the public key of the stored PCIe device.
[0073] In one possible implementation, the BIOS obtains the target signature data of the driver code from the second target location of the driver code, and decrypts the target signature data based on the public key of the PCIe device and the second decryption algorithm to obtain second decrypted data. The BIOS calculates the second digest data of the driver code based on the second digest calculation algorithm. If the obtained second digest data is the same as the second decrypted data, it indicates that the driver code in the driver has not been tampered with and the driver code is complete, and the driver passes the verification. If the obtained second digest data is different from the first decrypted data, it indicates that the driver code has been tampered with and the driver code is incomplete, and the driver fails the verification.
[0074] 304. If the driver passes verification, the BIOS reads the firmware of the PCIe device from the PCIe device.
[0075] The BIOS can read the firmware image from the extended read-only memory (ROM) of the PCIe device, thereby enabling it to read the firmware from the PCIe device. In one possible implementation, the BIOS accesses the extended ROM via a target communication interface based on the starting address of the extended ROM. For any image stored in the extended ROM, the BIOS can read the image type of that image from the image type field of the corresponding PCI data structure. If the read image type is the code type of the firmware code, then that image is the firmware image. When that image is the firmware image, the BIOS can also read the certificate type of the firmware code's signature data from the certificate type field of the corresponding PCI data structure (that is, the process by which the BIOS reads the image type of the firmware image and the certificate type of the signature data from the extended ROM). Thus, the BIOS can also determine the inverse algorithm of the first encryption algorithm as the first decryption algorithm based on the first encryption algorithm indicated by the certificate type, and the BIOS reads the firmware image from the extended ROM. If the image type read is not the firmware code type, the BIOS reads the image type of the next image following that image, until it obtains the firmware image. At this point, the firmware image read by the BIOS includes the firmware code and its signature data. Figure 4 Based on this, the BIOS reads image N (i.e., firmware) from the extended ROM.
[0076] In one possible implementation, if the driver fails verification, it may pose a security risk to the computer device. In this case, the BIOS will jump to step 307, meaning that the BIOS will not start the PCIe device.
[0077] 305. The BIOS verifies the firmware it reads.
[0078] The BIOS verifies the firmware based on the public key of the stored PCIe device.
[0079] In one possible implementation, the BIOS obtains the signature data of the firmware code from a first target location within the firmware code, and decrypts the signature data based on the public key of the PCIe device and the first decryption algorithm to obtain first decrypted data. The BIOS then calculates the firmware code based on a first digest calculation algorithm to obtain first digest data of the firmware code. If the obtained first digest data is the same as the first decrypted data, it indicates that the firmware code has not been tampered with and is complete, and the firmware passes verification. If the obtained first digest data is different from the first decrypted data, it indicates that the firmware code has been tampered with and is incomplete, and the firmware fails verification.
[0080] 306. If the firmware passes verification, the BIOS will boot the PCIe device.
[0081] If the firmware passes verification, it will not pose a security risk to the computer device, and the BIOS will then boot the PCIe device.
[0082] In one possible implementation, the BIOS boots the PCIe device by configuring it, for example, allocating PCI resources to make the device visible to the operating system (OS) within the computer. These PCI resources include bus device functions (BDFs) and memory space.
[0083] It should be noted that the PCIe device is already powered on before the BIOS starts it. Therefore, the PCIe device can interact with the BIOS. Thus, starting the PCIe device in this embodiment does not refer to powering on the PCIe device and / or allowing the PCIe device to interact with the processing chip, but rather to configuring the PCIe device normally so that the properly configured PCIe device can function fully normally.
[0084] 307. If the firmware fails verification, the BIOS will not boot the PCIe device.
[0085] If the firmware fails verification, the BIOS will not boot the PCIe device because the firmware may pose a security risk to the computer device after it is started.
[0086] This BIOS can prevent a PCIe device from booting by disabling it, thus making the operating system within the computer invisible to the disabled PCIe device. In one possible implementation, the BIOS disables the PCIe device by either controlling it to a reset or power-down state, or by marking it as disabled to boot, indicating that the device should not be started, thereby completely blocking the potentially dangerous PCIe device. Optionally, the BIOS controls the hardware circuitry in the computer to output a PCIe reset signal to reset the PCIe device. Optionally, when the computer supports hot-swapping of PCIe devices, the power supply circuit of the PCIe device is controlled by the target controller. The BIOS then sends a power-down command to the target controller to disable the PCIe device. Upon receiving the power-down command, the target controller controls the power supply circuit of the PCIe device to power it down. Optionally, the BIOS can associate and store the target identifier of the PCIe device with the status identifier of the disabled boot state, so as to mark the PCIe device as disabled boot.
[0087] To further illustrate the process shown in steps 302-307, see [link to documentation]. Figure 5 The diagram shown is a schematic representation of the startup process of a PCIe device according to an embodiment of this application. Figure 5 In the process, the signature data of the firmware code is signature data 1, and the target signature data of the driver code is signature data 2. The BIOS reads the driver, which includes the driver code and signature data 2, from the PCIe device. Based on the public key of the PCIe device stored in the BIOS and signature data 2 in the driver, the BIOS verifies whether the driver code is complete. If the driver code is complete, the BIOS continues to read the firmware, which includes the firmware code and signature data 1, from the PCIe device. Based on the public key of the PCIe device stored in the BIOS and signature data 1 in the firmware, the BIOS verifies whether the firmware code is complete. If the firmware code is complete, the PCIe device is started; otherwise, the PCIe device is not started.
[0088] The method provided in this application verifies the firmware of a PCIe device through the BIOS to determine whether the firmware has been tampered with. The BIOS can only boot PCIe devices with verified firmware, thus preventing the computer from booting PCIe devices with tampered firmware and reducing the security risks posed by PCIe devices to the computer. Furthermore, in addition to verifying the PCIe device, the BIOS also verifies the PCIe device's driver. If either the firmware or the driver fails verification, the BIOS will not boot the PCIe device, further preventing the computer from booting PCIe devices with tampered firmware or drivers, thereby reducing the security risks posed by PCIe devices to the computer. Moreover, by controlling the PCIe device with unverified firmware to be in a reset or power-down state, or by marking the PCIe device with unverified firmware as a disabled boot state, the BIOS can completely shield PCIe devices with security risks.
[0089] To further explain the process of the BIOS obtaining the firmware of the PCIe device via Method 2, verifying the obtained firmware, and determining whether to boot the PCIe device based on the verification result, please refer to [reference needed]. Figure 6 The illustration shows another PCIe device boot method flowchart provided in an embodiment of this application. It is applied to computer devices including PCIe devices.
[0090] 601. PCIe devices store the firmware and drivers for PCIe devices.
[0091] exist Figure 6 In the illustrated embodiment, the firmware is actually firmware code, and the driver includes driver code, target signature data of the driver code, and signature data of the firmware code. For example, Figure 7 The firmware shown in the schematic diagram of another PCIE device startup provided in this application embodiment is firmware code, the target signature data included in the driver is signature data 2, and the signature data of the firmware code is signature data 1.
[0092] In one possible implementation, the PCIe device obtains the firmware and driver of the PCIe device, and stores the obtained firmware and driver as ROM images in the extended ROM of the PCIe device.
[0093] Optionally, the process by which the PCIe device obtains the firmware and driver of the PCIe device is as follows: the PCIe device obtains the firmware code and driver code, obtains the signature data of the firmware code and the target signature data of the driver code, stores the signature data of the firmware code in the third target location of the driver code, stores the target signature data in the second target location of the driver code, and obtains the driver; wherein, the third target location is the location in the driver code negotiated by the PCIe device and the BIOS for storing the signature data of the firmware code. Optionally, the third target location can be any location in the driver code other than the second target location. This application embodiment does not specifically limit the third target location.
[0094] It should be noted that the process of the PCIe device obtaining the signature data of the firmware code and the target signature data of the driver code is described in step 301. Therefore, this embodiment of the application will not elaborate on the process of the PCIe device obtaining the signature data of the firmware code and the target signature data of the driver code. The process of the PCIe device storing the obtained firmware and driver as ROM images in the extended ROM of the PCIe device is also described in step 301. Therefore, this embodiment of the application will not elaborate on the process of the PCIe device storing the obtained firmware and driver as ROM images in the extended ROM of the PCIe device.
[0095] It should be noted that, since the firmware at this time only includes firmware code, and the signature data of the firmware code is stored in the driver, the certificate type of the signature data of the firmware code can be stored in the certificate type field of the PCI data structure corresponding to the firmware image or the certificate type field of the PCI data structure corresponding to the driver image.
[0096] 602. The BIOS reads the PCIe device driver from the PCIe device, the driver including the signature data.
[0097] The process shown in step 602 is the same as that shown in step 302. Therefore, the process shown in step 602 will not be described again in this embodiment of the application.
[0098] 603. The BIOS verifies the driver it reads.
[0099] The process shown in step 603 is the same as that shown in step 303. Therefore, the process shown in step 603 will not be described again in this embodiment of the application.
[0100] Still with Figure 7Based on this, the BIOS decrypts the signature data 2 using the public key of the PCIe device and the second decryption algorithm to obtain the second decrypted data; the BIOS then calculates the second digest data of the driver code using the second digest calculation algorithm; if the obtained second digest data is the same as the second decrypted data, the driver passes verification; otherwise, the driver fails verification.
[0101] 604. If the driver passes verification, the BIOS obtains the signature data from the driver it reads.
[0102] The BIOS can obtain the signature data of the firmware code from the driver image. In one possible implementation, the BIOS obtains the signature data from a third target location of the driver code in the driver image.
[0103] It should be noted that the process shown in steps 602 and 604 is also the process by which the BIOS obtains the signature data of the firmware code from the driver of the PCIe device.
[0104] 605. The BIOS reads the firmware code from the PCIe device.
[0105] The BIOS can read the image of the firmware code from the extended ROM of the PCIe device to read the firmware code from the PCIe device. The process of the BIOS reading the image of the firmware code from the extended ROM of the PCIe device is the same as the process of the BIOS reading the image of the firmware of the PCIe device in step 304. Therefore, this embodiment of the application will not elaborate on the process of the BIOS reading the image of the firmware code from the extended ROM of the PCIe device.
[0106] Once the BIOS reads the firmware code, it identifies the signature data and the firmware code as the firmware. It should be noted that the processes shown in steps 602, 604, and 605 above are also the process by which the computer device's input / output system BIOS obtains the firmware of the PCIe device.
[0107] 606. The BIOS verifies the firmware code based on this signature data.
[0108] The BIOS decrypts the signature data based on the public key of the PCIe device and the first decryption algorithm to obtain first decrypted data. The BIOS then calculates the firmware code based on the first digest calculation algorithm to obtain first digest data of the firmware code. If the obtained first digest data is the same as the first decrypted data, it indicates that the firmware code has not been tampered with and is complete, and the firmware passes verification. If the obtained first digest data is different from the first decrypted data, it indicates that the firmware code has been tampered with and is incomplete, and the firmware fails verification.
[0109] Still with Figure 7 Based on this, the BIOS decrypts the signature data 1 using the public key of the PCIe device and the first decryption algorithm to obtain the first decrypted data; the BIOS calculates the firmware code using the first digest calculation algorithm to obtain the first digest data of the firmware code; if the obtained first digest data is the same as the first decrypted data, the firmware code passes the verification; otherwise, the firmware code fails the verification.
[0110] 607. If the firmware code passes verification, the BIOS will boot the PCIe device.
[0111] The process shown in step 607 is the same as that shown in step 306. Therefore, the process shown in step 607 will not be described again in this embodiment of the application.
[0112] 608. If the firmware code fails verification, the BIOS will not boot the PCIe device.
[0113] The process shown in step 608 is the same as that shown in step 307. Therefore, the process shown in step 608 will not be described again in this embodiment of the application.
[0114] The method provided in this application verifies the firmware of a PCIe device through the BIOS to determine whether the firmware has been tampered with. The BIOS can only boot PCIe devices with verified firmware, thus preventing the computer from booting PCIe devices with tampered firmware and reducing the security risks posed by PCIe devices to the computer. Furthermore, in addition to verifying the PCIe device, the BIOS also verifies the PCIe device's driver. If either the firmware or the driver fails verification, the BIOS will not boot the PCIe device, further preventing the computer from booting PCIe devices with tampered firmware or drivers, thereby reducing the security risks posed by PCIe devices to the computer. Moreover, by controlling the PCIe device with unverified firmware to be in a reset or power-down state, or by marking the PCIe device with unverified firmware as a disabled boot state, the BIOS can completely shield PCIe devices with security risks.
[0115] To further explain Figure 3 as well as Figure 6 For the process shown, see [link / reference]. Figure 8 The flowchart shown is a PCIe device boot method provided in this application embodiment. When the computer device is powered on or reset, the firmware of the computer device's BIOS runs. The BIOS enumerates each PCIe device in the computer device. Upon encountering any PCIe device, the BIOS verifies the driver for that PCIe device and runs the verified driver. The BIOS loads the firmware of the PCIe device. The BIOS verifies the loaded firmware. If the verification is successful, the BIOS configures the PCIe device normally so that the PCIe device is visible to the computer device's OS; otherwise, the BIOS blocks the PCIe device. Once the BIOS has loaded all verified PCIe devices in the computer device, the BIOS loads the OS.
[0116] It should be noted that the term "tampering" in this application includes various situations such as malicious tampering, unintentional modification, incomplete firmware, corrupted firmware, increase / decrease in firmware code size, or modification of firmware code content. When the first digest data calculated by the BIOS based on the obtained firmware code differs from the first decryption data calculated by the BIOS based on the obtained signature data, it indicates that the firmware obtained by the BIOS has been tampered with.
[0117] Figure 9 This is a schematic diagram of a PCIe device booting device provided in an embodiment of this application. The device 900 includes a PCIe device 901, and the device 900 includes:
[0118] The acquisition module 902 is used to input / output the firmware of the PCIe device obtained by the system BIOS;
[0119] Verification module 903 is used by the BIOS to verify the firmware;
[0120] The control module 904 is used to enable the BIOS to boot the PCIe device if the firmware passes verification.
[0121] Optionally, the control module 904 is further configured to:
[0122] If the firmware fails verification, the BIOS will not boot the PCIe device.
[0123] Optionally, the control module 904 is further configured to:
[0124] The BIOS controls the PCIe device to be in a reset state or a power-off state.
[0125] Alternatively, the BIOS may mark the PCIe device as disabled to start, the disabled state indicating that the PCIe device should not be started.
[0126] Optionally, the acquisition module 902 is used for:
[0127] The BIOS reads an image of the firmware from the extended read-only memory ROM of the PCIe device.
[0128] Optionally, the firmware includes signature data, and the acquisition module is further configured to:
[0129] The BIOS reads the image type of the image and the certificate type of the signature data from the read-only ROM. The image type is used to indicate the code type of the image, and the certificate type is used to indicate the encryption algorithm used when calculating the signature data.
[0130] Optionally, the firmware includes firmware code and signature data of the firmware code; the acquisition module includes:
[0131] The acquisition unit is used by the BIOS to acquire the signature data of the firmware code from the driver of the PCIe device;
[0132] A reading unit is used by the BIOS to read the firmware code from the PCIe device.
[0133] Optionally, the reading unit is used for:
[0134] The BIOS reads an image of the firmware code from the extended ROM of the PCIe device.
[0135] Optionally, the reading unit is further configured to:
[0136] The BIOS reads the image type of the image and the certificate type of the signature data from the extended ROM. The image type indicates the code type of the image, and the certificate type indicates the encryption algorithm used when calculating the signature data.
[0137] Optionally, the acquisition unit is used for:
[0138] The BIOS reads the image of the driver from the extended ROM of the PCIe device;
[0139] The BIOS obtains the signature data of the firmware code from the driver image.
[0140] Optionally, the verification module 903 is further configured to:
[0141] The BIOS verifies the driver;
[0142] If the driver passes verification, the BIOS performs the step of reading the firmware code from the PCIe device.
[0143] Optionally, the BIOS stores the public key of the PCIe device, which is used to verify the firmware.
[0144] Optionally, the device 900 further includes:
[0145] The modification module is used by the BIOS to modify the public key of the stored PCIe device based on the public key modification command.
[0146] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.
[0147] It should be noted that the PCIe device booting device provided in the above embodiments is only illustrated by the division of the above functional modules when booting a PCIe device. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the PCIe device booting method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0148] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described PCIE device startup method.
[0149] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0150] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for booting a PCIe device with fast peripheral component interconnection, characterized in that, Applied to a computer device including a PCIe device, the method includes: The computer device's input / output system BIOS obtains the firmware of the PCIe device; The BIOS verifies the firmware; If the firmware passes verification, the BIOS boots the PCIe device; The firmware includes firmware code and signature data of the firmware code; The computer device's input / output system BIOS obtains the firmware of the PCIe device by: The BIOS obtains the signature data of the firmware code from the driver of the PCIe device; the BIOS reads the firmware code from the PCIe device.
2. The method according to claim 1, characterized in that, The method further includes: If the firmware fails verification, the BIOS will not boot the PCIe device.
3. The method according to claim 2, characterized in that, The BIOS not booting the PCIe device includes: The BIOS controls the PCIe device to be in a reset state or a power-off state. or, The BIOS marks the PCIe device as disabled to start, which indicates that the PCIe device should not be started.
4. The method according to any one of claims 1-3, characterized in that, The computer device's input / output system BIOS obtains the firmware of the PCIe device by: The BIOS reads an image of the firmware from the extended read-only memory ROM of the PCIe device.
5. The method according to claim 4, characterized in that, The firmware includes signature data, and the method further includes, before the BIOS reads an image of the firmware from the extended read-only memory ROM of the PCIe device: The BIOS reads the image type of the image and the certificate type of the signature data from the read-only ROM. The image type is used to indicate the code type of the image, and the certificate type is used to indicate the encryption algorithm used when calculating the signature data.
6. The method according to claim 1, characterized in that, The BIOS reads the firmware code from the PCIe device, including: The BIOS reads an image of the firmware code from the extended ROM of the PCIe device.
7. The method according to claim 6, characterized in that, Before the BIOS reads the image of the firmware code from the extended ROM of the PCIe device, the method further includes: The BIOS reads the image type of the image and the certificate type of the signature data from the extended ROM. The image type indicates the code type of the image, and the certificate type indicates the encryption algorithm used when calculating the signature data.
8. The method according to claim 1, characterized in that, The BIOS obtains the firmware code signature data from the PCIe device driver, including: The BIOS reads the image of the driver from the extended ROM of the PCIe device; The BIOS obtains the signature data of the firmware code from the driver image.
9. The method according to claim 1, characterized in that, The method further includes: The BIOS verifies the driver; If the driver passes verification, the BIOS performs the step of reading the firmware code from the PCIe device.
10. The method according to any one of claims 1-9, characterized in that, The BIOS stores the public key of the PCIe device, which is used to verify the firmware.
11. The method according to claim 10, characterized in that, The method further includes: The BIOS modifies the public key of the stored PCIe device based on public key modification instructions.
12. A fast peripheral component interconnection PCIe device startup device, characterized in that, The device includes a PCIe device, the device comprising: The acquisition module is used to input and output the firmware of the PCIe device obtained by the system BIOS; A verification module is used by the BIOS to verify the firmware; The control module is configured to, if the firmware passes verification, enable the BIOS to boot the PCIe device; The firmware includes firmware code and signature data of the firmware code; The acquisition module includes: The acquisition unit is used for the BIOS to acquire the signature data of the firmware code from the driver of the PCIe device; the reading unit is used for the BIOS to read the firmware code from the PCIe device.
13. The apparatus according to claim 12, characterized in that, The control module is also used for: If the firmware fails verification, the BIOS will not boot the PCIe device.
14. The apparatus according to claim 13, characterized in that, The control module is also used for: The BIOS controls the PCIe device to be in a reset state or a power-off state. or, The BIOS marks the PCIe device as disabled to start, which indicates that the PCIe device should not be started.
15. The apparatus according to any one of claims 12-14, characterized in that, The acquisition module is used for: The BIOS reads an image of the firmware from the extended read-only memory ROM of the PCIe device.
16. The apparatus according to claim 15, characterized in that, The firmware includes signature data, and the acquisition module is further configured to: The BIOS reads the image type of the image and the certificate type of the signature data from the read-only ROM. The image type is used to indicate the code type of the image, and the certificate type is used to indicate the encryption algorithm used when calculating the signature data.
17. The apparatus according to claim 12, characterized in that, The reading unit is used for: The BIOS reads an image of the firmware code from the extended ROM of the PCIe device.
18. The apparatus according to claim 17, characterized in that, The reading unit is also used for: The BIOS reads the image type of the image and the certificate type of the signature data from the extended ROM. The image type indicates the code type of the image, and the certificate type indicates the encryption algorithm used when calculating the signature data.
19. The apparatus according to claim 12, characterized in that, The acquisition unit is used for: The BIOS reads the image of the driver from the extended ROM of the PCIe device; The BIOS obtains the signature data of the firmware code from the driver image.
20. The apparatus according to claim 12, characterized in that, The verification module is also used for: The BIOS verifies the driver; If the driver passes verification, the BIOS performs the step of reading the firmware code from the PCIe device.
21. The apparatus according to any one of claims 12-20, characterized in that, The BIOS stores the public key of the PCIe device, which is used to verify the firmware.
22. The apparatus according to claim 21, characterized in that, The device further includes: The modification module is used by the BIOS to modify the public key of the stored PCIe device based on the public key modification command.
23. A computer-readable storage medium, characterized in that, The storage medium stores at least one piece of program code, which is loaded and executed by a processor to perform the operations performed by the PCIe device startup method as described in any one of claims 1 to 11.
24. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one line of program code, the program code being loaded and executed by the processor to perform the operations performed by the PCIe device startup method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Establishing method and system of trust chain
CN107451479A
Extend root of trust to include firmware of individual components of a device
US20200097658A1