Equipment upgrading method, equipment upgrading device and storage medium

By presetting the key and initial vector encryption firmware upgrade package in the device and decrypting it, the problem of firmware leakage and decompilation risks in the Matter protocol device upgrade is solved, ensuring the security of device information and user data.

CN119025136APending Publication Date: 2024-11-26BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310597898.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-25
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The lack of firmware encryption mechanism in the existing Matter protocol equipment upgrade technology leads to the risk of firmware leakage and decompilation, which may cause sensitive information leakage and malicious attacks.

Method used

Preset the keys and initial vectors in the device, encrypt the firmware upgrade package based on these keys and initial vectors, and decrypt the firmware upgrade package within the device to ensure the security of the upgrade process.

Benefits of technology

By encrypting firmware upgrade packages, prevent firmware leakage and decompile risks, protect the security of device information and user data, and prevent sensitive information leakage and malicious attacks of tampered firmware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025136A_ABST
    Figure CN119025136A_ABST
Patent Text Reader

Abstract

The invention relates to an equipment upgrading method, an equipment upgrading device and a storage medium. The equipment upgrading method comprises the following steps: acquiring a firmware upgrading package used for upgrading equipment, wherein the firmware upgrading package is encrypted based on a preset key and an initial vector in the equipment; decrypting the firmware upgrade package based on a preset key and an initial vector in the equipment; and in response to decryption success, installing the decrypted firmware upgrade package so as to upgrade the equipment. According to the device upgrading method and device, the firmware upgrading package is decrypted based on the preset secret key in the device, the firmware upgrading package is installed, and device upgrading is completed. The risk of firmware leakage and decompilation in the equipment upgrading process is prevented, sensitive information leakage and malicious attacks of firmware tampering are prevented, and the safety of equipment information and user data of the equipment is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of equipment upgrading, and in particular to an equipment upgrading method, an equipment upgrading device and a storage medium. Background Art

[0002] In the field of smart home, an application ecosystem is built based on underlying wireless protocols such as Bluetooth Low Energy (BLE), Wi-Fi, and Zigbee. Compared with other protocols, the current Matter protocol is more universal. Devices that support other protocols can develop standard application layer protocols based on the original underlying protocols, so that products made by different manufacturers can use the same standard protocol to communicate.

[0003] In the related technology, the device is upgraded based on the basic Over-the-Air Technology (OTA), and the device is upgraded through nodes with the ability to obtain software upgrades and nodes with the ability to provide software upgrade services, so that the device supports the matter protocol. However, there is no provision for the corresponding firmware encryption, which will lead to the risk of firmware leakage and decompilation, and may cause sensitive information leakage and malicious attacks by tampering with the firmware. Summary of the invention

[0004] In order to overcome the problems existing in the related art, the present disclosure provides a device upgrading method, a device upgrading apparatus and a storage medium.

[0005] According to a first aspect of an embodiment of the present disclosure, a device upgrade method is provided, comprising: obtaining a firmware upgrade package for upgrading a device, wherein the firmware upgrade package is encrypted based on a key and an initial vector preset in the device; decrypting the firmware upgrade package based on the key and the initial vector preset in the device; and in response to successful decryption, installing the decrypted firmware upgrade package to upgrade the device.

[0006] In one implementation, the key and the initial vector are stored in a storage area with a read protection function in the device; based on the key and initial vector preset in the device, before decrypting the firmware upgrade package, the method further includes: obtaining the key and the initial vector from the storage area with a read protection function.

[0007] In one embodiment, the firmware upgrade package is encrypted based on a key and an initial vector preset in the device in the following manner: obtaining a key and an initial vector preset in the device; in response to the number of the firmware upgrade packages being multiple, encrypting the multiple firmware upgrade packages separately using the same key and initial vector.

[0008] In one implementation, before obtaining the key and the initial vector from the storage area with a read protection function, the method further includes: verifying the firmware upgrade package and determining that the firmware upgrade package is successfully verified.

[0009] In one implementation, the method further includes: in response to failure in verifying the firmware upgrade package, prohibiting acquisition of the key and the initial vector from the storage area with a read protection function.

[0010] According to a second aspect of an embodiment of the present disclosure, a device upgrade apparatus is provided, comprising: an acquisition unit, configured to acquire a firmware upgrade package for upgrading a device, wherein the firmware upgrade package is encrypted based on a key and an initial vector pre-set in the device; a processing unit, configured to decrypt the firmware upgrade package based on a key and an initial vector pre-set in the device; and an installation unit, configured to install the decrypted firmware upgrade package in response to successful decryption to upgrade the device.

