CN113672272A - Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment - Google Patents

Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment Download PDF

Info

Publication number
CN113672272A
CN113672272A CN202110994054.4A CN202110994054A CN113672272A CN 113672272 A CN113672272 A CN 113672272A CN 202110994054 A CN202110994054 A CN 202110994054A CN 113672272 A CN113672272 A CN 113672272A
Authority
CN
China
Prior art keywords
patch library
function
application program
upgrading
patch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110994054.4A
Other languages
Chinese (zh)
Inventor
汤福
李业旺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Datang Gaohong Xin'an Zhejiang Information Technology Co ltd
Original Assignee
Datang Gaohong Xin'an Zhejiang Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Datang Gaohong Xin'an Zhejiang Information Technology Co ltd filed Critical Datang Gaohong Xin'an Zhejiang Information Technology Co ltd
Priority to CN202110994054.4A priority Critical patent/CN113672272A/en
Publication of CN113672272A publication Critical patent/CN113672272A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/105Arrangements for software license management or administration, e.g. for managing licenses at corporate level

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a dynamic application program upgrading method, a dynamic application program upgrading generation method, a dynamic application program upgrading device and electronic equipment, and relates to the technical field of computers, wherein the dynamic application program upgrading method comprises the following steps: under the condition that an upgrading signal is received in the running process of a target application program, a patch library in a target position is read; verifying whether the source of the patch library is trusted; under the condition that the source of the patch library is credible, dynamically upgrading the target application program according to the patch library; after the target application program is dynamically upgraded, when a first function is called for the first time, whether a patch library in a memory is credible is verified; and under the condition that a patch library in the memory is credible, calling the first function, wherein the first function is the function of the target application program updated according to the patch library. The scheme of the application realizes the credible dynamic upgrade of the application program, and ensures the safety and credibility in the upgrade process and after upgrade.

