Firmware upgrade method, computer program product, electronic device and medium

By generating and verifying the specified upgrade file with digital signature, decoupling the upgrade process of the substrate management controller and system firmware, the problems of unstable firmware upgrade and maintenance difficulties in the existing technology are solved, and more stable firmware upgrades and ease of use are achieved Upgrade improvements to maintenance.

CN118689523BActive Publication Date: 2024-12-06INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411187210.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-06
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

The existing firmware upgrade method leads to serious coupling between the substrate management controller and the system firmware, resulting in unstable firmware upgrade process, affecting the upgrade of other firmware, and difficulty in later maintenance and improvement.

Method used

By generating a specified upgrade file with a digital signature, we can detect whether there is a system firmware upgrade thread in the substrate management controller. If it is not detected, security verification will be performed. The target system firmware will be upgraded based on the verification file to realize the substrate management controller Decoupling from the system firmware.

Benefits of technology

Improve the stability of firmware upgrades, simplify the code maintenance and upgrade improvement of later tools, and reduce the risk of firmware upgrade abnormalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689523B_ABST
    Figure CN118689523B_ABST
Patent Text Reader

Abstract

The present application provides a firmware upgrade method, computer program product, electronic device and medium, including detecting whether there is a system firmware upgrade thread in a baseboard management controller in response to detecting the presence of a designated upgrade file being passed in, and specifying the upgrade file as a file with a digital signature generated according to a preset rule; if the system firmware upgrade thread is not detected, performing security verification on the designated upgrade file according to the preset verification rule; obtaining the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrading the target system firmware according to the designated upgrade file. The decoupling of the baseboard management controller and the system firmware upgrade is achieved, the stability of the firmware upgrade is increased, and the code maintenance and upgrade improvement of the later tools are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a firmware upgrade method, a computer program product, an electronic device, and a medium. Background Art

[0002] BMC (Baseboard Management Controller) is a unique management controller for servers. It is independent of the business system and is used to monitor the overall operation of the server, that is, for remote management, monitoring, deployment, and restart of the server. In addition to monitoring the server, BMC also supports upgrading its own firmware and other firmware on the server.

[0003] The existing firmware upgrade method usually selects the type of system firmware from the web page, then transmits the system firmware value to the BMC, and triggers the upgrade process inside the BMC by clicking the upgrade button. Therefore, the entire firmware upgrade process is controlled by the BMC internal process and is seriously coupled with the BMC; when trying to upgrade a firmware, it will affect the upgrade of other firmware, causing many problems, and it is inconvenient to only maintain and follow up later.

[0004] Therefore, there is an urgent need for a firmware upgrade method that ensures the stability of firmware upgrade to solve the above technical problems. Summary of the invention

[0005] Based on this, it is necessary to provide a firmware upgrade method, computer program product, electronic device and medium to address the above technical problems.

[0006] In a first aspect, the present application provides a firmware upgrade method, the method comprising:

[0007] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0008] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0009] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0010] In some embodiments, the method includes generating a designated upgrade file with a digital signature according to the preset rule:

[0011] Package the firmware version file, upgrade script, and upgrade tool and compress them to generate a transition upgrade file;

[0012] The transition upgrade file is digitally signed to generate the designated upgrade file.

[0013] In some embodiments, the digitally signing the transition upgrade file to generate the designated upgrade file includes:

[0014] Generate a digital signature and a signature image structure of the transition upgrade file;

[0015] Adding the digital signature and the signature image structure to the transition upgrade file to generate the designated upgrade file;

[0016] The process of generating the digital signature of the transition upgrade file includes:

[0017] Generate a first summary of the transition upgrade file according to a hash function;

[0018] Encrypting the first summary according to a private key to generate a digital signature, wherein the digital signature is represented in a hash string form;

[0019] The generation process of the signature image structure includes:

[0020] Obtain data verification information, data description information, and image type, wherein the data verification information includes a first magic number, and the data description information includes an encryption algorithm type, a hash function type, and a hash string length;

[0021] Generate a signature image structure according to the acquired data verification information, data description information and image type.

[0022] In some embodiments, the method further comprises:

[0023] In response to detecting that there is a running upgrade tool and / or upgrade script in the baseboard management controller, determining that there is a system firmware upgrade thread in the baseboard management controller and setting a firmware upgrade variable value to 1;

[0024] In response to detecting that the firmware upgrade variable value is 1, the designated upgrade file is stored in a preset storage space.

[0025] In some embodiments, in response to detecting that the firmware upgrade variable value is 1, after storing the designated upgrade file in a preset storage space, the method includes:

[0026] Read the firmware upgrade variable value once every preset time period;

[0027] If the firmware upgrade variable value read is not 1 and the number of reads is within a preset threshold, a security verification of the specified upgrade file is triggered;

[0028] If the number of reads exceeds the preset threshold, the uploaded designated upgrade file is deleted.

[0029] In some embodiments, before performing security verification on the designated upgrade file according to a preset verification rule, the method further includes:

[0030] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller;

[0031] If the system firmware upgrade thread is not detected, reading the preset storage space;

[0032] If the preset storage space is empty, the currently incoming designated upgrade file is security verified according to the preset verification rules;

[0033] If the preset storage space is not empty, security verification is performed on the designated upgrade file stored in the storage space according to the preset verification rule.

[0034] In some embodiments, if the preset storage space is not empty, performing security verification on the designated upgrade file stored in the storage space according to the preset verification rule includes:

[0035] If there are multiple designated upgrade files in the preset storage space, determine the designated upgrade file with the earliest storage time among the multiple designated upgrade files as the target upgrade file, and perform security verification on the target upgrade file according to the preset verification rule;

[0036] If there is a designated upgrade file in the preset storage space, security verification is performed on the designated upgrade file stored in the preset storage space according to the preset verification rule.

[0037] In some embodiments, in response to detecting that a designated upgrade file is transmitted, after detecting whether a system firmware upgrade thread exists in the baseboard management controller, the method includes:

[0038] If it is detected that there is a system firmware upgrade thread in the baseboard management controller, then the designated upgrade file stored in the preset storage space is compared with the currently transmitted designated upgrade file;