[0011] In one implementation, the key and the initial vector are stored in a storage area with a read protection function in the device; before decrypting the firmware upgrade package based on the key and initial vector preset in the device, the processing unit is also used to: obtain the key and the initial vector from the storage area with a read protection function.

[0012] In one embodiment, the firmware upgrade package is encrypted based on a key and an initial vector preset in the device in the following manner: obtaining a key and an initial vector preset in the device; in response to the number of the firmware upgrade packages being multiple, encrypting the multiple firmware upgrade packages separately using the same key and initial vector.

[0013] In one implementation, before obtaining the key and the initial vector from the storage area with a read protection function, the processing unit is further configured to: verify the firmware upgrade package and determine whether the verification of the firmware upgrade package is successful.

[0014] In one implementation, the processing unit is further configured to: in response to a failure in verifying the firmware upgrade package, prohibit obtaining the key and the initial vector from the storage area with a read protection function.

[0015] According to a third aspect of an embodiment of the present disclosure, there is provided a device upgrading apparatus, comprising: a processor; and a memory for storing processor executable instructions; wherein the processor is configured to: execute the device upgrading method described in any one of the first aspects.

[0016] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided, in which instructions are stored. When the instructions in the storage medium are executed by a processor, the processor is enabled to execute the device upgrade method described in any one of the first aspects.

[0017] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: the device obtains a firmware upgrade package encrypted based on a key and an initial vector preset in the device, and decrypts the firmware upgrade package based on the preset key and the initial vector, preventing firmware leakage during the device upgrade process, and preventing sensitive information leakage and malicious attacks caused by tampering with the firmware. In response to successful decryption, the decrypted firmware upgrade package is installed to upgrade the device. Through the present disclosure, the firmware upgrade package is encrypted based on a key preset in the device, and the firmware upgrade package is decrypted to complete the upgrade of the device, thereby protecting the security of the device information and user data of the device during the device upgrade process.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0020] Figure 1 The figure is a flowchart of a method for encrypting a firmware upgrade package according to an exemplary embodiment.

[0021] Figure 2 The present invention is a flowchart of a method for uploading a firmware upgrade package to a server according to an exemplary embodiment.

[0022] Figure 3 The present invention is a flowchart of a method for interaction between a device and a server according to an exemplary embodiment.

[0023] Figure 4 The figure is a flow chart of a device upgrading method according to an exemplary embodiment.

[0024] Figure 5 The figure is a flowchart showing a method for decrypting a firmware upgrade package according to an exemplary embodiment.

[0025] Figure 6 The figure is a flowchart showing a method for encrypting a firmware upgrade package according to an exemplary embodiment.

[0026] Figure 7 The figure is a flowchart of a method for decrypting a firmware upgrade package according to yet another exemplary embodiment.

[0027] Figure 8The figure is a flow chart showing a method for verifying a firmware upgrade package according to an exemplary embodiment.

[0028] Fig. 9 The invention is a block diagram showing a method for encrypting a firmware upgrade package according to an exemplary embodiment of the present disclosure.

[0029] Fig.10 The invention is a block diagram showing a method for downloading and burning a firmware upgrade package according to an exemplary embodiment of the present invention.

[0030] Fig.11 The invention is a block diagram showing a method for decrypting and installing a firmware upgrade package according to an exemplary embodiment of the present disclosure.

[0031] Fig.12 The figure is a block diagram of a device upgrading apparatus according to an exemplary embodiment.

[0032] Fig.13 The invention is a block diagram showing an apparatus for upgrading a device according to an exemplary embodiment. DETAILED DESCRIPTION

[0033] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure.

[0034] The device upgrade method provided in the embodiment of the present disclosure is applied to the scenario of upgrading devices that support the Matter protocol.

[0035] Devices in the smart home field generally support low-power Bluetooth, wireless communication technology, ZigBee and other underlying wireless protocols. Manufacturers can build a rich application ecosystem based on these underlying transmission protocols. Manufacturers develop software development kits that adapt to various ecological protocols based on devices, and provide them to device manufacturers for secondary development to create their own products. This is the general development model on the device side of the smart home field. At present, the Matter protocol is more universal than other protocols. Devices that support other protocols can develop standard application layer protocols based on the original underlying protocols, so that products made by different manufacturers use the same standard protocol to communicate. At present, the Matter standard protocol v1.0 has been officially released, and devices that support the Matter protocol have not been officially released. Major device manufacturers have begun to add their own demo implementations to the Matter code base. Device testing of the Matter protocol by major manufacturers is also ongoing.