Description

Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, a device, and an electronic device for dynamically upgrading an application.
Background
With the development of information technology, application service providers provide various characteristic services for people. Some service providers such as game service providers, mail service providers, internet service providers, cloud service providers and the like need to provide uninterrupted service for 24 hours, and most application services have requirements on periodic maintenance, background service upgrade, repair of BUGs and defects and the like. Taking game service as an example, a new game often has some problems at the initial stage of online, and the repairing mode is often service restarting, which affects user experience and also affects operation data of the game.
For an Update method of an uninterruptible application service, currently, there are many hot patches in the market, such as Over The Air (OTA), online Update (Live Update), and other technologies to implement dynamic Update of the application service. However, these techniques often have certain security defects, and cannot ensure the security and reliability of the code.
Disclosure of Invention
The application aims to provide a method, a device and an electronic device for dynamically upgrading an application program, so that the safety and reliability of application program upgrading in the prior art are improved.
In a first aspect, an embodiment of the present application provides a method for dynamically upgrading an application program, including:
under the condition that an upgrading signal is received in the running process of a target application program, a patch library in a target position is read;
verifying whether the source of the patch library is trusted;
under the condition that the source of the patch library is credible, dynamically upgrading the target application program according to the patch library;
after the target application program is dynamically upgraded, when a first function is called for the first time, whether a patch library in a memory is credible is verified;
and under the condition that a patch library in the memory is credible, calling the first function, wherein the first function is the function of the target application program updated according to the patch library.
Optionally, verifying whether the source of the read patch library is trusted includes:
analyzing the patch library to obtain a signature value in the patch library;
decrypting the signature value by using a built-in public key to obtain a first characteristic value;
calculating a second characteristic value of the patch library;
and under the condition that the first characteristic value is consistent with the second characteristic value, determining that the source of the patch library is credible, and storing the first characteristic value in a safe storage area.
Optionally, verifying whether the patch library in the memory is trusted includes:
calculating a third characteristic value of the patch library based on the starting address and the length of the patch library in the internal memory;
and determining that the patch library in the memory is credible under the condition that the third characteristic value is determined to be consistent with the first characteristic value stored in the safe memory area.
Optionally, dynamically upgrading the target application according to the patch library, including:
displaying and loading the patch library;
acquiring a dynamic updating function address in the patch library;
and dynamically upgrading the target application program by calling the dynamic updating function corresponding to the dynamic updating function address.
Optionally, the dynamically updating the target application program by calling a dynamically updating function corresponding to the dynamically updating function address includes:
dynamically searching a source function address and a target function address corresponding to the source function address in the dynamic updating function;
and under the condition that the original function corresponding to the original function address is not called, dynamically updating the original function address into the target function address.
In a second aspect, an embodiment of the present application further provides an application generating method, including:
generating a patch library for upgrading the application program;
and presetting a callback function in the code of the application program according to a preset interface specification, wherein the callback function is used for reading the patch library.
Optionally, generating a patch library for upgrading an application program includes:
setting a dynamic updating function according to the preset interface specification, wherein the dynamic updating function comprises the corresponding relation between the original function address and the target function address;
compiling the patch library;
and signing the characteristic value of the patch library to generate a signature value, wherein the signature value is used for verifying whether the source of the patch library is credible.
Optionally, signing the feature value of the patch library to generate a signature value includes:
carrying out private key signature on the characteristic value of the patch library by using a signature tool to generate a signature value;
writing the signature value into an executable linkable file format (ELF) portion of the patch library.
Optionally, the method further comprises:
and setting a signal processing function in the code of the application program, wherein the signal processing function is used for calling the callback function when an upgrading signal is received.
In a third aspect, an embodiment of the present application further provides an electronic device, including: comprising a transceiver, a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the method for dynamically upgrading an application program according to the first aspect or the method for generating an application program according to the second aspect when executing the computer program.
In a fourth aspect, an embodiment of the present application further provides an apparatus for dynamically upgrading an application program, including:
the reading module is used for reading the patch library in the target position under the condition that the upgrading signal is received in the running process of the target application program;
the first verification module is used for verifying whether the source of the patch library is credible;
the upgrading module is used for dynamically upgrading the target application program according to the patch library under the condition that the source of the patch library is credible;
the second verification module is used for verifying whether a patch library in a memory is credible or not when the first function is called for the first time after the target application program is dynamically upgraded;
and the calling module is used for calling the first function under the condition that a patch library in the memory is credible, wherein the first function is a function updated by the target application program according to the patch library.
In a fifth aspect, an embodiment of the present application further provides an application generating apparatus, including:
the generation module is used for generating a patch library for upgrading the application program;
the first setting module is used for presetting a callback function in the code of the application program according to a preset interface specification, and the callback function is used for reading the patch library.
In a sixth aspect, embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for dynamically upgrading an application program according to the first aspect, or the method for generating an application program according to the second aspect.
The above technical scheme of this application has following beneficial effect at least:
the method for dynamically upgrading the application program comprises the steps of firstly, reading a patch library in a target position under the condition that an upgrading signal is received in the running process of the target application program; secondly, verifying whether the source of the patch library is credible; thirdly, under the condition that the source of the patch library is credible, dynamically upgrading the target application program according to the patch library; therefore, credible dynamic upgrading is realized on the premise of not interrupting the target application program, and the safety of the upgrading process is ensured; then, after the target application program is dynamically upgraded, when a first function is called for the first time, whether a patch library in a memory is credible is verified; and finally, under the condition that a patch library in the internal memory is credible, calling the first function, wherein the first function is the function of the target application program updated according to the patch library. Therefore, the credibility of the patch library in the internal memory is verified before the updated function is called for the first time, the phenomenon that the patch library is illegally replaced after the source of the patch library is verified to be credible in the upgrading process is avoided, and the safety and the reliability after upgrading are ensured.
Drawings
Fig. 1 is a schematic flowchart of a method for dynamically upgrading an application according to an embodiment of the present application;
FIG. 2 is a second flowchart illustrating a method for dynamically upgrading an application according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating an application generation method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an application dynamic upgrade apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an application generating apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
To make the technical problems, technical solutions and advantages to be solved by the present application clearer, the following detailed description is made with reference to the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help the embodiments of the present application be fully understood. Accordingly, it will be apparent to those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. In addition, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In various embodiments of the present application, it should be understood that the sequence numbers of the following processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
In the embodiments provided herein, it should be understood that "B corresponding to a" means that B is associated with a from which B can be determined. It should also be understood that determining B from a does not mean determining B from a alone, but may be determined from a and/or other information.
As shown in fig. 1, which is a schematic flow diagram of an application program dynamic upgrade method according to an embodiment of the present application, the method includes:
step 101, reading a patch library at a target position under the condition that an upgrading signal is received in the running process of a target application program;
in this step, the upgrade signal may be sent by a third-party application program, where the third-party application program may be software developed by a user to upgrade the application program, and when the application program needs to be upgraded, the upgrade signal is sent to the application program that needs to be upgraded through the third-party application program.
102, verifying whether the source of the patch library is trusted;
here, it should be noted that, in the process of making the patch library, the relevant content of the patch library may be signed by a private key, so that the target application may decrypt the signature to determine whether the source of the patch library is trusted.
And 103, under the condition that the source of the patch library is credible, dynamically upgrading the target application program according to the patch library.
104, after the target application program is dynamically upgraded, when a first function is called for the first time, verifying whether a patch library in a memory is trusted;
in this step, after the target application program is upgraded, before the updated function is called for the first time, the credibility of the patch library mapped into the memory needs to be verified, so that after the source of the patch library is verified in the upgrading process, a hacker maliciously replaces the credible patch library in the source, and the safety and reliability of the upgraded target application program are ensured.
And 105, under the condition that a patch library in the memory is credible, calling the first function, wherein the first function is a function updated by the target application program according to the patch library.
In the method for dynamically upgrading the application program, firstly, under the condition that an upgrading signal is received in the running process of a target application program, a patch library in a target position is read; secondly, verifying whether the source of the patch library is credible; thirdly, under the condition that the source of the patch library is credible, dynamically upgrading the target application program according to the patch library; therefore, credible dynamic upgrading is realized on the premise of not interrupting the target application program, and the safety of the upgrading process is ensured; then, after the target application program is dynamically upgraded, when a first function is called for the first time, whether a patch library in a memory is credible is verified; and finally, under the condition that a patch library in the internal memory is credible, calling the first function, wherein the first function is the function of the target application program updated according to the patch library. Therefore, the credibility of the patch library in the internal memory is verified before the updated function is called for the first time, the phenomenon that the patch library is illegally replaced after the source of the patch library is verified to be credible in the upgrading process is avoided, and the safety and the reliability after upgrading are ensured.
Here, it should be noted that, in step 101, when an upgrade signal is received in the running process of the target application program, reading the patch library in the target location may specifically be:
after receiving an upgrading signal, responding to the upgrading signal, and reading a patch library in a target position by calling a callback function preset in the target application program;
specifically, in this step, after receiving the upgrade signal, a callback function is called by using a set processing function of the upgrade signal to read the patch library in the target location, where the callback function may be trust _ update _ func (), and the callback function is preset in the code of the target application program according to a uniform interface specification.
Here, it should be noted that after the patch library is manufactured, the patch library is placed in a specified directory, so that the target application can read the patch library in a predetermined directory; the patch library may be a dynamically loadable patch library.
As an alternative implementation, step 103, verifying whether the source of the read patch library is trusted includes:
analyzing the patch library to obtain a signature value in the patch library;
in this step, the signature value may be obtained from an analysis result of an Executable and Linkable Format (ELF) portion (section) of the patch library; the signature value may be obtained by performing private key signature on the feature value of the patch library by using a signature tool in the process of making the patch library, and specifically, the feature value of the patch library is a hash value calculated according to a patch library file.
Decrypting the signature value by using a built-in public key to obtain a first characteristic value;
calculating a second characteristic value of the patch library; the step specifically includes reading a patch library file from the hard disk and calculating a hash value of the patch library.
And under the condition that the first characteristic value is consistent with the second characteristic value, determining that the source of the patch library is credible, and storing the first characteristic value in a safe storage area.
In this step, if the first characteristic value is consistent with the second characteristic value, it is determined that the signature value of the patch library is successfully verified, that is, the source of the patch library is trusted;
when the first characteristic value is determined to be consistent with the second characteristic value, the source of the patch library is determined to be credible, so that the first characteristic value obtained by analyzing the signature value can be stored in the safe storage area, and the patch library is ensured not to be illegally replaced when a function updated in the upgrading process is called for the first time, and the safety and the reliability of the target application program after upgrading are ensured.
In the optional implementation manner, the first characteristic value obtained by analyzing the signature value is compared with the second characteristic value calculated according to the patch library acquired from the hard disk to determine whether the source of the patch library is trusted, so that the source of the patch library can be ensured to be trusted, and the safety and reliability of the target application program in the upgrading process are ensured.
Further, as an optional implementation, verifying whether the patch library in the memory is trusted includes:
calculating a third characteristic value of the patch library based on the starting address and the length of the patch library in the internal memory;
here, it should be noted that, after the target application is upgraded, the patch library is mapped into the memory by the target application, so that when the first function updated in the upgrading process is called for the first time, the hash value (third feature value) of the patch library can be calculated by obtaining the start address and length of the memory mapping of the patch library.
And determining that the patch library in the memory is credible under the condition that the third characteristic value is determined to be consistent with the first characteristic value stored in the safe memory area.
In this optional implementation, when it is determined that the third eigenvalue is consistent with the first eigenvalue stored in the secure storage area, it is determined that the patch library of the memory mapping is the same as the patch library of the target application program when the target application program is upgraded, and thus it can be determined that the patch library is not illegally replaced after the source of the patch library is verified to be legal, and thus, the security and reliability of the target application program in the upgrading process and after upgrading can be ensured.
As an optional implementation manner, step 104, dynamically upgrading the target application according to the patch library, includes:
displaying and loading the patch library; the step can be specifically that a patch library is loaded by calling a dlopen function display;
acquiring a dynamic updating function address in the patch library;
and dynamically upgrading the target application program by calling the dynamic updating function corresponding to the dynamic updating function address.
In this step, the dynamic update function may be identified as dynamic _ update; the dynamic _ update function enumerates new and old function names to be replaced and new function code implementation, and the target application program realizes dynamic replacement of the new and old functions by calling the dynamic _ update function in the patch library, so that dynamic upgrade of the target application program is realized.
As a specific implementation manner, the dynamically updating the target application program by calling the dynamic update function corresponding to the dynamic update function address includes:
dynamically searching a source function address and a target function address corresponding to the source function address in the dynamic updating function;
and under the condition that the original function corresponding to the original function address is not called, dynamically updating the original function address into the target function address.
In this specific implementation manner, the original function address is dynamically updated to the target function address only when the original function corresponding to the original function address is not called, so that the dynamic update of the function is implemented on the premise that the target application program is not interrupted.
The following describes a process of the application program dynamic upgrade method according to the embodiment of the present application with reference to fig. 2:
step 201: receiving a USER1 signal sent by a third-party application program, namely receiving an upgrading signal sent by the third-party application program;
step 202, reading a patch library at a target position by using a callback function trust _ update _ func () of a set signal processing function call threshold;
step 203, analyzing the patch library to obtain a signature value;
step 204, verifying the characteristic value obtained by decrypting the signature value; that is, the signature value obtained by decrypting the signature value is compared with the signature value calculated according to the patch library so as to verify the signature value obtained by decrypting the signature value; if the verification is successful, go to step 206, if the verification fails, go to step 205;
step 205, terminate upgrading;
step 206, calling a dlopen function to display and load a patch library, and storing a characteristic value obtained by decryption in a safe storage area;
step 207, finding the address of the update function dynamic _ update () in the patch library;
step 208, calling dynamic _ update () to replace the new function and the old function, and finishing the upgrading of the application program;
step 209, before calling the new function, calculating a feature value of the patch library according to the initial address and the length of the patch library mapped in the internal memory;
step 210, comparing whether the calculated characteristic value is consistent with the characteristic value stored in the safe storage area, if so, executing step 211, and if not, executing step 212;
step 211, call a new function;
at step 212, the call to the new function is disabled.
The method for dynamically upgrading the application program comprises the steps of firstly, reading a patch library at a target position under the condition that an upgrading signal is received in the running process of the target application program, and secondly, verifying whether the source of the patch library is credible; thirdly, under the condition that the source of the patch library is credible, the target application program is dynamically upgraded according to the patch library, therefore, the function in the target application program can be dynamically replaced on the premise of not interrupting the running of the application program, the safety and the reliability in the replacement process are ensured by combining the trusted computing technology, and then, after the application program is upgraded, when the updated function is called for the first time, calculating a characteristic value according to the initial address and the length of the patch library obtained from the internal memory and comparing the characteristic value with the characteristic value stored in the safe storage area to verify the credibility of the patch library for the second time, and finally, and under the condition that a patch library in the memory is credible, calling the first function, wherein the first function is the function of the target application program updated according to the patch library, so that the reliability and the safety of the application program after being upgraded are ensured. Finally, safe and reliable upgrading of the application program is achieved in a simple, safe and reliable mode without any influence on the performance of the system, and the method can be widely applied to multiple fields of network servers, industrial control, computing, data centers and the like.
As shown in fig. 3, an embodiment of the present application further provides an application generating method, including:
step 301, generating a patch library for upgrading an application program; in this step, the patch library is a dynamically linkable patch library;
step 302, presetting a callback function in the code of the application program according to a preset interface specification, wherein the callback function is used for reading the patch library.
According to the application program generation method, firstly, a patch library used for upgrading the application program is generated, and then a callback function used for reading the patch library is preset in the code of the application program according to the preset interface specification, so that the patch library can be read on the premise of not interrupting the application program, and the dynamic upgrading of the application program is realized.
Here, it should be noted that the preset interface specification is a rule that the preset application program and the patch library both need to follow, for example, the preset interface specification may include a storage location of the patch library, specific parameters transferred by a callback function of the application program, and the like, but not limited thereto, and by making both the application program and the patch library meet the requirements of the preset interface specification, the application program can be safely upgraded without interruption based on the patch library.
As an optional implementation manner, step 301, generating a patch library for upgrading an application program includes:
setting a dynamic updating function according to the preset interface specification, wherein the dynamic updating function comprises the corresponding relation between the original function address and the target function address; that is, the development of the patch library must implement dynamic update of the function dynamic _ update () according to the unified interface specification, and implement dynamic lookup and replacement of function addresses such as functions funcA to new _ funcA, funcB to new _ funcB, and funcC to new _ funcC … … in the target application program in the function dynamic _ update ();
compiling the patch library; so, compiling the code of the patch library into a patch library patch which can be dynamically loaded;
and signing the characteristic value of the patch library to generate a signature value, wherein the signature value is used for verifying whether the source of the patch library is credible.
In the optional implementation mode, the signature is carried out on the characteristic value in the process of generating the patch library, so that the characteristic value of the patch library is obtained based on the analysis of the signature in the upgrading process and after the upgrading of the application program, whether the source of the patch library is credible or not is verified, and the safety and the reliability in the upgrading process and after the upgrading of the application program are ensured.
Here, after the patch library is generated, the patch library is placed in a specified directory, so that the application program can read the patch library in the specified directory according to a predetermined convention to upgrade the application program.
As a specific implementation, signing the feature value of the patch library to generate a signature value includes:
carrying out private key signature on the characteristic value of the patch library by using a signature tool to generate a signature value;
writing the signature value into an executable linkable file format (ELF) portion of the patch library.
Further, as an optional implementation manner, the method further includes:
and setting a signal processing function in the code of the application program, wherein the signal processing function is used for calling the callback function when an upgrading signal is received.
By setting the processing function in the application program, the preset callback function is called through the set signal processing function after the application program receives the upgrading signal, the patch library at the target position is read, and the target application program is dynamically upgraded.
As shown in fig. 4, an embodiment of the present application further provides an apparatus for dynamically upgrading an application program, including:
a reading module 401, configured to read a patch library in a target location when an upgrade signal is received in an operation process of a target application;
a first verification module 402, configured to verify whether a source of the patch library is trusted;
the upgrading module 403 is configured to, under the condition that the source of the patch library is trusted, dynamically upgrade the target application program according to the patch library;
a second verification module 404, configured to verify whether a patch library in a memory is trusted when the first function is called for the first time after the target application program is dynamically upgraded;
the calling module 405 is configured to call the first function under the condition that the patch library in the memory is trusted, where the first function is a function updated by the target application program according to the patch library.
In the application program dynamic upgrade device according to the embodiment of the application program, first, the reading module 401 reads a patch library in a target position when receiving an upgrade signal in the running process of a target application program; secondly, the first verification module 402 verifies whether the source of the patch library is trusted; thirdly, the upgrading module 403 dynamically upgrades the target application program according to the patch library under the condition that the source of the patch library is trusted, so that trusted dynamic upgrading of the target application program is realized on the premise of not interrupting the target application program, and the safety of the upgrading process is ensured; then, after the target application program is dynamically upgraded, when the first function is called for the first time, the second verification module 404 verifies whether the patch library in the memory is trusted, and finally, the calling module 405 calls the first function under the condition that the patch library in the memory is trusted, wherein the first function is a function updated by the target application program according to the patch library, so that the credibility of the patch library in the memory is verified before the updated function is called for the first time, the phenomenon that the patch library is illegally replaced after the source of the patch library is verified to be trusted in the upgrading process is avoided, and the safety and the reliability after upgrading are ensured.
Optionally, the first authentication module 403 includes:
the first obtaining submodule is used for analyzing the patch library to obtain a signature value in the patch library;
the second obtaining submodule is used for decrypting the signature value by using a built-in public key to obtain a first characteristic value;
the calculation submodule is used for calculating a second characteristic value of the patch library;
and the determining submodule is used for determining that the source of the patch library is credible under the condition that the first characteristic value is consistent with the second characteristic value, and storing the first characteristic value in a safe storage area.
Optionally, the second verification module 404 includes:
calculating a third characteristic value of the patch library based on the starting address and the length of the patch library in the internal memory;
and determining that the patch library in the memory is credible under the condition that the third characteristic value is determined to be consistent with the first characteristic value stored in the safe memory area.
The calculation submodule is used for calculating a third characteristic value of the patch library based on the starting address and the length of the patch library in the internal memory;
and the determining submodule is used for determining that the patch library in the memory is credible under the condition that the third characteristic value is determined to be consistent with the first characteristic value stored in the secure storage area.
Optionally, the upgrade module 404 includes:
the loading submodule is used for displaying and loading the patch library;
a third obtaining submodule, configured to obtain a dynamically updated function address in the patch library;
and the upgrading submodule is used for dynamically upgrading the target application program by calling the dynamic updating function corresponding to the dynamic updating function address.
Optionally, the upgrade submodule includes:
the searching unit is used for dynamically searching a source function address and a target function address corresponding to the source function address in the dynamic updating function;
and the updating unit is used for dynamically updating the original function address into the target function address under the condition that the original function corresponding to the original function address is not called.
As shown in fig. 5, an embodiment of the present application further provides an application generating apparatus, including:
a generating module 501, configured to generate a patch library for upgrading an application;
the first setting module 502 is configured to preset a callback function in a code of an application program according to a preset interface specification, where the callback function is used to read the patch library.
In the application generation apparatus according to the embodiment of the application, first, the generation module 501 generates a patch library for upgrading an application, and then, the first setting module 502 presets a callback function for reading the patch library in a code of the application according to a preset interface specification, so that the patch library can be read on the premise of not interrupting the application, and dynamic upgrade of the application is realized.
Optionally, the generating module 501 includes:
the setting submodule is used for setting a dynamic updating function according to the preset interface specification, and the dynamic updating function comprises a corresponding relation between an original function address and a target function address;
the compiling module is used for compiling the patch library;
and the generation submodule is used for signing the characteristic value of the patch library to generate a signature value, and the signature value is used for verifying whether the source of the patch library is credible or not.
Optionally, the generating sub-module includes:
the generating unit is used for carrying out private key signature on the characteristic value of the patch library by using a signature tool to generate the signature value;
a writing unit for writing the signature value into an executable linkable file format (ELF) part of the patch library.
Further, the apparatus further comprises:
and the second setting module is used for setting a signal processing function in the code of the application program, and the signal processing function is used for calling the callback function when an upgrading signal is received.
As shown in fig. 6, an embodiment of the present application further provides an electronic device, including: the application program dynamic upgrade method includes a transceiver 610, a memory 620, a processor 600, and a computer program stored in the memory 620 and running on the processor 600, where the processor 600 implements the processes of the embodiment of the application program dynamic upgrade method and can achieve the same technical effect when executing the computer program, or implements the processes of the embodiment of the application program generation method and can achieve the same technical effect, and therefore, details are not described here to avoid repetition.
Where in fig. 6, the bus architecture may include any number of interconnected buses and bridges, with various circuits being linked together, particularly one or more processors represented by processor 600 and memory represented by memory 620. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface. The transceiver 610 may be a number of elements including a transmitter and a transceiver providing a means for communicating with various other apparatus over a transmission medium. For different terminals, the user interface 630 may also be an interface capable of interfacing with a desired device, including but not limited to a keypad, display, speaker, microphone, joystick, etc. The processor 600 is responsible for managing the bus architecture and general processing, and the memory 620 may store data used by the processor 600 in performing operations.
Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be performed by hardware, or may be instructed to be performed by associated hardware by a computer program that includes instructions for performing some or all of the steps of the above methods; and the computer program may be stored in a readable storage medium, which may be any form of storage medium.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a program is stored on the computer-readable storage medium, and when the program is executed by a processor, the process of the embodiment of the method for dynamically upgrading an application program as described above is implemented, or the process of the embodiment of the method for generating an application program as described above can achieve the same technical effect, and in order to avoid repetition, details are not described here again. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Furthermore, it should be noted that in the apparatus and method of the present application, it is apparent that the components or steps may be disassembled and/or recombined. These decompositions and/or recombinations are to be considered as equivalents of the present application. Also, the steps of performing the above-described series of processes may naturally be performed in the order described or in chronological order, but need not necessarily be performed in chronological order, and some steps may be performed in parallel or independently of each other. It will be understood by those of ordinary skill in the art that all or any of the steps or elements of the methods and apparatus of the present application may be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or any combination thereof, which can be implemented by those of ordinary skill in the art using their basic programming skills after reading the description of the present application.
The object of the present application can thus also be achieved by running a program or a set of programs on any computing device. The computing device may be a general purpose device as is well known. The object of the application can thus also be achieved merely by providing a program product comprising program code for implementing the method or the apparatus. That is, such a program product also constitutes the present application, and a storage medium storing such a program product can also constitute the present application. It is to be understood that the storage medium may be any known storage medium or any storage medium developed in the future.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing is a preferred embodiment of the present application, and it should be noted that, for those skilled in the art, several modifications and refinements can be made without departing from the principle described in the present application, and these modifications and refinements should be regarded as the protection scope of the present application.