[0039] If there is a stored designated upgrade file in the preset storage space that matches the currently transmitted designated upgrade file, deleting the currently transmitted designated upgrade file;

[0040] If there is no stored designated upgrade file matching the currently incoming designated upgrade file in the preset storage space, the currently incoming designated upgrade file is stored in the preset storage space.

[0041] In some embodiments, the obtaining the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrading the target system firmware according to the designated upgrade file, includes:

[0042] Obtain the image type in the signature image structure in the specified upgrade file;

[0043] Determining the target system firmware according to the acquired image type;

[0044] Decompress the specified upgrade file to obtain the firmware version file, upgrade script and upgrade tool;

[0045] The target system firmware is upgraded according to the acquired firmware version file, upgrade script and upgrade tool.

[0046] In some embodiments, the security verification includes a first verification, a second verification, and a third verification, and the security verification of the designated upgrade file according to a preset verification rule includes:

[0047] performing the first verification on the designated upgrade file to verify the type of the designated upgrade file;

[0048] If it is detected that the designated upgrade file passes the first verification, a second verification is performed on the designated upgrade file to verify the digital signature of the designated upgrade file; otherwise, the uploaded designated upgrade file is deleted;

[0049] If it is detected that the designated upgrade file passes the second verification, a third verification is performed on the designated upgrade file to verify the data consistency of the designated upgrade file; otherwise, the uploaded designated upgrade file is deleted;

[0050] In response to the designated upgrade file passing the third verification, it is determined that the designated upgrade file passes the security verification.

[0051] In some embodiments, performing the first verification on the designated upgrade file to verify the type of the designated upgrade file includes:

[0052] Obtaining a first magic number in a signature image structure in the uploaded specified upgrade file;

[0053] Obtaining a second magic number corresponding to the uploaded specified upgrade file;

[0054] The first magic number and the second magic number are compared. If the first magic number is the same as the second magic number, it is determined that the first verification is passed. Otherwise, it is determined that the type of the specified upgrade file is changed and the first verification is determined to be failed.

[0055] In some embodiments, the performing a second verification on the designated upgrade file to verify the digital signature of the designated upgrade file includes:

[0056] Obtain the encryption algorithm type and image type in the signature image structure in the uploaded specified upgrade file;

[0057] Reading a plurality of stored pending public keys matching the private key according to the image type;

[0058] Determine, according to the encryption algorithm type, a target public key among the pending public keys;

[0059] Verify the digital signature of the specified upgrade file according to the target public key;

[0060] If the digital signature verification succeeds, then it is determined that the second verification is passed;

[0061] If the digital signature verification fails, it is determined that the second verification has failed.

[0062] In some embodiments, performing a third verification on the designated upgrade file to verify data consistency of the designated upgrade file includes:

[0063] Obtaining the first digest contained in the designated upgrade file and the hash function type in the signature image structure;

[0064] Removing the digital signature and the signature image structure in the designated upgrade file to generate a file to be processed;

[0065] Generate a second digest of the file to be processed according to the hash function type;

[0066] The first digest and the second digest are compared. If the first digest is consistent with the second digest, it is determined that the third verification is passed. Otherwise, it is determined that the type of the designated upgrade file is changed and the third verification is determined to be failed.

[0067] In a second aspect, the present application provides a firmware upgrade system, the system comprising:

[0068] An environment detection module, configured to detect whether there is a system firmware upgrade thread in the baseboard management controller in response to detecting the presence of an incoming designated upgrade file, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0069] A security verification module, used to perform security verification on the designated upgrade file according to preset verification rules if the system firmware upgrade thread is not detected;

[0070] The firmware upgrade module is used to obtain the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrade the target system firmware according to the designated upgrade file.

[0071] In a third aspect, the present application provides a computer program, which, when executed by a processor, implements the steps of the following method:

[0072] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0073] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0074] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0075] In a fourth aspect, the present application provides an electronic device, the electronic device comprising:

[0076] one or more processors;

[0077] and a memory associated with one or more processors, the memory being used to store program instructions, which, when read and executed by the one or more processors, perform the following operations:

[0078] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0079] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0080] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0081] In a fifth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program enables a computer to perform the following operations:

[0082] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0083] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0084] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0085] The beneficial effects achieved by this application are:

[0086] The present application provides a firmware upgrade method, including detecting whether there is a system firmware upgrade thread in the baseboard management controller in response to detecting the presence of a designated upgrade file being passed in, the designated upgrade file being a file with a digital signature generated according to preset rules; if the system firmware upgrade thread is not detected, performing security verification on the designated upgrade file according to preset verification rules; obtaining the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrading the target system firmware according to the designated upgrade file. The decoupling of the baseboard management controller and the system firmware upgrade is achieved, the stability of the firmware upgrade is increased, and the code maintenance and upgrade improvement of the later tools are facilitated. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work, among which:

[0088] Figure 1 It is a connection relationship diagram provided in an embodiment of the present application;

[0089] Figure 2 It is a schematic diagram of a firmware upgrade method provided in an embodiment of the present application;

[0090] Figure 3 This is a schematic diagram of generating a designated upgrade file provided in an embodiment of the present application;

[0091] Figure 4 This is a flowchart of a firmware upgrade method provided by an embodiment of the present application;

[0092] Figure 5 It is a schematic diagram of a firmware upgrade system provided in an embodiment of the present application;

[0093] Figure 6 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0094] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0095] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like in the entire specification and claims should be interpreted as inclusive rather than exclusive or exhaustive; that is, the meaning of "including but not limited to".

[0096] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.

[0097] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.

[0098] As mentioned in the background technology, a server is a special computer that provides certain services to clients in a network environment. It is a high-performance computer system used to store, process and provide network services, while a BMC is a small embedded system. On the motherboard of the server, the BMC and the server are two independent systems. The BMC is used to monitor the overall operation of the server and is a management controller unique to the server. As a small operating system independent of the server system, the BMC is used for remote management, monitoring, deployment, restart and other operations of the server. The BMC starts running when the power is turned on, is not affected by the server power on and off, and is independent of the business system.

[0099] like Figure 1As shown in the connection diagram, BMC monitors many devices on the server, connects to flash through SPI (Serial Peripheral Interface), can also connect to DRAM (Dynamic Random Access Memory), connects to various I2C devices through I2C (Inter-Integrated Circuit) channels, monitors some pins through GPIO (General-purpose input / output), connects to PCH (Platform Controller Hub) through PCIE, USB, LPC (Low pin count Bus), PECI (Platform Environment Control Interface) and other channels to obtain some information on the system side, etc. In addition to monitoring the operating status of the system side, BMC also supports upgrading its own firmware and other firmware on the server, including BIOS (Basic Input / Output System), CPLD (Complex Programmable Logic Device), PSU (Power supply unit) and other system firmware. The traditional way to upgrade firmware is to select the type of system firmware from the BMC web page, then transfer the system firmware (BMC, BIOS, CPLD or PSU) to the BMC, click the upgrade button, and trigger the upgrade process inside the BMC. The entire upgrade process is controlled by the internal process of the BMC. There is a serious coupling inside the BMC. When debugging the upgrade process of one firmware, it will affect the upgrade of other firmware, causing many problems and inconvenient maintenance and improvement in the later stage. At the same time, you need to select the firmware type for each upgrade. Once the wrong selection is made, the BMC will not check the firmware type, which will cause firmware upgrade errors.

[0100] Therefore, the present application provides a system firmware upgrade method, which uses an independent upgrade script to upgrade the system firmware, decoupling to the greatest extent and reducing the risk of system firmware upgrade anomalies.

[0101] Embodiment 1

[0102] The present application embodiment provides a firmware upgrade method, which is specifically applied to a baseboard management controller, such as Figure 2 As shown, the method disclosed in the embodiment of the present application is used to upgrade the firmware on the baseboard management controller and other firmware on the server, including the following contents:

[0103] S1. In response to detecting that a designated upgrade file is transmitted, detecting whether a system firmware upgrade thread exists in a baseboard management controller.

[0104] This application decouples the firmware upgrade from the baseboard management controller to the greatest extent possible by creating a designated upgrade file that is independent of the baseboard management controller, thereby reducing the impact between the firmware. The designated upgrade file is a file with a digital signature generated according to a preset rule, such as Figure 3 As shown, the specific generation process includes: packaging the firmware version file, upgrade script and upgrade tool and compressing them to generate a transition upgrade file (such as update.tar.gz file); digitally signing the transition upgrade file to generate a specified upgrade file, which can be an update.bin file in a specific implementation scenario, and does not exclude files of other formats. This application greatly shortens the time to transfer files from the web page to the baseboard management controller through compression, and adds digital signatures, which increases the security of files during transmission, ensuring that the specified upgrade file obtained by the baseboard management controller is the original and correct data.

[0105] Further, the above-mentioned digital signing of the transition upgrade file to generate a designated upgrade file includes: generating a digital signature and a signature image structure of the transition upgrade file; adding the digital signature and the signature image structure to the transition upgrade file to generate the designated upgrade file; wherein, the generation process of the digital signature of the transition upgrade file includes: generating a first summary of the transition upgrade file according to a hash function; encrypting the first summary according to a private key to generate a digital signature, the digital signature is represented in the form of a hash string; wherein, the generation process of the signature image structure includes: obtaining data verification information, data description information and image type, the data verification information includes a first magic number, the data description information includes an encryption algorithm type, a hash function type and a hash string length; generating a signature image structure according to the obtained data verification information, data description information and image type. The present application adds a digital signature and a signature image structure to the end of the designated upgrade file, packages the image type in the signature image structure, and automatically identifies it after being transmitted to the baseboard management controller, without the need to select it on the web page, thereby reducing the risk of errors.

[0106] It is understandable that version information can also be added to the above data verification information; further, after receiving the above designated upgrade file, the baseboard control manager performs a priori operations, specifically, the above a priori operations include: obtaining the signature image management structure in the incoming designated upgrade file, and parsing the above signature image management structure to obtain the version information and image type of the upgraded firmware contained therein; searching for the current version information of the server system firmware or the baseboard management controller itself that matches the image type according to the image type; comparing the current version information with the version information contained in the designated upgrade file; if the current version information is the same as the version information contained in the designated upgrade file or the version number in the current version information is greater than the version number in the version information contained in the designated upgrade file, then deleting the uploaded designated upgrade file, and generating a prompt to prompt the user that the current firmware is already the latest version; if the version number in the current version information is less than the version number in the version information contained in the designated upgrade file, then determining that the above a priori operation has passed, and performing subsequent security verification and other operations. By setting a priori operations, it is determined that the current firmware can be upgraded through the specified upgrade file before specifying subsequent security verification and other operations, avoiding invalid uploading of the specified upgrade file and ensuring the rational use of resources to the greatest extent.

[0107] For ease of understanding, this application provides a structure signimage_info_t in a specific implementation scenario. It can be understood that the following structure is only for illustration and is not limited to this structure form:

[0108] typedef struct

[0109] {

[0110] uint32_t u32MagicNumber;

[0111] uint16_t u16Version;

[0112] uint32_t u32ImgType;

[0113] uint16_t u16SignAlgType;

[0114] uint16_t u16HashAlgType;

[0115] uint32_t u32HashLen;

[0116] } __attribute__((__packed__)) signimage_info_t;

[0117] In a specific implementation scenario, the above-mentioned detection of whether there is a system firmware upgrade thread in the baseboard management controller specifically also includes: in response to detecting the existence of a running upgrade tool and / or upgrade script in the baseboard management controller, determining that there is a system firmware upgrade thread in the baseboard management controller and setting the firmware upgrade variable value to 1; the specific detection means are conventional technical means in the field, and this application will not expand on this. In response to detecting that the firmware upgrade variable value is 1, the specified upgrade file is stored in a preset storage space. Among them, the preset storage space can be a space at a specific location divided in the baseboard management controller, or it can be a space at a specific location on a storage medium or device mounted on the baseboard management controller; this application does not limit this. It can be understood that in other implementation scenarios, after detecting that the firmware upgrade variable value is 1, the uploaded specified upgrade file can be directly deleted and the firmware upgrade process ends.

[0118] Furthermore, after the designated upgrade file is stored in the preset storage space, the firmware upgrade variable value is read once every preset time period; if the read firmware upgrade variable value is not 1 and the number of reads is within the preset threshold, a security verification of the designated upgrade file is triggered; if the number of reads exceeds the preset threshold, the uploaded designated upgrade file is deleted. The above-mentioned preset time period is set according to the time required for the firmware upgrade and the operating status of the baseboard management controller, or customized according to the actual scenario, and this application does not limit this. The above-mentioned preset threshold is set by a person skilled in the art according to the actual scenario, and this application does not limit this. When other firmware is being upgraded in the current baseboard management controller, the designated upgrade file uploaded at this time is temporarily stored in the baseboard management controller, and by polling the firmware upgrade variable, it is realized that after the current firmware upgrade stops, the matching system firmware is upgraded immediately using the uploaded designated firmware upgrade, thereby speeding up the firmware upgrade speed. Reduce the number of firmware uploads, thereby improving resource utilization.

[0119] S2. If the system firmware upgrade thread is not detected, a security verification is performed on the designated upgrade file according to a preset verification rule.

[0120] If no other firmware is being upgraded, the uploaded specified upgrade file can be security verified; the security verification includes the first verification, the second verification and the third verification, and only when all three verifications are passed can the security verification be passed. Among them, the location of the signature image structure can be found through the lseek function, and then the data verification information, data description information and image type contained in the signature image structure that can be used for security verification, that is, the first magic number, encryption algorithm type, hash function type and hash string length, etc. can be read. Similarly, the lseek function can be used to locate the location of the hash string, and then the complete hash string can be read based on the read hash string length.

[0121] Specifically, the security verification of the designated upgrade file according to the preset verification rules includes: performing a first verification on the designated upgrade file to verify the type of the designated upgrade file; if it is detected that the designated upgrade file passes the first verification, then performing a second verification on the designated upgrade file to verify the digital signature of the designated upgrade file, otherwise the uploaded designated upgrade file is deleted; if it is detected that the designated upgrade file passes the second verification, then performing a third verification on the designated upgrade file to verify the data consistency of the designated upgrade file, otherwise the uploaded designated upgrade file is deleted; in response to the designated upgrade file passing the third verification, it is determined that the designated upgrade file passes the security verification. By setting multiple verification logics, the speed of security verification and the accuracy of verification are greatly accelerated, and the security risk of the uploaded upgrade file is further reduced, thereby improving the stability of the firmware upgrade process.

[0122] Among them, the first verification is performed on the designated upgrade file to verify the type of the designated upgrade file, including: obtaining the first magic number in the signature image structure in the uploaded designated upgrade file; obtaining the second magic number corresponding to the uploaded designated upgrade file; comparing the first magic number and the second magic number, if the first magic number is the same as the second magic number, then it is determined that the first verification is passed, otherwise it is determined that the type of the designated upgrade file is changed and the first verification is determined to be failed. It can be understood that if the first magic number is different from the second magic number, it can be determined that the file type has been tampered with or disguised. At this time, the uploaded designated upgrade file must have been changed, and an alarm is generated to remind the user that the designated upgrade file has a security risk.

[0123] Among them, the above-mentioned second verification of the designated upgrade file to verify the digital signature of the designated upgrade file includes: obtaining the encryption algorithm type and the image type in the signature image structure in the uploaded designated upgrade file; reading multiple stored pending public keys that match the private key according to the image type; determining the target public key in the pending public key according to the encryption algorithm type; verifying the digital signature of the designated upgrade file according to the target public key; if the digital signature verification is successful, it is determined that the second verification has passed; if the digital signature verification fails, it is determined that the second verification has not passed, and the uploaded designated upgrade file is deleted. It can be understood that in order to be compatible with multiple encryption algorithms, this application pre-stores multiple public keys obtained by different encryption algorithms for a unified private key, and different images have different public keys. The public keys of all types of images are stored in an array, and the array elements are the file paths of the public keys.

[0124] Among them, the third verification of the designated upgrade file to verify the data consistency of the designated upgrade file includes: obtaining the first summary contained in the designated file and the hash function type in the signature image structure; removing the digital signature and signature image structure in the designated upgrade file to generate a file to be processed; generating a second summary of the file to be processed according to the hash function type; comparing the first summary and the second summary, if the first summary is consistent with the second summary, then determining that the third verification has passed, otherwise determining that the type of the designated upgrade file has changed and determining that the third verification has not passed and deleting the uploaded designated upgrade file. It can be understood that in order to facilitate the subsequent decompression, the digital signature and signature image structure of the incoming designated upgrade file can be removed, and then the designated upgrade file can be updated.

[0125] Furthermore, with respect to the above-mentioned implementation scenario in which the designated upgrade file is stored in the preset storage space when the firmware upgrade variable value is detected to be 1, the present application also proposes that before the designated upgrade file is security verified according to the preset rules, the following contents are also included: in response to detecting that there is a designated upgrade file incoming, detecting whether there is a system firmware upgrade thread in the baseboard management controller; if the system firmware upgrade thread is not detected, reading the preset storage space; if the preset storage space is empty, security verification is performed on the currently incoming designated upgrade file according to the preset verification rules; if the preset storage space is not empty, security verification is performed on the stored designated upgrade file in the storage space according to the preset verification rules.

[0126] Further, if the preset storage space is not empty, the designated upgrade files stored in the storage space are security verified according to the preset verification rules, including: if there are multiple designated upgrade files in the preset storage space, the designated upgrade file with the earliest storage time among the multiple designated upgrade files is determined as the target upgrade file, and the target upgrade file is security verified according to the preset verification rules; if there is a designated upgrade file in the preset storage space, the designated upgrade files stored in the preset storage space are security verified according to the preset verification rules. It can be understood that when the designated upgrade files are stored in the preset storage space, a storage time label can be added to each designated upgrade file at the same time to clarify the storage time of each designated upgrade file in the preset storage space, and further determine the target upgrade file with the earliest storage time; or the above-mentioned designated upgrade files are stored in the form of a queue, and the earliest stored target upgrade file is determined by the first-in-first-out feature of the queue. When receiving a new designated upgrade file, the baseboard management controller considers whether there is a designated upgrade file in the preset storage space. If a designated upgrade file already exists in the preset storage space, the upgrade file in the preset storage space is given priority. At the same time, when there are multiple designated upgrade files in the preset storage space, the designated upgrade file with the earliest storage time is preferably used. By defining the usage rules of the designated upgrade files in the preset storage space, an orderly firmware upgrade method is provided to avoid the confusion that may be caused by uploading multiple designated firmware upgrade files in a short period of time, and further improve the stability of the firmware upgrade.

[0127] Further, the above response to detecting the existence of the designated upgrade file being transmitted and detecting whether there is a system firmware upgrade thread in the baseboard management controller includes: if it is detected that there is a system firmware upgrade thread in the baseboard management controller, then comparing the designated upgrade file stored in the preset storage space with the currently transmitted designated upgrade file; if there is a stored designated upgrade file matching the currently transmitted designated upgrade file in the preset storage space, then deleting the currently transmitted designated upgrade file; if there is no stored designated upgrade file matching the currently transmitted designated upgrade file in the preset storage space, then storing the currently transmitted designated upgrade file in the preset storage space. The newly uploaded designated upgrade file may be the same as the designated upgrade file in the preset storage space. In this case, the newly uploaded designated upgrade file can be directly deleted, and the stored designated upgrade file matching the currently transmitted designated upgrade file can be upgraded according to the time sequence of the stored designated upgrade files in the preset storage space. This avoids repeated uploading of upgrade files of the same firmware and avoids waste of resources.

[0128] S3. Obtain the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrade the target system firmware according to the designated upgrade file.

[0129] It is understandable that the image type is added to the signature image structure in the specified upgrade file; the present application determines the target system firmware that matches the specified upgrade file by reading the image type in the signature image structure. For example, in one scenario, 0 can be set in the image type to represent BMC, 1 to represent BIOS, 2 to represent CPLD, 3 to represent PSU, and so on. The present application does not limit the setting rules of the values ​​and firmware in the specific image type, and can be set according to the needs. The above-mentioned system firmware types include but are not limited to CPLD, BIOS and PSU.

[0130] After the security check is passed, a shared memory can be mounted to store the decompressed designated upgrade file, or a certain space can be allocated from the baseboard management controller for storage for later use. This application does not limit the specific storage method. After the decompression is successful, the uploaded original designated upgrade file is deleted.

[0131] The above-mentioned acquisition of the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrading the target system firmware according to the designated upgrade file, includes: obtaining the image type in the signature image structure in the designated upgrade file; determining the target system firmware according to the acquired image type; decompressing the designated upgrade file to obtain the firmware version file, the upgrade script and the upgrade tool; and granting the execution permission of the decompressed firmware version file; then, upgrading the target system firmware according to the acquired firmware version file, the upgrade script and the upgrade tool; that is, the system call function system() can be called to implement the upgrade of the target system firmware. In the specific implementation scenario, if the image type is read to be equal to 0, it means upgrading the BMC, at this time, execute sh / mnt / fwupdate / BMC_Update.sh; if it is equal to 1, it means upgrading the BIOS, execute sh / mnt / fwupdate / BIOS_Update.sh.sh; if it is equal to 2, it means upgrading the CPLD, execute sh / mnt / fwupdate / CPLD_Update.sh; if it is equal to 3, it means upgrading the CPLD, execute sh / mnt / fwupdate / PSU_Update.sh. After the firmware upgrade is successful, an operation log can be recorded. It can be understood that the focus of this application is on the process of packaging the firmware upgrade file (i.e. generating a specified upgrade file) and transferring it to the BMC and parsing it. The process of using a specific upgrade tool to upgrade the firmware is not the focus of this application, and the contents of the upgrade script and upgrade tool are not described in detail.

[0132] like Figure 4As shown, the present application transfers the designated upgrade file into the baseboard management controller through the web page. After confirming that there is no other firmware being upgraded in the baseboard management controller, a security check is performed first. After the security check passes, the designated upgrade file is decompressed to extract the FW file, upgrade tool, and upgrade script. Finally, the system call function system() is used to perform the firmware upgrade using the upgrade script and upgrade tool.

[0133] This application constructs a designated upgrade file, compresses the firmware version text, upgrade tool and upgrade script, and adds a digital signature and a signature image structure to generate a designated upgrade file that is finally uploaded to the baseboard management controller. This extracts the system firmware upgrade process originally placed in the baseboard management controller to the outside of the baseboard management controller, thereby decoupling the baseboard management controller and system firmware upgrade, making it easier for subsequent tool code maintenance and upgrade improvements.

[0134] Embodiment 2

[0135] Corresponding to the above-mentioned embodiment 1, the present application also provides a firmware upgrade system according to an embodiment, such as Figure 5 As shown, specifically including:

[0136] An environment detection module 510 is used to detect whether there is a system firmware upgrade thread in the baseboard management controller in response to detecting that there is a designated upgrade file input, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0137] The security verification module 520 is used to perform security verification on the designated upgrade file according to preset verification rules if the system firmware upgrade thread is not detected;

[0138] The firmware upgrade module 530 is used to obtain the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrade the target system firmware according to the designated upgrade file.

[0139] Preferably, the system also includes a file synthesis module (not shown in the figure), which is used to generate a designated upgrade file with a digital signature according to the preset rules: packaging the firmware version file, upgrade script and upgrade tool and compressing them to generate a transition upgrade file; digitally signing the transition upgrade file to generate the designated upgrade file.

[0140] Preferably, the file synthesis module is also used to generate a digital signature and a signature image structure of the transition upgrade file; add the digital signature and the signature image structure to the transition upgrade file to generate the designated upgrade file; wherein the generation process of the digital signature of the transition upgrade file includes: generating a first summary of the transition upgrade file according to a hash function; encrypting the first summary according to a private key to generate a digital signature, and the digital signature is represented in the form of a hash string; wherein the generation process of the signature image structure includes: obtaining data verification information, data description information and an image type, the data verification information includes a first magic number, and the data description information includes an encryption algorithm type, a hash function type and a hash string length; generating a signature image structure according to the obtained data verification information, data description information and image type.

[0141] Preferably, the environment detection module 510 is also used to determine the existence of a system firmware upgrade thread in the baseboard management controller and set the firmware upgrade variable value to 1 in response to detecting the existence of a running upgrade tool and / or upgrade script in the baseboard management controller; in response to detecting that the firmware upgrade variable value is 1, store the specified upgrade file in a preset storage space.

[0142] Preferably, the environment detection module 510 is also used to read the firmware upgrade variable value once every preset time period; if the read firmware upgrade variable value is not 1 and the number of readings is within a preset threshold, it triggers security verification of the specified upgrade file; if the number of readings exceeds the preset threshold, the uploaded specified upgrade file is deleted.

[0143] Preferably, the environment detection module 510 is also used for: in response to detecting the presence of an incoming designated upgrade file, detecting whether there is a system firmware upgrade thread in the baseboard management controller; if no system firmware upgrade thread is detected, reading the preset storage space; if the preset storage space is empty, performing security verification on the currently incoming designated upgrade file according to the preset verification rules; if the preset storage space is not empty, performing security verification on the stored designated upgrade file in the storage space according to the preset verification rules.

[0144] Preferably, the environment detection module 510 is also used for: if there are multiple designated upgrade files in the preset storage space, determining the designated upgrade file with the earliest storage time among the multiple designated upgrade files as the target upgrade file, and performing security verification on the target upgrade file according to the preset verification rules; if there is a designated upgrade file in the preset storage space, performing security verification on the designated upgrade file stored in the preset storage space according to the preset verification rules.

[0145] Preferably, the environment detection module 510 is also used for: if it is detected that there is a system firmware upgrade thread in the baseboard management controller, then comparing the designated upgrade file stored in the preset storage space with the currently incoming designated upgrade file; if there is a stored designated upgrade file in the preset storage space that matches the currently incoming designated upgrade file, then deleting the currently incoming designated upgrade file; if there is no stored designated upgrade file in the preset storage space that matches the currently incoming designated upgrade file, then storing the currently incoming designated upgrade file in the preset storage space.

[0146] Preferably, the firmware upgrade module 530 is also used to obtain the image type in the signed image structure within the specified upgrade file; determine the target system firmware based on the obtained image type; decompress the specified upgrade file to obtain the firmware version file, upgrade script and upgrade tool; and upgrade the target system firmware based on the obtained firmware version file, upgrade script and upgrade tool.

[0147] Preferably, the security verification module 520 is also used to perform the first verification on the designated upgrade file to verify the type of the designated upgrade file; if it is detected that the designated upgrade file passes the first verification, the second verification is performed on the designated upgrade file to verify the digital signature of the designated upgrade file, otherwise the uploaded designated upgrade file is deleted; if it is detected that the designated upgrade file passes the second verification, the third verification is performed on the designated upgrade file to verify the data consistency of the designated upgrade file, otherwise the uploaded designated upgrade file is deleted; in response to the designated upgrade file passing the third verification, it is determined that the designated upgrade file passes the security verification.

[0148] Preferably, the security verification module 520 is also used to obtain the first magic number in the signature image structure within the uploaded specified upgrade file; obtain the second magic number corresponding to the uploaded specified upgrade file; compare the first magic number and the second magic number, if the first magic number is the same as the second magic number, determine that the first verification is passed, otherwise determine that the type of the specified upgrade file is changed and determine that the first verification has not passed.

[0149] Preferably, the security verification module 520 is also used to obtain the encryption algorithm type and the image type in the signature image structure in the uploaded specified upgrade file; read multiple stored pending public keys that match the private key according to the image type; determine the target public key in the pending public keys according to the encryption algorithm type; verify the digital signature of the specified upgrade file according to the target public key; if the digital signature verification is successful, determine that the second verification is passed; if the digital signature verification fails, determine that the second verification has failed.

[0150] Preferably, the security verification module 520 is also used to obtain the first summary contained in the designated upgrade file and the hash function type in the signature image structure; remove the digital signature and the signature image structure in the designated upgrade file to generate a file to be processed; generate a second summary of the file to be processed according to the hash function type; compare the first summary and the second summary, if the first summary is consistent with the second summary, determine that the third verification is passed, otherwise determine that the type of the designated upgrade file is changed and determine that the third verification has not passed.

[0151] Embodiment 3

[0152] Corresponding to the above-mentioned Embodiment 1 and Embodiment 2, the embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of the following method when executed by a processor:

[0153] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0154] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0155] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0156] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0157] Generate a specified upgrade file with a digital signature according to the preset rules:

[0158] Package the firmware version file, upgrade script, and upgrade tool and compress them to generate a transition upgrade file;

[0159] The transition upgrade file is digitally signed to generate the designated upgrade file.

[0160] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0161] Generate a digital signature and a signature image structure of the transition upgrade file;

[0162] Adding the digital signature and the signature image structure to the transition upgrade file to generate the designated upgrade file;

[0163] The process of generating the digital signature of the transition upgrade file includes:

[0164] Generate a first summary of the transition upgrade file according to a hash function;

[0165] Encrypting the first summary according to a private key to generate a digital signature, wherein the digital signature is represented in a hash string form;

[0166] The generation process of the signature image structure includes:

[0167] Obtain data verification information, data description information, and image type, wherein the data verification information includes a first magic number, and the data description information includes an encryption algorithm type, a hash function type, and a hash string length;

[0168] Generate a signature image structure according to the acquired data verification information, data description information and image type.

[0169] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0170] In response to detecting that there is a running upgrade tool and / or upgrade script in the baseboard management controller, determining that there is a system firmware upgrade thread in the baseboard management controller and setting a firmware upgrade variable value to 1;

[0171] In response to detecting that the firmware upgrade variable value is 1, the designated upgrade file is stored in a preset storage space.

[0172] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0173] Read the firmware upgrade variable value once every preset time period;

[0174] If the firmware upgrade variable value read is not 1 and the number of reads is within a preset threshold, a security verification of the specified upgrade file is triggered;

[0175] If the number of reads exceeds the preset threshold, the uploaded designated upgrade file is deleted.

[0176] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0177] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller;

[0178] If the system firmware upgrade thread is not detected, reading the preset storage space;

[0179] If the preset storage space is empty, the currently incoming designated upgrade file is security verified according to the preset verification rules;

[0180] If the preset storage space is not empty, security verification is performed on the designated upgrade file stored in the storage space according to the preset verification rule.

[0181] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0182] If there are multiple designated upgrade files in the preset storage space, determine the designated upgrade file with the earliest storage time among the multiple designated upgrade files as the target upgrade file, and perform security verification on the target upgrade file according to the preset verification rule;

[0183] If there is a designated upgrade file in the preset storage space, security verification is performed on the designated upgrade file stored in the preset storage space according to the preset verification rule.

[0184] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0185] If it is detected that there is a system firmware upgrade thread in the baseboard management controller, then the designated upgrade file stored in the preset storage space is compared with the currently transmitted designated upgrade file;

[0186] If there is a stored designated upgrade file in the preset storage space that matches the currently transmitted designated upgrade file, deleting the currently transmitted designated upgrade file;

[0187] If there is no stored designated upgrade file matching the currently incoming designated upgrade file in the preset storage space, the currently incoming designated upgrade file is stored in the preset storage space.

[0188] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0189] Obtain the image type in the signature image structure in the specified upgrade file;

[0190] Determining the target system firmware according to the acquired image type;

[0191] Decompress the specified upgrade file to obtain the firmware version file, upgrade script and upgrade tool;

[0192] The target system firmware is upgraded according to the acquired firmware version file, upgrade script and upgrade tool.

[0193] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0194] performing the first verification on the designated upgrade file to verify the type of the designated upgrade file;

[0195] If it is detected that the designated upgrade file passes the first verification, a second verification is performed on the designated upgrade file to verify the digital signature of the designated upgrade file; otherwise, the uploaded designated upgrade file is deleted;

[0196] If it is detected that the designated upgrade file passes the second verification, a third verification is performed on the designated upgrade file to verify the data consistency of the designated upgrade file; otherwise, the uploaded designated upgrade file is deleted;

[0197] In response to the designated upgrade file passing the third verification, it is determined that the designated upgrade file passes the security verification.

[0198] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0199] Obtaining a first magic number in a signature image structure in the uploaded specified upgrade file;

[0200] Obtaining a second magic number corresponding to the uploaded specified upgrade file;

[0201] The first magic number and the second magic number are compared. If the first magic number is the same as the second magic number, it is determined that the first verification is passed. Otherwise, it is determined that the type of the specified upgrade file is changed and the first verification is determined to be failed.

[0202] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0203] Obtain the encryption algorithm type and image type in the signature image structure in the uploaded specified upgrade file;

[0204] Reading a plurality of stored pending public keys matching the private key according to the image type;

[0205] Determine, according to the encryption algorithm type, a target public key among the pending public keys;

[0206] Verify the digital signature of the specified upgrade file according to the target public key;

[0207] If the digital signature verification succeeds, then it is determined that the second verification is passed;

[0208] If the digital signature verification fails, it is determined that the second verification has failed.

[0209] When the computer program is executed by a processor, the steps of the following method are also implemented:

[0210] Obtaining the first digest contained in the designated upgrade file and the hash function type in the signature image structure;

[0211] Removing the digital signature and the signature image structure in the designated upgrade file to generate a file to be processed;

[0212] Generate a second digest of the file to be processed according to the hash function type;

[0213] The first digest and the second digest are compared. If the first digest is consistent with the second digest, it is determined that the third verification is passed. Otherwise, it is determined that the type of the designated upgrade file is changed and the third verification is determined to be failed.

[0214] Embodiment 4

[0215] Corresponding to all the above embodiments, an embodiment of the present application provides an electronic device, including: one or more processors; and a memory associated with the one or more processors, the memory is used to store program instructions, and when the program instructions are read and executed by the one or more processors, the following operations are performed:

[0216] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0217] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0218] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0219] in, Figure 6 The architecture of the electronic device is shown exemplarily, and may include a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, and a memory 620. The processor 610, the video display adapter 611, the disk drive 612, the input / output interface 613, the network interface 614, and the memory 620 may be communicatively connected via a bus 630.

[0220] Among them, the processor 610 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solution provided in this application.

[0221] The memory 620 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 620 can store an operating system 621 for controlling the execution of the electronic device 600, and a basic input and output system (BIOS) 622 for controlling the low-level operations of the electronic device 600. In addition, a web browser 623, a data storage management system 624, and an icon font processing system 625, etc. can also be stored. The above-mentioned icon font processing system 625 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided in the present application is implemented by software or firmware, the relevant program code is stored in the memory 620 and is called and executed by the processor 610.

[0222] The input / output interface 613 is used to connect the input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0223] The network interface 614 is used to connect to a communication module (not shown) to achieve communication interaction between the device and other devices. The communication module can achieve communication through a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WIFI, Bluetooth, etc.).

[0224] The bus 630 comprises a pathway for transmitting information between the various components of the device (eg, the processor 610 , the video display adapter 611 , the disk drive 612 , the input / output interface 613 , the network interface 614 , and the memory 620 ).

[0225] In addition, the electronic device 600 can also obtain information on specific collection conditions from the virtual resource object collection condition information database for use in condition judgment, etc.

[0226] It should be noted that, although the above device only shows a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, a memory 620, a bus 630, etc., in the specific implementation process, the device may also include other components necessary for normal execution. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.

[0227] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a cloud service end, or a network device, etc.) to execute the methods of various embodiments of the present application or certain parts of the embodiments.

[0228] Embodiment 5

[0229] Corresponding to all the above embodiments, the embodiments of the present application further provide a computer-readable storage medium, characterized in that it stores a computer program, and the computer program enables a computer to perform the following operations:

[0230] In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule;

[0231] If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules;

[0232] The target system firmware contained in the designated upgrade file that has passed the security verification is obtained, and the target system firmware is upgraded according to the designated upgrade file.

[0233] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0234] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A firmware upgrade method, applied to a baseboard management controller, characterized in that: The method comprises: In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller, wherein the designated upgrade file is a file with a digital signature generated according to a preset rule; If the system firmware upgrade thread is not detected, the designated upgrade file is security verified according to the preset verification rules; Obtaining the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrading the target system firmware according to the designated upgrade file; The method comprises generating a designated upgrade file with a digital signature according to the preset rule: Package the firmware version file, upgrade script, and upgrade tool and compress them to generate a transition upgrade file; Digitally signing the transition upgrade file to generate the designated upgrade file; The step of digitally signing the transition upgrade file to generate the designated upgrade file includes: Generate a digital signature and a signature image structure of the transition upgrade file; Adding the digital signature and the signature image structure to the transition upgrade file to generate the designated upgrade file; The generation process of the signature image structure includes: Obtain data verification information, data description information, and image type, wherein the data verification information includes a first magic number, and the data description information includes an encryption algorithm type, a hash function type, and a hash string length; Generate a signature image structure according to the acquired data verification information, data description information and image type.