[0036] In the related art, the device to be upgraded can be upgraded based on Over-the-Air Technology (OTA) to enable the device to support the Matter protocol. The current Matter standard protocol specifies basic device upgrade capabilities. The protocol specifies two basic roles, namely, the OTA Requestor, which corresponds to the device to be upgraded in this disclosure; and the OTA Provider, which corresponds to the server in this disclosure. Among them, the OTA Requestor is the login end of the OTA Software Update Provider cluster and the server of the OTA Software Update Requestor, which is a node with the ability to obtain software upgrades. The OTA Provider is a device type (Device Type) (0x0014), which includes the server of the OTA Software Update Provider cluster and the login end of the OTA Software Update Requestor, which is a node with the ability to provide software upgrade services. The basic OTA technical capabilities provided by the current Matter standard protocol specify the basic OTA technical process to ensure the reliable upgrade of Matter devices. However, there is no provision for firmware encryption.

[0037] Since the Matter standard protocol (specification, spec) does not provide for a firmware security encryption mechanism, there is a risk of firmware leakage and decompilation, which may cause sensitive information leakage and malicious attacks on tampered firmware, causing unpredictable damage to the Matter device that has downloaded the tampered firmware.

[0038] In view of this, the present disclosure proposes a device upgrade method, which pre-sets a key and an initial vector in the device, and makes the Matter protocol into a firmware upgrade package. The firmware upgrade package is encrypted based on the preset key and the initial vector. The device decrypts the firmware upgrade package through the key, and installs the decrypted firmware upgrade package to complete the upgrade. By encrypting the firmware upgrade package, the risk of firmware leakage and decompilation is prevented, and the leakage of sensitive information and malicious attacks by tampering with the firmware are prevented. The device information of the device is protected and the security of user data is guaranteed.

[0039] In the disclosed embodiment, the firmware upgrade package used for device upgrade is an encrypted firmware package. Figure 1 As shown in the flowchart of the firmware upgrade package encryption method in, the method includes steps S101 to S102.

[0040] In step S101, a key and an initialization vector preset in a device are obtained.

[0041] In step S102, the firmware upgrade package is encrypted based on the key, the initialization vector and the encryption algorithm.

[0042] In the disclosed embodiment, the device manufacturer presets the key and initial vector in the device when the device leaves the factory, and the device manufacturer also completes the packaging and encryption of the firmware upgrade package based on the key and initial vector. By encrypting the firmware upgrade package, the firmware is prevented from leaking during the device upgrade process, and the leakage of sensitive information and malicious attacks by tampering with the firmware are prevented.

[0043] In the disclosed embodiment, the encrypted firmware upgrade package is uploaded to the server for downloading by the device to be upgraded. Figure 2 As shown in the flowchart of the method for uploading the firmware upgrade package to the server, the method includes steps S201 to S202.

[0044] In step S201, the encryption of the firmware upgrade package is completed.

[0045] In step S202, a uniform resource identifier is generated based on the encrypted firmware upgrade package.

[0046] In the disclosed embodiment, after the firmware upgrade package is encrypted, the firmware upgrade package is uploaded to the server, which is a platform that has multiple firmware upgrade package resources and provides download services. After the firmware upgrade package is uploaded to the server, the server generates a uniform resource locator (URL) pointing to the firmware package. The device can download the firmware upgrade package pointed to by the uniform resource locator based on the uniform resource identifier.

[0047] In the disclosed embodiment, the device to be upgraded sends a request to the server to obtain the firmware upgrade package. After the server gives feedback, the device starts downloading the firmware upgrade package. Figure 3 As shown in the schematic diagram of the device and server interaction method, the method includes steps S301 to S303.

[0048] In step S301, the device sends a request to the server to obtain a firmware upgrade package.

[0049] In step S302, in response to obtaining the request sent by the device, the server parses the request and returns object notation parameters including a uniform resource locator.

[0050] In the disclosed embodiment, the object notation parameter (JavaScript Object Notation JSON) is a data parameter including a uniform resource locator.

[0051] In step S303, the device parses the object musical notation parameters, obtains a uniform resource locator, and downloads a firmware upgrade package based on the uniform resource locator.

[0052] In the disclosed embodiment, the content used for device upgrade, such as the standard protocol, is packaged into firmware and stored in a server that supports firmware download. The device to be upgraded obtains the firmware upgrade package in the following manner: a request for a uniform resource locator corresponding to the firmware upgrade package is sent to the server; the object notation parameter returned by the server is received, and the object notation parameter returned by the server is parsed to obtain the uniform resource locator; and the firmware upgrade package is downloaded based on the uniform resource locator.

[0053] In the disclosed embodiment, the device obtains a uniform resource locator pointing to a firmware upgrade package through interaction with a server, and downloads the firmware upgrade package based on the uniform resource locator.

[0054] Figure 4 FIG. 1 is a flow chart of a device upgrade method according to an exemplary embodiment. Figure 4 The method includes steps S401 to S403.

[0055] In step S401, a firmware upgrade package for upgrading the device is obtained.

[0056] In step S402, the firmware upgrade package is decrypted based on the key and initialization vector preset in the device.

[0057] In step S403, in response to the decryption being successful, the decrypted firmware upgrade package is installed to upgrade the device.

[0058] In the embodiment of the present disclosure, the firmware upgrade package may be a firmware package packaged by an underlying transmission protocol such as the Matter protocol for smart home devices.

[0059] In the disclosed embodiment, the firmware upgrade package is encrypted based on the key preset in the device, and the firmware upgrade package is verified. The risk of firmware leakage and decompilation during the device upgrade process is prevented, and the leakage of sensitive information and malicious attacks by tampering with the firmware are prevented. The security of the device information and user data of the device is protected.

[0060] In the embodiment of the present disclosure, in order to prevent the key and the initial vector from being leaked, the key and the initial vector need to be stored in a secure storage area in the device, and the key and the initial vector need to be obtained from the secure storage area when performing verification.

[0061] The following embodiments of the present disclosure illustrate the method for decrypting a firmware upgrade package in the above embodiments of the present disclosure.

[0062] Figure 5 FIG. 1 is a flow chart showing a method for decrypting a firmware upgrade package according to an exemplary embodiment. Figure 5 As shown, the method includes step S501 to step S502.

[0063] In step S501, a key and an initial vector are obtained from a storage area with a read protection function.

[0064] In step S502, the firmware upgrade package is decrypted based on the key and initialization vector preset in the device.

[0065] In the disclosed embodiment, only software running securely can read data stored in the area with a read protection function, and data stored in the area with a read protection function cannot be read from the outside by force. This ensures that the key and the initial vector are not read by unauthenticated third-party software, thereby ensuring the security of the key and the initial vector.

[0066] In the disclosed embodiment, the area with the read protection function may be the Efuse area of ​​the device to be upgraded. Efuse is a one-time programmable memory, and information will be written before the chip is released. In a chip, the capacity of Efuse is usually very small, and some chips have only 128 bits of Efuse. In addition to the read protection feature that cannot be read from the outside by force, the Efuse area also has the feature of supporting only a single write, which prevents the key and initial vector stored in the Efuse area from being tampered with after being erased.

[0067] In the embodiment of the present disclosure, by storing the key and the initial vector in an area with a read protection function, the key and the initial vector are obtained from the area when decrypting the firmware upgrade package. This prevents the key and the initial vector from being read by external force, resulting in the leakage of the key and the initial vector, and further ensures the security of firmware decryption.

[0068] In the disclosed embodiments, the contents such as standard protocols used for device upgrade are usually packaged into multiple firmwares. When decrypting the firmware, each firmware package needs to be decrypted.

[0069] The following embodiments of the present disclosure further illustrate the method for decrypting a firmware upgrade package in the above embodiments of the present disclosure.

[0070] Figure 6 FIG. 1 is a flow chart showing a method for decrypting a firmware upgrade package according to an exemplary embodiment. Figure 6 As shown, the method includes step S601 to step S602.

[0071] In step S601, a key and an initialization vector preset in the device are obtained.

[0072] In step S602, in response to the fact that there are multiple firmware upgrade packages, the multiple firmware upgrade packages are encrypted respectively using the same key and initialization vector.

[0073] In the disclosed embodiment, if there are multiple firmware upgrade packages that need to be decrypted, each firmware upgrade package is decrypted based on the preset key and initial vector in the device to be upgraded, and stored in the corresponding storage area until each firmware upgrade package is decrypted.

[0074] In the disclosed embodiment, it is necessary to ensure that the firmware upgrade package to be decrypted after installation is not tampered with to become a third-party firmware package, so it is necessary to verify the firmware upgrade package to verify whether it is the firmware upgrade package for upgrading the device.

[0075] The following embodiments of the present disclosure further illustrate the method for decrypting a firmware upgrade package in the above embodiments of the present disclosure.

[0076] Figure 7 FIG. 1 is a flowchart of a method for decrypting a firmware upgrade package according to another exemplary embodiment. Figure 7 As shown, the method includes steps S701 to S703.

[0077] In step S701, the firmware upgrade package is verified, and it is determined that the verification of the firmware upgrade package is successful.

[0078] In step S702, a key and an initial vector are obtained from a storage area with a read protection function.

[0079] In step S703, the firmware upgrade package is decrypted based on the key and initialization vector preset in the device.

[0080] In the disclosed embodiment, after the firmware upgrade package is successfully installed, a boot loader (BootLoader) check is required to verify whether the firmware to be decrypted is the firmware upgrade package for upgrading the device, and it is necessary to ensure that the firmware upgrade package will not be replaced maliciously. It is understandable that if the firmware upgrade package is easily burned as a third-party firmware, the third-party firmware can also read sensitive information such as the encryption key and initial vector of the device to be upgraded from the read-protected area, thereby achieving the purpose of cracking the key security. Therefore, it is necessary to prevent the burning of third-party firmware, and it is necessary to design a secure boot protection for the system, that is, to ensure that only authenticated firmware can pass the boot loader check and can start and run normally. For maliciously burned third-party firmware, the boot loader check will fail, and the application cannot start normally. Through the boot loader check, the security of the key and the initial vector can be protected.

[0081] In an exemplary embodiment of the present disclosure, a boot loading verification can be performed on the firmware upgrade package based on an asymmetric encryption algorithm. In response to completing the download of the firmware upgrade package, the device generates a public key-private key pair, and the public key and the private key are not the same. The device processes the firmware package, obtains the hash value of the firmware package, and processes the hash value based on the private key to generate a signature, and the signature is annotated on the plaintext firmware package; the firmware package further processed by the private key generates a hash value, and the hash value is processed using the public key to obtain a processing result, and the signature is used to verify the processing result. In response to the completion of the verification, it indicates whether the firmware to be decrypted is a firmware upgrade package for upgrading the device, rather than third-party firmware, and the firmware upgrade package can be subjected to the next step of decryption processing.

[0082] Figure 8 FIG. 1 is a flow chart showing a method for verifying a firmware upgrade package according to an exemplary embodiment. Figure 8 As shown, the method includes steps S801, S802A and step S802B.

[0083] In step S801, the firmware upgrade package is verified.

[0084] In step S802A, in response to successful verification of the firmware upgrade package, the firmware upgrade package is decrypted based on a key and an initialization vector preset in the device.

[0085] In step S802B, in response to the failure of verifying the firmware upgrade package, obtaining the key and the initialization vector from the storage area with a read protection function is prohibited.

[0086] In the embodiment of the present disclosure, in response to the failure of the startup loading verification of the firmware upgrade package, it is characterized that the firmware to be decrypted has been tampered with to a third-party firmware and is not a firmware upgrade package for upgrading the device. The decryption operation will cause the key and the initial vector to be leaked. Therefore, after the startup loading verification of the firmware package fails, the next step is stopped, and the firmware is prohibited from obtaining the key and the initial vector from the storage area with a read protection function. The security of the firmware verification process is guaranteed.

[0087] An exemplary embodiment of the present disclosure shows a method for encrypting a firmware package, such as Fig. 9 A block diagram of a firmware encryption method is shown, the method comprising the following steps:

[0088] 1. Get the encryption key and initial vector pre-burned in the device.

[0089] Obtain the key and initial vector that are preset in the EFUSE area of ​​the device to be upgraded when it leaves the factory.

[0090] 2. Use encryption algorithm to encrypt the firmware plaintext package.

[0091] The Matter protocol is packaged into multiple firmware plaintext packages, and multiple firmware plaintext packages are encrypted in groups based on the AES128-CBC algorithm.

[0092] 3. Encryption completed.

[0093] Complete the encryption of each firmware plaintext package.

[0094] 4. Generate a download link of the uniform resource locator identifier for the device to download.

[0095] The encrypted plaintext firmware package is uploaded to the server that provides firmware package downloads, and a uniform resource locator is generated. The device to be upgraded can send a request to the server to download the corresponding plaintext firmware package, and the server can return an object notation in response to the received request. The device to be upgraded can obtain a uniform resource locator for downloading firmware based on the object notation.

[0096] An exemplary embodiment of the present disclosure shows a method for downloading and burning a firmware upgrade package applied to a device, such as Fig.10 A block diagram of a method for downloading and burning a firmware upgrade package is shown, the method comprising the following steps:

[0097] In response to starting the installation and burning process of the firmware upgrade package, the device to be upgraded sends a request to the server to obtain the uniform resource locator for downloading the firmware; the server parses the received request and returns the corresponding object map; in response to the device to be upgraded obtaining the uniform resource locator by parsing the object map, the terminal downloads the corresponding firmware package; in response to the firmware upgrade package being successfully downloaded; the device performs a startup loading verification on the firmware upgrade package; in response to the startup loading verification of the firmware upgrade package being successful, a storage area for burning the firmware upgrade package is selected, and the firmware is burned. In response to the firmware burning being successful, the startup loading burning is notified successfully, and the boot partition is switched. The installation and burning process of the firmware upgrade package ends. Among them, the firmware upgrade package burning process also includes a verification process of the firmware upgrade package by the device to be upgraded.

[0098] An exemplary embodiment of the present disclosure shows a method for decrypting and installing a firmware upgrade package applied to a device, which is a refinement of the firmware burning process in the previous embodiment. Fig.11 A block diagram of a method for decrypting and installing a firmware upgrade package is shown, the method comprising the following steps:

[0099] 1. Start upgrading the device based on over-the-air download technology.

[0100] Based on the over-the-air download technology, the device to be upgraded is remotely controlled to complete the upgrade.

[0101] 2.Firmware download is complete.

[0102] Download the firmware upgrade package from the server and complete the startup loading verification of the firmware upgrade package.

[0103] 3. Start the decryption installation process.

[0104] The firmware upgrade package is decrypted based on the key and initialization vector preset in the device to be upgraded.

[0105] 4. Get the secret key and initialization vector from the read-protected area of ​​the device.

[0106] Get the key and initialization vector for decryption from the device's Efuse area.

[0107] 5. Decrypt each packet of data and install it in the flash area.

[0108] Each firmware package is decrypted using the acquired key and initial vector, and stored uniformly in a preset flash memory area until all firmware packages are decrypted and stored.

[0109] 6. Decryption completed.

[0110] Complete the decryption of each firmware upgrade package, and store and install each firmware upgrade package in the corresponding area.

[0111] 7.Firmware installation and reboot.

[0112] In response to storing and installing each firmware upgrade package in a corresponding area, the device is restarted to complete the installation of the firmware upgrade package.

[0113] 8. Complete equipment upgrade based on over-the-air download technology.

[0114] In response to completing the installation of the firmware upgrade package, it is determined that the upgrade of the device has been completed, and the over-the-air download is stopped.

[0115] In the disclosed embodiment, the firmware upgrade package may be encrypted and decrypted based on a symmetric encryption algorithm such as AES128-CBC or AES256-CBC.

[0116] An exemplary embodiment of the present disclosure shows a method for encrypting and decrypting a firmware upgrade package, and the specific process of the method is as follows.

[0117] Encryption process:

[0118] Get the preset encryption key and IV, and encrypt the OTA plaintext data with AES128-CBC

[0119] OTA_data_encrypt=AES128-CBC(key=input_key,

[0120] mode=aes_encrypt,

[0121] input=OTA_data_plain,

[0122] iv = iv_encrypt);

[0123] Among them, OTA_data_encrypt is the encryption result of the over-the-air download technology data; key is the key preset in the device; iv_encrypt is the initial vector used for encryption; aes_encrypt is an encryption mode; OTA_data_plain is the compiled data of the over-the-air download technology; AES128-CBC is a symmetric encryption algorithm.

[0124] In an exemplary embodiment of the present disclosure, a key and an initial vector are obtained from a read-protected area of ​​the device to be upgraded, a key for encryption is input into the AES128-CBC encryption algorithm, the mode is set to aes_encrypt, the download technology compilation data is input, the initial vector is set to the initial vector for encryption, and an encryption result of the over-the-air download technology data is generated.

[0125] Decryption process:

[0126] Get the preset encryption key and IV from efuse, and perform AES128-CBC decryption on the OTA ciphertext data

[0127] OTA_data_plain_2=AES128-CBC(key=output_key,

[0128] mode = aes_decrypt,

[0129] input=OTA_data_encrypt,

[0130] iv = iv_decrypt);

[0131] Among them, OTA_data_plain_2 is the decryption result of the air download technology data; key is the key preset in the device, iv_decrypt is the initial vector used for decryption; aes_encrypt is an encryption mode; OTA_data_encrypt is the encryption result of the air download technology; decrypt is the decryption result.

[0132] In an exemplary embodiment of the present disclosure, a key and an initial vector are obtained from a read-protected area of ​​the device to be upgraded, a key for decryption is input into the AES128-CBC encryption algorithm, the mode is set to aes_decrypt, an over-the-air technical data decryption result is input, and the initial vector is set to the initial vector for decryption.

[0133] In the disclosed embodiment, secure storage of firmware encryption keys is achieved based on a read protection mechanism for the area in the device that stores encryption keys and initial vectors. Secure boot at the device system level is also added, and the complete link ensures key security. The firmware is encrypted and packaged using the AES128-CBC symmetric encryption algorithm and encryption algorithms such as keys and initial vectors stored in the read protection area of ​​the device, and the firmware upgrade package is decrypted, downloaded, and installed during a remote device upgrade based on over-the-air download technology. The risk of firmware leakage and decompilation can be prevented, as well as the leakage of sensitive information and malicious attacks on tampered firmware, thereby protecting the security of the device information and user data of the device.

[0134] Based on the same concept, the embodiment of the present disclosure also provides a device upgrading apparatus 100 .

[0135] It is understandable that the device upgrade apparatus 100 provided in the embodiment of the present disclosure includes hardware structures and / or software modules corresponding to the execution of each function in order to realize the above functions. In combination with the units and algorithm steps of each example disclosed in the embodiment of the present disclosure, the embodiment of the present disclosure 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. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present disclosure.

[0136] Fig.12 FIG. 1 is a block diagram of a device upgrading apparatus 100 according to an exemplary embodiment. Fig.12 The device 100 includes an acquisition unit 101, a processing unit 102 and an installation unit 103.

[0137] The acquisition unit 101 is configured to acquire a firmware upgrade package for upgrading a device, where the firmware upgrade package is encrypted based on a key and an initial vector preset in the device.

[0138] The processing unit 102 is configured to decrypt the firmware upgrade package based on a key and an initialization vector preset in the device.

[0139] The installation unit 103 is configured to install the decrypted firmware upgrade package in response to the decryption success, so as to upgrade the device.

[0140] In one implementation, the key and the initial vector are stored in a storage area with a read protection function in the device; before decrypting the firmware upgrade package based on the key and initial vector preset in the device, the processing unit 102 is also used to: obtain the key and the initial vector from the storage area with a read protection function.

[0141] In one embodiment, the firmware upgrade package is encrypted based on a key and an initial vector preset in the device in the following manner: obtaining a key and an initial vector preset in the device; in response to the number of the firmware upgrade packages being multiple, encrypting the multiple firmware upgrade packages separately using the same key and initial vector.

[0142] In one implementation, before obtaining the key and the initial vector from the storage area with a read protection function, the processing unit 102 is further configured to: verify the firmware upgrade package and determine whether the firmware upgrade package is successfully verified.

[0143] In one implementation, the processing unit 102 is further configured to: in response to a failure in verifying the firmware upgrade package, prohibit obtaining the key and the initial vector from the storage area with a read protection function.

[0144] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0145] Fig.13 2 is a block diagram of an apparatus 200 for device upgrade according to an exemplary embodiment. The apparatus 200 may be provided as a terminal. For example, the apparatus 200 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0146] Reference Fig.13 , the device 200 may include one or more of the following components: a processing component 202 , a memory 204 , a power component 206 , a multimedia component 208 , an audio component 210 , an input / output (I / O) interface 212 , a sensor component 214 , and a communication component 216 .

[0147] The processing component 202 generally controls the overall operation of the device 200, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 202 may include one or more modules to facilitate interaction between the processing component 202 and other components. For example, the processing component 202 may include a multimedia module to facilitate interaction between the multimedia component 208 and the processing component 202.

[0148] The memory 204 is configured to store various types of data to support operations on the device 200. Examples of such data include instructions for any application or method operating on the device 200, contact data, phone book data, messages, pictures, videos, etc. The memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0149] The power component 206 provides power to the various components of the device 200. The power component 206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 200.

[0150] The multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 208 includes a front camera and / or a rear camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0151] The audio component 210 is configured to output and / or input audio signals. For example, the audio component 210 includes a microphone (MIC), and when the device 200 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 204 or sent via the communication component 216. In some embodiments, the audio component 210 also includes a speaker for outputting audio signals.

[0152] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0153] The sensor assembly 214 includes one or more sensors for providing various aspects of the status assessment of the device 200. For example, the sensor assembly 214 can detect the open / closed state of the device 200, the relative positioning of components, such as the display and keypad of the device 200, the sensor assembly 214 can also detect the position change of the device 200 or a component of the device 200, the presence or absence of user contact with the device 200, the orientation or acceleration / deceleration of the device 200 and the temperature change of the device 200. The sensor assembly 214 can include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 214 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 214 can also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.

[0154] The communication component 216 is configured to facilitate wired or wireless communication between the device 200 and other devices. The device 200 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 216 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0155] In an exemplary embodiment, the apparatus 200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0156] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, and the instructions can be executed by the processor 220 of the device 200 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0157] It is to be understood that in the present disclosure, "plurality" refers to two or more than two, and other quantifiers are similar. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The singular forms "a", "the" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings.

[0158] It is further understood that the terms "first", "second", etc. are used to describe various information, but such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and do not indicate a specific order or degree of importance. In fact, the expressions "first", "second", etc. can be used interchangeably. For example, without departing from the scope of the present disclosure, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information.

[0159] It can be further understood that, unless otherwise specified, “connection” includes a direct connection without other components between the two, and also includes an indirect connection with other components between the two.

[0160] It is further understood that, although the operations are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood as requiring that the operations be performed in the specific order shown or in a serial order, or requiring that all the operations shown be performed to obtain the desired results. In certain environments, multiple people and parallel processing may be advantageous.

[0161] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.

[0162] It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the scope of the appended claims.

Claims

1. A device upgrade method, It is characterized in that include: Obtaining a firmware upgrade package for upgrading a device, wherein the firmware upgrade package is encrypted based on a key and an initial vector preset in the device; Decrypting the firmware upgrade package based on the key and initialization vector preset in the device; In response to the decryption being successful, the decrypted firmware upgrade package is installed to upgrade the device.

2. The method according to claim 1, It is characterized in that The key and the initial vector are stored in a storage area with a read protection function in the device; Based on the key and initial vector preset in the device, before decrypting the firmware upgrade package, the method further includes: The key and the initial vector are obtained from the storage area with a read protection function.

3. The method according to claim 1 or 2, It is characterized in that The firmware upgrade package is encrypted based on the key and initial vector preset in the device in the following manner: Obtaining a key and an initialization vector preset in the device; In response to the number of the firmware upgrade packages being multiple, the multiple firmware upgrade packages are encrypted respectively using the same key and initial vector.

4. The method according to claim 2, It is characterized in that Before obtaining the key and the initial vector from the storage area with a read protection function, the method further includes: The firmware upgrade package is verified, and it is determined that the verification of the firmware upgrade package is successful.

5. The method according to claim 4, It is characterized in that The method further comprises: In response to a failure in verifying the firmware upgrade package, obtaining the key and the initial vector from the storage area with a read protection function is prohibited.

6. A device upgrade device, It is characterized in that include: An acquisition unit, used to acquire a firmware upgrade package used to upgrade the device, wherein the firmware upgrade package is encrypted based on a key and an initial vector preset in the device; A processing unit, configured to decrypt the firmware upgrade package based on a key and an initialization vector preset in the device; The installation unit is used for installing the firmware upgrade package obtained by decryption in response to the decryption being successful, so as to upgrade the device.

7. The device according to claim 6, It is characterized in that The key and the initial vector are stored in a storage area with a read protection function in the device; The processing unit is further used to: before decrypting the firmware upgrade package based on the key and initial vector preset in the device: The key and the initial vector are obtained from the storage area with a read protection function.

8. The device according to claim 6 or 7, It is characterized in that The firmware upgrade package is encrypted based on the key and initial vector preset in the device in the following manner: Obtaining a key and an initialization vector preset in the device; In response to the number of the firmware upgrade packages being multiple, the multiple firmware upgrade packages are encrypted respectively using the same key and initial vector.

9. The device according to claim 7, It is characterized in that Before the processing unit obtains the key and the initial vector from the storage area with the read protection function, the processing unit is further configured to: The firmware upgrade package is verified, and it is determined that the verification of the firmware upgrade package is successful.

10. The device according to claim 9, It is characterized in that The processing unit is also used for: In response to a failure in verifying the firmware upgrade package, obtaining the key and the initial vector from the storage area with a read protection function is prohibited.

11. A device upgrade device, It is characterized in that include: processor: a memory for storing processor-executable instructions; Wherein, the processor is configured to: execute the device upgrading method according to any one of claims 1 to 5.

12. A storage medium, It is characterized in that The storage medium stores instructions, and when the instructions in the storage medium are executed by a processor, the processor is enabled to execute the device upgrading method according to any one of claims 1 to 5.