Flashing method and related device
By receiving and verifying digital signature flashing forms, determining the version information of the flashing package and performing data verification, the security and adaptability problems during the flashing process of mobile terminals are solved, and higher flashing security and stability are achieved.
Patent Information
- Application Number
- CN201980100613.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-18
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2039-11-18
AI Technical Summary
In the prior art, there are security and adaptability problems during the flashing process of mobile terminals, which are easily used by criminals to flash the machine in fake systems, reducing the security and stability of the terminal.
By receiving the first form that is digitally signed, verify its digital signature information. If the verification is passed, the version information of the flash package is determined based on the table, and data verification is carried out to ensure the integrity and security of the flash package, and finally upgrade the firmware of the mobile terminal.
It improves the safety and adaptability of the flashing process, prevents flashing of fake systems, and ensures the stability and security of terminal equipment.
Smart Images

Figure CN114424163B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a flashing method and related devices. Background Art
[0002] With the advancement of electronic technology, there are more and more firmwares that are compatible with terminal devices. Due to the good compatibility and adaptability of mobile terminals at this stage, users can flash their devices flexibly and independently, but this also gives some lawless elements an opportunity to fake system firmware, reducing the security and stability of mobile terminals. Summary of the invention
[0003] The embodiments of the present application provide a flashing method and related devices, which are beneficial to improving the security and adaptability of flashing a terminal device.
[0004] In a first aspect, an embodiment of the present application provides a flashing method, which is applied to a terminal device, and the method includes:
[0005] Receiving a digitally signed first form sent by an electronic device, wherein the first form includes at least one message digest;
[0006] Verifying the digital signature information of the first form;
[0007] If the digital signature information of the first table passes the verification, determining the version information of the flash package according to the first table;
[0008] Determining whether the flash package is a firmware package of a preset version according to the version information;
[0009] If yes, then perform a data verification operation to fully verify the flash package;
[0010] The firmware of the mobile terminal is upgraded according to the verified flashing package.
[0011] In a second aspect, an embodiment of the present application provides a flashing method, which is applied to an electronic device, and the method includes:
[0012] Receive the flash request information sent by the terminal device;
[0013] Sending a response message to the terminal device, wherein the response message includes a request for obtaining device information of the terminal device;
[0014] Receiving first device information sent by the terminal device;
[0015] Sending the first device information and the second device information to the server, where the second device refers to the device information of the electronic device;
[0016] Receiving authorization information sent by the server;
[0017] Determining whether the terminal meets the flashing condition according to the authorization information;
[0018] If yes, a flash package is sent to the terminal device.
[0019] In a third aspect, an embodiment of the present application provides a flashing device, which is applied to a terminal device. The flashing device includes a processing unit and a communication unit, wherein:
[0020] The processing unit is used to receive a digitally signed first form sent by an electronic device through the communication unit, the first form including at least one message digest; and to verify the digital signature information of the first form; and to determine the version information of the flash package according to the first table if the digital signature information of the first table passes the verification; and to determine whether the flash package is a firmware package of a preset version according to the version information; and if so, to perform a data verification operation to fully verify the flash package; and to upgrade the firmware of the mobile terminal according to the verified flash package.
[0021] In a fourth aspect, an embodiment of the present application provides a flashing device, which is applied to an electronic device, and the flashing device includes a processing unit and a communication unit, wherein:
[0022] The processing unit is used to receive flashing request information sent by the terminal device through the communication unit; and to send response information to the terminal device through the communication unit, the response information including a request for obtaining device information of the terminal device; and to receive first device information sent by the terminal device through the communication unit; and to send the first device information and second device information to the server, the second device referring to the device information of the electronic device; and to receive authorization information sent by the server through the communication unit; and to determine whether the terminal meets the flashing conditions based on the authorization information; and if so, to send a flashing package to the terminal device through the communication unit.
[0023] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps in the first and second aspects of the embodiments of the present application.
[0024] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in the first and second aspects of the embodiments of the present application.
[0025] In a seventh aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first and second aspects of the embodiments of the present application. The computer program product may be a software installation package.
[0026] It can be seen that in the embodiment of the present application, the terminal device first receives the digitally signed first form sent by the electronic device, and the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; if the digital signature information of the first form passes the verification, the version information of the flash package is determined according to the first form; secondly, it is determined whether the flash package is a firmware package of a preset version according to the version information; if so, a data verification operation is performed to fully verify the flash package; the firmware of the mobile terminal is upgraded according to the verified flash package. It can be seen that the terminal device first verifies the digital signature of the form, which improves the security when flashing; when the digital signature passes the verification, the terminal device further determines the version information of the flash package, and when the version information is adapted, the flash package is completely flashed, avoiding the situation of incorrect firmware package acquisition and incorrect flash version. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The following is a brief introduction to the drawings required for use in the embodiments or prior art descriptions. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following is a brief introduction to the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 It is a schematic diagram of the system structure of a flashing method provided in an embodiment of the present application;
[0029] Figure 2A It is a flowchart of a flashing method provided in an embodiment of the present application;
[0030] Figure 2B is a schematic diagram of a message summary table provided in an embodiment of the present application;
[0031] Figure 3It is a flowchart of another flashing method provided in an embodiment of the present application;
[0032] Figure 4 It is a flowchart of another flashing method provided in an embodiment of the present application;
[0033] Figure 5 It is a structural diagram of a terminal device provided in an embodiment of the present application;
[0034] Figure 6 This is a block diagram of the functional units of a flashing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0037] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0038] The following is a detailed description of the embodiments of the present application.
[0039] See also Figure 1 , Figure 11 is a schematic diagram of the system structure of a flashing method provided by an embodiment of the present application, wherein a mobile terminal 101 is connected to an electronic device 102 for communication, and the electronic device 102 is connected to a server 103 for communication. When the mobile terminal 101 detects a flashing instruction, the mobile terminal 101 first sends a flashing request message to the electronic device 102; after the electronic device 102 receives the flashing request message, it sends a response message to the mobile terminal 101, wherein the response message includes a request for obtaining device information of the mobile terminal 101; after the mobile terminal 101 receives the response message, it sends the first device information of the mobile terminal 101 to the electronic device 102; after the electronic device 102 receives the first device information sent by the mobile terminal 101, it extracts the second device information of the local end, and sends both the first device information and the second device information to the server 103, the server 103 determines whether the mobile terminal 101 and the electronic device 102 have the authority to flash the machine according to the first device information and the second device information, and sends the authorization information to the electronic device 102 if it is determined that the mobile terminal has the authority to flash the machine according to the authorization information, and the electronic device 102 sends the flashing package to the mobile terminal 101 if it is determined that the mobile terminal has the authority to flash the machine according to the authorization information.
[0040] The terminal devices, electronic devices and servers involved in the embodiments of the present application may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem, as well as various forms of user equipment (UE), mobile stations (MS), terminal devices, etc. For the convenience of description, the above-mentioned devices are collectively referred to as electronic devices.
[0041] See also Figure 2A , Figure 2A : is a flowchart of a flashing method provided in an embodiment of the present application. The flashing method described in this embodiment is applied to a terminal device. The method may include the following steps:
[0042] Step 201: A terminal device receives a first digitally signed form sent by an electronic device.
[0043] Among them, the first table includes at least one message digest; it should be noted that the first table only includes the message digests corresponding to part or all of the flashing commands in the flashing package.
[0044] The message digest is generated by calculating the hash value based on the flash command in the flash package.
[0045] Step 202: The terminal device verifies the digital signature information of the first form.
[0046] Specifically, the terminal device has a built-in flash verification tool installed by the manufacturer when it leaves the factory. The built-in flash verification tool is signed by the manufacturer and cannot be changed. The digital signature information of the first form is also signed by the manufacturer. By verifying the digital signature information of the first form with the built-in flash verification tool, it can be determined whether the flash package corresponding to the first form is a genuine flash package.
[0047] Step 203: If the digital signature information of the first table passes the verification, the terminal device determines the version information of the flash package according to the first table.
[0048] Step 204: The terminal device determines whether the flash package is a preset version of firmware based on the version information.
[0049] Step 205: If yes, the terminal device performs a data verification operation to fully verify the flash package.
[0050] Step 206: The terminal device upgrades the firmware of the mobile terminal according to the verified flash package.
[0051] It can be seen that in the embodiment of the present application, the terminal device first receives the digitally signed first form sent by the electronic device, and the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; if the digital signature information of the first form passes the verification, the version information of the flash package is determined according to the first form; secondly, it is determined whether the flash package is a firmware package of a preset version according to the version information; if so, a data verification operation is performed to fully verify the flash package; the firmware of the mobile terminal is upgraded according to the verified flash package. It can be seen that the terminal device first verifies the digital signature of the form, which improves the security when flashing; when the digital signature passes the verification, the terminal device further determines the version information of the flash package, and when the version information is adapted, the flash package is completely flashed, avoiding the situation of incorrect firmware package acquisition and incorrect flash version.
[0052] In one possible example, the data verification operation includes the following steps: detecting whether the currently processed table is an unprocessed table; if so, determining the firmware data corresponding to the first type of message digest in the currently processed table; verifying the firmware data corresponding to the first type of message digest; and under the condition that the verification passes, detecting whether the currently processed table includes a second type of message digest, the second type of message digest including a preset hash value of a second table.
[0053] Among them, the first type of message digest is generated according to the flashing command; the specific method for verifying the firmware data corresponding to the first type of message digest includes: determining the actual hash value of the firmware data corresponding to the first type of message digest, obtaining the preset hash value in the currently processed table, and judging whether the preset hash value is the same as the actual hash value. If they are the same, it is determined that the firmware data has passed the verification, otherwise the firmware data has not passed the verification.
[0054] For example, the table currently being processed includes N first-type message digests, where N is a positive integer; each first-type message digest stores a hash value of a corresponding flash command, called a preset hash value; N first-type message digests correspond to N flash commands, and the mobile terminal determines the above N flash commands in the flash package, calculates the actual hash value of each of the N flash commands according to the preset calculation rules, and obtains N actual hash values. When the N actual hash values are the same as the N preset hash values, it is determined that the firmware data corresponding to the first-type message digest in the first table has passed the verification. Specifically, the preset calculation rule can be the SHA256 algorithm.
[0055] The second type of message digest is a preset hash value corresponding to the next table.
[0056] It can be seen that in this example, the terminal device can verify the firmware data in the current table, ensuring the integrity of the firmware data corresponding to the message digest in the current table.
[0057] In a possible example, after detecting whether the currently processed table includes the second type of message digest, the method further includes: if not, determining that the flashing package verification has passed.
[0058] In one possible example, after detecting whether the currently processed table includes a second type of message digest, the method further includes: if so, obtaining a second table and calculating an actual hash value of the second table; determining whether the actual hash value matches the preset hash value; and if so, updating the currently processed table to the second table.
[0059] After determining whether the actual hash value matches the preset hash value and before updating the currently processed table to the second table, the method further includes: updating the status of the currently processed table to a processed status.
[0060] Wherein, after determining whether the actual hash value matches the preset hash value, the method further includes: if not, terminating the data verification operation; and determining that the flashing package has not passed the verification.
[0061] For example, see Figure 2B , Figure 2BIt is a schematic diagram of a message digest table provided in an embodiment of the present application. As shown in the figure, all the message digests corresponding to the flash package constitute three tables. Among them, in Table 1, message digest 0 to message digest 52 are the message digests corresponding to the firmware data in the flash package; message digest 53 is the message digest obtained by calculating the hash value of message digest 54-message digest 181 in Table 2 (message digest 54 to message digest 181 can be regarded as a message, and the hash value of the message is calculated to obtain message digest 53). In Table 2, message digest 54 to message digest 180 are the message digests corresponding to the firmware data in the flash package; message digest 181 is the message digest obtained by calculating the hash value of message digest 182 to message digest 262 in Table 3 (message digest 182 to message digest 262 can be regarded as a message, and the hash value of the message is calculated to obtain message digest 181). Among them, Table 1 is digitally signed, and message digest 0 to message digest 53 are digitally signed. When Table 1 passes the digital signature verification, it means that Table 1 is safe. Message digest 53 in Table 1 is the preset hash value corresponding to Table 2. Since Table 1 is safe, if the actual hash value corresponding to Table 2 calculated is equal to the preset hash value, it can be proved that the information in Table 2 is safe and complete; it realizes the transmission of security without digitally signing both Table 2 and Table 3, making the data redundant and huge. Since there is no message digest corresponding to the next table in Table 3, the message digests of Table 3 are all message digests corresponding to the flashing commands in the flashing package; after the terminal device verifies the flashing data according to the message digest of Table 3, it confirms that the verification of the entire flashing package is completed.
[0062] It can be seen that in this example, the terminal device stores the preset hash value corresponding to the next table (except the last table) in the last message digest in each table. When the first table is digitally signed, secure transmission is achieved, and there is no need to digitally sign each table, which reduces the data processing amount of the terminal device and improves the data processing efficiency of the terminal device.
[0063] In a possible example, after determining whether the actual hash value matches the preset hash value and before updating the currently processed table to the second table, the method further includes: sending an ACK associated with the second table to the electronic device.
[0064] ACK refers to an Acknowledge character. The terminal device sends ACK to the electronic device to indicate that the terminal device has confirmed that the current form is correct and is ready to receive the next form.
[0065] It can be seen that in this example, the terminal device can return ACK to notify the electronic device to send the data of the next form, thereby achieving continuous acquisition of data, ensuring continuous verification of data, and improving the data processing efficiency of the terminal device.
[0066] In a possible example, after determining whether the actual hash value matches the preset hash value, the method further includes: if not, terminating the data verification operation.
[0067] In a possible example, determining the version information of the flashing package according to the first table includes: acquiring first firmware data corresponding to the first type message digest in the first table; and extracting version information in the first firmware data.
[0068] For details, please refer to Figure 2B The first table refers to Table 1, wherein when the flash package is generated, the version information is compiled into the firmware data corresponding to Table 1 in the flash package, so that the terminal device can know the version information at the very beginning of processing. And if the version information is compatible, the flash operation will continue; if the version information is not compatible, the flash operation will be terminated.
[0069] It can be seen that in this example, the terminal device can first obtain the version information, which makes it easier for the terminal device to perform subsequent operations according to the version information, thereby improving the intelligence of the terminal device.
[0070] In one possible example, before receiving the digitally signed first form sent by the electronic device, the method also includes: sending a flash request message to the electronic device; receiving response message from the electronic device, the response message including a request for obtaining device information; and sending device information of the terminal device to the electronic device.
[0071] It can be seen that in this example, the terminal device sends a flashing request and device information to the electronic device so that the electronic device can identify the identity of the terminal device and then execute an adapted flashing strategy.
[0072] With the above Figure 2A Consistently, see Figure 3 The flashing method described in this embodiment, the terminal device, the method may include the following steps:
[0073] Step 301: The terminal device sends a flash request message to the electronic device.
[0074] Step 302: The terminal device receives response information from the electronic device, where the response information includes a request for obtaining device information.
[0075] Step 303: The terminal device sends device information of the terminal device to the electronic device.
[0076] Step 304: The terminal device receives the digitally signed first form sent by the electronic device.
[0077] Step 305: The terminal device verifies the digital signature information of the first form.
[0078] Step 306: If the digital signature information of the first table passes the verification, the terminal device determines the version information of the flash package according to the first table.
[0079] Step 307: The terminal device determines whether the flash package is a firmware package of a preset version according to the version information.
[0080] Step 308: If the flash package is a firmware package of a preset version, the terminal device detects whether the currently processed form is an unprocessed form.
[0081] Step 309: If the table currently being processed is an unprocessed table, the terminal device determines the firmware data corresponding to the message digest of the first type in the table currently being processed.
[0082] Step 310: The terminal device verifies the firmware data corresponding to the first type of message digest.
[0083] Step 311: Under the condition that the verification is passed, the terminal device detects whether the table currently being processed includes a second type of message digest, and the second type of message digest includes a preset hash value of the second table.
[0084] Step 312: If the currently processed table does not include the second type of message digest, the terminal device generates a flash package based on the firmware data in all the received tables; if the currently processed table includes the second type of message digest, the second table is received and the actual hash value of the second table is calculated; it is determined whether the actual hash value matches the preset hash value; if so, the currently processed table is updated to the second table.
[0085] It can be seen that in the embodiment of the present application, the terminal device first receives the digitally signed first form sent by the electronic device, and the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; if the digital signature information of the first form passes the verification, the version information of the flash package is determined according to the first form; secondly, it is determined whether the flash package is a firmware package of a preset version according to the version information; if so, a data verification operation is performed to fully verify the flash package; the firmware of the mobile terminal is upgraded according to the verified flash package. It can be seen that the terminal device first verifies the digital signature of the form, which improves the security when flashing; when the digital signature passes the verification, the terminal device further determines the version information of the flash package, and when the version information is adapted, the flash package is completely flashed, avoiding the situation of incorrect firmware package acquisition and incorrect flash version.
[0086] With the above Figure 2A Consistently, see Figure 4 , is a flow chart of another flashing method provided in an embodiment of the present application, which is applied to an electronic device. The method may include the following steps:
[0087] Step 401: The electronic device receives a flash request message sent by a terminal device.
[0088] Step 402: The electronic device sends a response message to the terminal device, where the response message includes a request for obtaining device information of the terminal device.
[0089] Step 403: The electronic device receives the first device information sent by the terminal device.
[0090] Step 404: The electronic device sends first device information and second device information to the server, where the second device refers to device information of the electronic device.
[0091] Step 405: The electronic device receives the authorization information sent by the server.
[0092] Step 406: The electronic device determines whether the terminal device meets the flashing condition based on the authorization information.
[0093] Step 407: If yes, the electronic device sends a flash package to the terminal device.
[0094] It can be seen that in the embodiment of the present application, the electronic device receives the flashing request information sent by the terminal device; sends response information to the terminal device, the response information includes a request to obtain the device information of the terminal device; receives the first device information sent by the terminal device; sends the first device information and the second device information to the server, the second device refers to the device information of the electronic device; receives the authorization information sent by the server; determines whether the terminal device meets the flashing conditions according to the authorization information; if so, sends the flashing package to the terminal device. It can be seen that in this example, the electronic device interacts with the terminal device to obtain the device information of the terminal device; the electronic device interacts with the server to obtain the server's interactive information on the electronic device and the terminal device, thereby realizing the server's verification of the terminal device and the electronic device, and improving the security of flashing.
[0095] With the above Figure 2A , Figure 3 , Figure 4 For details on the embodiments shown in the drawings, please refer to Figure 5 , Figure 51 is a schematic diagram of the structure of a terminal device 500 provided in an embodiment of the present application. As shown in the figure, the terminal device 500 includes an application processor 510, a memory 520, a communication interface 530, and one or more programs 521, wherein the one or more programs 521 are stored in the memory 520 and are configured to be executed by the application processor 510, and the one or more programs 521 include instructions for executing the following steps:
[0096] Receiving a digitally signed first form sent by an electronic device, wherein the first form includes at least one message digest;
[0097] Verifying the digital signature information of the first form;
[0098] If the digital signature information of the first table passes the verification, determining the version information of the flash package according to the first table;
[0099] Determining whether the flash package is a firmware package of a preset version according to the version information;
[0100] If yes, then perform a data verification operation to fully verify the flash package;
[0101] The firmware of the mobile terminal is upgraded according to the verified flashing package.
[0102] It can be seen that in the embodiment of the present application, the terminal device first receives the digitally signed first form sent by the electronic device, and the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; if the digital signature information of the first form passes the verification, the version information of the flash package is determined according to the first form; secondly, it is determined whether the flash package is a firmware package of a preset version according to the version information; if so, a data verification operation is performed to fully verify the flash package; the firmware of the mobile terminal is upgraded according to the verified flash package. It can be seen that the terminal device first verifies the digital signature of the form, which improves the security when flashing; when the digital signature passes the verification, the terminal device further determines the version information of the flash package, and when the version information is adapted, the flash package is completely flashed, avoiding the situation of incorrect firmware package acquisition and incorrect flash version.
[0103] In one possible example, in terms of performing the data verification operation, the instructions in the program are specifically used to perform the following operations: detect whether the currently processed table is an unprocessed table; if so, determine the firmware data corresponding to the first type of message digest in the currently processed table; verify the firmware data corresponding to the first type of message digest; and under the condition that the verification passes, detect whether the currently processed table includes a second type of message digest, and the second type of message digest includes a preset hash value of the second table.
[0104] In one possible example, after detecting whether the currently processed table includes a message digest of the second type, the instructions in the program are specifically used to perform the following operations: if not, determining that the flash package verification has passed.
[0105] In one possible example, after detecting whether the currently processed table includes a second type of message digest, the instructions in the program are specifically used to perform the following operations: if so, obtain a second table and calculate an actual hash value of the second table; determine whether the actual hash value matches the preset hash value; if so, update the currently processed table to the second table.
[0106] In one possible example, after determining whether the actual hash value matches the preset hash value and before updating the currently processed table to the second table, the instructions in the program are specifically used to perform the following operations: sending an ACK associated with the second table to the electronic device.
[0107] In one possible example, after determining whether the actual hash value matches the preset hash value, the instructions in the program are specifically used to perform the following operations: if not, terminating the data verification operation.
[0108] In one possible example, in terms of determining the version information of the flash package according to the first table, the instructions in the program are specifically used to perform the following operations: obtain first firmware data corresponding to the first type message digest in the first table; extract version information in the first firmware data.
[0109] In one possible example, before receiving the digitally signed first form sent by the electronic device, the instructions in the program are specifically used to perform the following operations: sending a flash request message to the electronic device; receiving a response message from the electronic device, the response message including a request for obtaining device information; and sending the device information of the terminal device to the electronic device.
[0110] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0111] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0112] Figure 6 600 is a functional unit block diagram of a flashing device 600 involved in an embodiment of the present application. The flashing device 600 terminal device includes a processing unit 601 and a communication unit 602, wherein:
[0113] The processing unit is used to receive a digitally signed first form through the communication unit, the first form including at least one message digest; and to verify the digital signature information of the first form; and to determine the version information of the flash package according to the first table if the digital signature information of the first table passes the verification; and to determine whether the flash package is a firmware package of a preset version according to the version information; and if so, to perform a data verification operation through the communication unit to update the flash package; and to upgrade the firmware of the mobile terminal according to the verified flash package.
[0114] The multi-flash device may further include a storage unit 603 for storing program codes and data of the electronic device. The processing unit 601 may be an application processor, the communication unit 602 may be a global communication bus, a transceiver, etc., and the storage unit 603 may be a memory.
[0115] It can be seen that in the embodiment of the present application, the terminal device first receives the digitally signed first form sent by the electronic device, and the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; if the digital signature information of the first form passes the verification, the version information of the flash package is determined according to the first form; secondly, it is determined whether the flash package is a firmware package of a preset version according to the version information; if so, a data verification operation is performed to fully verify the flash package; the firmware of the mobile terminal is upgraded according to the verified flash package. It can be seen that the terminal device first verifies the digital signature of the form, which improves the security when flashing; when the digital signature passes the verification, the terminal device further determines the version information of the flash package, and when the version information is adapted, the flash package is completely flashed, avoiding the situation of incorrect firmware package acquisition and incorrect flash version.
[0116] In one possible example, in performing the data verification operation, the processing unit 601 is specifically used to: detect whether the currently processed table is an unprocessed table; if so, determine the firmware data corresponding to the first type of message digest in the currently processed table; verify the firmware data corresponding to the first type of message digest; and under the condition that the verification passes, detect whether the currently processed table includes a second type of message digest, and the second type of message digest includes a preset hash value of the second table.
[0117] In a possible example, after detecting whether the currently processed table includes the second type of message digest, the processing unit 601 is specifically configured to: if not, determine that the flashing package verification has passed.
[0118] In one possible example, after detecting whether the currently processed table includes a second type of message digest, the processing unit 601 is specifically used to: if so, receive the second table through the communication unit 602, and calculate the actual hash value of the second table; determine whether the actual hash value matches the preset hash value; if so, update the currently processed table to the second table.
[0119] In one possible example, after determining whether the actual hash value matches the preset hash value and before updating the currently processed table to the second table, the processing unit 601 is specifically used to: send an ACK associated with the second table to the electronic device through the communication unit 602.
[0120] In a possible example, after determining whether the actual hash value matches the preset hash value, the processing unit 601 is specifically configured to: if not, terminate the data verification operation.
[0121] In a possible example, in determining the version information of the flash package according to the first table, the processing unit 601 is specifically used to: obtain first firmware data corresponding to the first type message digest in the first table; and extract version information in the first firmware data.
[0122] In one possible example, before the receiving electronic device sends the digitally signed first form, the processing unit 601 is specifically used to: send a flash request information to the electronic device through the communication unit 602; receive response information from the electronic device through the communication unit 602, the response information including a request for obtaining device information; and send the device information of the terminal device to the electronic device.
[0123] The embodiment of the present application further provides a flashing device, characterized in that it is applied to an electronic device, and the flashing device includes a processing unit and a communication unit, wherein:
[0124] The processing unit is used to receive flashing request information sent by the terminal device through the communication unit; and to send response information to the terminal device through the communication unit, the response information including a request for obtaining device information of the terminal device; and to receive first device information sent by the terminal device through the communication unit; and to send the first device information and second device information to the server, the second device referring to the device information of the electronic device; and to receive authorization information sent by the server through the communication unit; and to determine whether the terminal device meets the flashing conditions based on the authorization information; and if so, to send a flashing package to the terminal device through the communication unit.
[0125] It can be understood that the functions of each program module of the flashing device of this embodiment can be specifically implemented according to the method in the above method embodiment, and its specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.
[0126] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any flashing method recorded in the above method embodiments.
[0127] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any flashing method recorded in the above method embodiments.
[0128] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0129] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0130] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical or other forms.
[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.
[0133] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0134] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the relevant hardware through a program, and the program may be stored in a computer-readable memory, which may include a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.
[0135] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A flashing method, characterized in that: Applied to a terminal device, the method comprises: Receiving a digitally signed first form sent by an electronic device, wherein the first form includes at least one message digest; Verifying the digital signature information of the first form; If the digital signature information of the first table passes the verification, determining the version information of the flash package according to the first table; Determining whether the flash package is a firmware package of a preset version according to the version information; If yes, a data verification operation is performed to fully verify the flash package, the data verification operation comprising the following steps: detecting whether the currently processed table is an unprocessed table; if yes, determining the firmware data corresponding to the first type of message digest in the currently processed table; verifying the firmware data corresponding to the first type of message digest; under the condition that the verification passes, detecting whether the currently processed table includes a second type of message digest, the second type of message digest including a preset hash value of the second table; The firmware of the terminal device is upgraded according to the verified flashing package.
2. The method according to claim 1, characterized in that: After detecting whether the currently processed table includes a message digest of the second type, the method further includes: If not, it is determined that the flashing package has passed the verification.
3. The method according to claim 1, characterized in that After detecting whether the currently processed table includes a message digest of the second type, the method further includes: If yes, obtain the second table and calculate the actual hash value of the second table; Determining whether the actual hash value matches the preset hash value; If so, the currently processed table is updated to be the second table.
4. The method according to claim 3, characterized in that After determining whether the actual hash value matches the preset hash value and before updating the currently processed table to the second table, the method further includes: An ACK associated with the second table is sent to the electronic device.
5. The method according to claim 3, characterized in that: After determining whether the actual hash value matches the preset hash value, the method further includes: If not, the data verification operation is terminated.
6. The method according to any one of claims 1 to 5, characterized in that: The step of determining the version information of the flash package according to the first table includes: Acquire first firmware data corresponding to the first type message digest in the first table; The version information in the first firmware data is extracted.
7. The method according to claim 1, characterized in that Before receiving the digitally signed first form sent by the electronic device, the method further includes: Sending a flash request message to the electronic device; receiving response information from the electronic device, wherein the response information includes a request for obtaining device information; Send the device information of the terminal device to the electronic device.
8. A flashing device, characterized in that: The terminal device includes a processing unit and a communication unit, wherein: The processing unit is used to receive a digitally signed first form sent by an electronic device through the communication unit, the first form including at least one message digest; and to verify the digital signature information of the first form; and to determine the version information of the flash package according to the first table if the digital signature information of the first table passes the verification; and to determine whether the flash package is a firmware package of a preset version according to the version information; and if so, to perform a data verification operation to fully verify the flash package. The processing unit is specifically used to: detect whether the currently processed form is an unprocessed form; and if so, determine the firmware data corresponding to the first type of message digest in the currently processed form; and to verify the firmware data corresponding to the first type of message digest; and to detect whether the currently processed form includes a second type of message digest under the condition that the verification passes, the second type of message digest includes a preset hash value of the second form; and to upgrade the firmware of the terminal device according to the verified flash package.
9. The device according to claim 8, characterized in that After detecting whether the currently processed table includes a message digest of the second type, the processing unit is specifically configured to: If not, it is determined that the flashing package has passed the verification.
10. The device according to claim 8, characterized in that After detecting whether the currently processed table includes a message digest of the second type, the processing unit is specifically configured to: If yes, receiving a second table through the communication unit, calculating an actual hash value of the second table; and determining whether the actual hash value matches the preset hash value; and if yes, updating the currently processed table to the second table.
11. The device according to claim 10, characterized in that In the aspect of updating the currently processed table to the second table after determining whether the actual hash value matches the preset hash value, the processing unit is specifically configured to: An ACK associated with the second table is transmitted to the electronic device through the communication unit.
12. The device according to claim 10, characterized in that After determining whether the actual hash value matches the preset hash value, the processing unit is specifically configured to: If not, the data verification operation is terminated.
13. The device according to any one of claims 8 to 12, characterized in that: In determining the version information of the flash package according to the first table, the processing unit is specifically used to: Acquire first firmware data corresponding to the first type message digest in the first table; and extract version information from the first firmware data.
14. The device according to claim 8, characterized in that Before the receiving electronic device sends the first digitally signed form, the processing unit is specifically configured to: Sending flash request information to the electronic device through the communication unit; and receiving response information from the electronic device through the communication unit, the response information including a request for obtaining device information; sending device information of the terminal device to the electronic device through the communication unit.
15. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that: A computer program for electronic data exchange is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Firmware upgrading and encapsulating method and device based on digital signing
CN101436141A
ROM flashing method, mobile terminal and terminal system
CN105183499A