2. The method according to claim 1, characterized in that The process of generating the digital signature of the transition upgrade file includes: Generate a first summary of the transition upgrade file according to a hash function; The first summary is encrypted according to a private key to generate a digital signature, where the digital signature is represented in a hash character string form.

3. The method according to claim 1, characterized in that: The method further comprises: In response to detecting that there is a running upgrade tool and / or upgrade script in the baseboard management controller, determining that there is a system firmware upgrade thread in the baseboard management controller and setting a firmware upgrade variable value to 1; In response to detecting that the firmware upgrade variable value is 1, the designated upgrade file is stored in a preset storage space.

4. The method according to claim 3, characterized in that In response to detecting that the firmware upgrade variable value is 1, after storing the designated upgrade file in a preset storage space, the method includes: Read the firmware upgrade variable value once every preset time period; If the firmware upgrade variable value read is not 1 and the number of reads is within a preset threshold, a security verification of the specified upgrade file is triggered; If the number of reads exceeds the preset threshold, the uploaded designated upgrade file is deleted.

5. The method according to claim 3, characterized in that: Before performing security verification on the designated upgrade file according to the preset verification rules, the method further includes: In response to detecting that a designated upgrade file is input, detecting whether a system firmware upgrade thread exists in the baseboard management controller; If the system firmware upgrade thread is not detected, reading the preset storage space; If the preset storage space is empty, the currently incoming designated upgrade file is security verified according to the preset verification rules; If the preset storage space is not empty, security verification is performed on the designated upgrade file stored in the storage space according to the preset verification rule.

6. The method according to claim 5, characterized in that If the preset storage space is not empty, performing security verification on the designated upgrade file stored in the storage space according to the preset verification rule, including: If there are multiple designated upgrade files in the preset storage space, determine the designated upgrade file with the earliest storage time among the multiple designated upgrade files as the target upgrade file, and perform security verification on the target designated upgrade file according to the preset verification rule; If there is a designated upgrade file in the preset storage space, security verification is performed on the designated upgrade file stored in the preset storage space according to the preset verification rule.

7. The method according to claim 5, characterized in that In response to detecting that a designated upgrade file is input, after detecting whether a system firmware upgrade thread exists in the baseboard management controller, the method includes: If it is detected that there is a system firmware upgrade thread in the baseboard management controller, then the designated upgrade file stored in the preset storage space is compared with the currently transmitted designated upgrade file; If there is a stored designated upgrade file in the preset storage space that matches the currently transmitted designated upgrade file, deleting the currently transmitted designated upgrade file; If there is no stored designated upgrade file matching the currently incoming designated upgrade file in the preset storage space, the currently incoming designated upgrade file is stored in the preset storage space.

8. The method according to claim 2, characterized in that: The step of obtaining the target system firmware contained in the designated upgrade file that has passed the security verification, and upgrading the target system firmware according to the designated upgrade file, includes: Obtain the image type in the signature image structure in the specified upgrade file; Determining the target system firmware according to the acquired image type; Decompress the specified upgrade file to obtain the firmware version file, upgrade script and upgrade tool; The target system firmware is upgraded according to the acquired firmware version file, upgrade script and upgrade tool.

9. The method according to claim 2, characterized in that: The security verification includes a first verification, a second verification and a third verification. The security verification of the designated upgrade file according to the preset verification rules includes: performing the first verification on the designated upgrade file to verify the type of the designated upgrade file; If it is detected that the designated upgrade file passes the first verification, a second verification is performed on the designated upgrade file to verify the digital signature of the designated upgrade file; otherwise, the uploaded designated upgrade file is deleted; If it is detected that the designated upgrade file passes the second verification, a third verification is performed on the designated upgrade file to verify the data consistency of the designated upgrade file; otherwise, the uploaded designated upgrade file is deleted; In response to the designated upgrade file passing the third verification, it is determined that the designated upgrade file passes the security verification.

10. The method according to claim 9, characterized in that The performing the first verification on the designated upgrade file to verify the type of the designated upgrade file includes: Obtaining a first magic number in a signature image structure in the uploaded specified upgrade file; Obtaining a second magic number corresponding to the uploaded specified upgrade file; The first magic number and the second magic number are compared. If the first magic number is the same as the second magic number, it is determined that the first verification is passed. Otherwise, it is determined that the type of the specified upgrade file is changed and the first verification is determined to be failed.

11. The method according to claim 9, characterized in that The performing a second verification on the designated upgrade file to verify the digital signature of the designated upgrade file includes: Obtain the encryption algorithm type and image type in the signature image structure in the uploaded specified upgrade file; Reading a plurality of stored pending public keys matching the private key according to the image type; Determine, according to the encryption algorithm type, a target public key among the pending public keys; Verify the digital signature of the specified upgrade file according to the target public key; If the digital signature verification succeeds, then it is determined that the second verification is passed; If the digital signature verification fails, it is determined that the second verification has failed.

12. The method according to claim 9, characterized in that The performing a third verification on the designated upgrade file to verify the data consistency of the designated upgrade file includes: Obtaining the first digest contained in the specified file and the hash function type in the signature image structure; Removing the digital signature and the signature image structure in the designated upgrade file to generate a file to be processed; Generate a second digest of the file to be processed according to the hash function type; The first digest and the second digest are compared. If the first digest is consistent with the second digest, it is determined that the third verification is passed. Otherwise, it is determined that the type of the designated upgrade file is changed and the third verification is determined to be failed.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.

14. An electronic device, characterized in that: The electronic device comprises: one or more processors; And a memory associated with the one or more processors, the memory is used to store program instructions, and when the program instructions are read and executed by the one or more processors, the method according to any one of claims 1-12 is executed.

15. A computer-readable storage medium, characterized in that: The computer program stores a computer program, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 12.