Claims (13)

1. A method for dynamically upgrading an application program is characterized by comprising the following steps:
under the condition that an upgrading signal is received in the running process of a target application program, a patch library in a target position is read;
verifying whether the source of the patch library is trusted;
under the condition that the source of the patch library is credible, dynamically upgrading the target application program according to the patch library;
after the target application program is dynamically upgraded, when a first function is called for the first time, whether a patch library in a memory is credible is verified;
and under the condition that a patch library in the memory is credible, calling the first function, wherein the first function is the function of the target application program updated according to the patch library.
2. The method of claim 1, wherein verifying that the source of the read patch library is trusted comprises:
analyzing the patch library to obtain a signature value in the patch library;
decrypting the signature value by using a built-in public key to obtain a first characteristic value;
calculating a second characteristic value of the patch library;
and under the condition that the first characteristic value is consistent with the second characteristic value, determining that the source of the patch library is credible, and storing the first characteristic value in a safe storage area.
3. The method of claim 2, wherein verifying that the patch library in memory is authentic comprises:
calculating a third characteristic value of the patch library based on the starting address and the length of the patch library in the internal memory;
and determining that the patch library in the memory is credible under the condition that the third characteristic value is determined to be consistent with the first characteristic value stored in the safe memory area.
4. The method of claim 1, wherein dynamically upgrading the target application according to the patch library comprises:
displaying and loading the patch library;
acquiring a dynamic updating function address in the patch library;
and dynamically upgrading the target application program by calling the dynamic updating function corresponding to the dynamic updating function address.
5. The method of claim 4, wherein dynamically upgrading the target application by calling a dynamic update function corresponding to the address of the dynamic update function comprises:
dynamically searching a source function address and a target function address corresponding to the source function address in the dynamic updating function;
and under the condition that the original function corresponding to the original function address is not called, dynamically updating the original function address into the target function address.
6. An application generation method, comprising:
generating a patch library for upgrading the application program;
and presetting a callback function in the code of the application program according to a preset interface specification, wherein the callback function is used for reading the patch library.
7. The method of claim 6, wherein generating a patch library for upgrading an application comprises:
setting a dynamic updating function according to the preset interface specification, wherein the dynamic updating function comprises the corresponding relation between the original function address and the target function address;
compiling the patch library;
and signing the characteristic value of the patch library to generate a signature value, wherein the signature value is used for verifying whether the source of the patch library is credible.
8. The method of claim 7, wherein signing the feature value of the patch library to generate a signature value comprises:
carrying out private key signature on the characteristic value of the patch library by using a signature tool to generate a signature value;
writing the signature value into an executable linkable file format (ELF) portion of the patch library.
9. The method of claim 6, further comprising:
and setting a signal processing function in the code of the application program, wherein the signal processing function is used for calling the callback function when an upgrading signal is received.
10. An electronic device, comprising: comprising a transceiver, a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the method for dynamic application upgrade according to any one of claims 1 to 5 or the method for generating an application according to any one of claims 6 to 9 when executing the computer program.
11. An apparatus for dynamically upgrading an application, comprising:
the reading module is used for reading the patch library in the target position under the condition that the upgrading signal is received in the running process of the target application program;
the first verification module is used for verifying whether the source of the patch library is credible;
the upgrading module is used for dynamically upgrading the target application program according to the patch library under the condition that the source of the patch library is credible;
the second verification module is used for verifying whether a patch library in a memory is credible or not when the first function is called for the first time after the target application program is dynamically upgraded;
and the calling module is used for calling the first function under the condition that a patch library in the memory is credible, wherein the first function is a function updated by the target application program according to the patch library.
12. An application generation apparatus, comprising:
the generation module is used for generating a patch library for upgrading the application program;
the first setting module is used for presetting a callback function in the code of the application program according to a preset interface specification, and the callback function is used for reading the patch library.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method for dynamic application upgrade of any one of claims 1 to 5 or the method for generation of an application according to any one of claims 6 to 9.
CN202110994054.4A 2021-08-27 2021-08-27 Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment Pending CN113672272A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110994054.4A CN113672272A (en) 2021-08-27 2021-08-27 Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110994054.4A CN113672272A (en) 2021-08-27 2021-08-27 Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment

Publications (1)

Publication Number Publication Date
CN113672272A true CN113672272A (en) 2021-11-19

Family

ID=78546813

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110994054.4A Pending CN113672272A (en) 2021-08-27 2021-08-27 Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment

Country Status (1)

Country Link
CN (1) CN113672272A (en)

Similar Documents

Publication Publication Date Title
US20200220738A1 (en) System and method for interapplication communications
US9137023B1 (en) Self-signed certificates for computer application signatures
US8321949B1 (en) Managing software run in a computing system
US7552431B2 (en) Multiple patching in a single installation transaction
US8612398B2 (en) Clean store for operating system and software recovery
US8341616B2 (en) Updating digitally signed active content elements without losing attributes associated with an original signing user
US8250630B2 (en) Detecting unauthorized computer access
US9639700B2 (en) Unified extensible firmware interface (UEFI) database for secure bootstrap of a computer
EP1374039A2 (en) Client-side boot domains and boot rules
JP2010003235A (en) Secure boot with optional component method
JP2005182789A (en) Method and system for ensuring that software update may be installed or run only on specific device or class of devices
US10379894B1 (en) Lineage-based trust for virtual machine images
CA2951914C (en) Restricted code signing
US9298923B2 (en) Software revocation infrastructure
US11176224B2 (en) Security tool
US7747998B2 (en) Elevated patching
JP2021508880A (en) Terminal application management method, application server and terminal
US8074205B2 (en) Binary verification service
CN110795663B (en) Webpage loading method and equipment
CN113672272A (en) Application program dynamic upgrading method, application program dynamic upgrading device, application program dynamic generating method and electronic equipment
CN113536361B (en) Method and device for realizing trusted reference library and computing equipment
CN110162488A (en) Buffer consistency method of calibration, device, server and storage medium
US11687656B2 (en) Secure application development using distributed ledgers
US20220100859A1 (en) Remote management of devices
EP3143749B1 (en) Restricted code signing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination