Program running method, integrated circuit chip and related device
Through the calling mechanism of the application program and the preset program interface, the dual protection of the protection program is realized, which solves the problem of large integrated circuit chip area and high cost, reduces the risk of leakage of the protection program and avoids the need for additional processors.
Patent Information
- Application Number
- CN202010590321.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-24
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-06-24
AI Technical Summary
The existing technology requires an independent processor or control unit when protecting a program, resulting in a large integrated circuit area and high cost. It is difficult to reduce the chip area and cost while protecting the program.
The first default program interface is called by the application program. The first default program interface calls the second default program interface. The second default program interface directly calls the protection program and returns the protection program to the application program, using the first default program interface. The dual protection mechanism of the program and the second default program interface prevents the outside world from directly tracking and reading the protected program, and does not require encryption or decryption processing.
It is possible to reduce the integrated circuit chip area and cost while protecting the program, reduce the possibility of leakage of the protected program, and avoid the encryption and decryption processing of the protected program, thereby eliminating the need to set up an independent processor or control unit.
Smart Images

Figure CN113836497B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a program running method, an integrated circuit chip and related devices. Background Art
[0002] In the field of computer technology, integrated circuit manufacturers often hope that the core codes, confidential algorithms and other programs that need to be protected that they develop cannot be cracked by the outside world in order to maintain the market competitiveness of their products. At present, encryption and decryption are generally used to protect programs, that is, the program to be protected is first encrypted and then decrypted before the processor runs. However, this method requires an independent processor or control unit to complete the encryption and decryption process, so the number of processors or control units needs to be increased, resulting in a large integrated circuit area and high cost, which is not conducive to product promotion. In view of this, how to reduce the integrated circuit chip area and reduce costs while protecting the program has become an urgent problem to be solved. Summary of the invention
[0003] The main problem to be solved by the present invention is to provide a program running method, an integrated circuit chip and related devices, which can reduce the area of the integrated circuit chip and reduce the cost while protecting the program.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is to provide a program running method, which includes: the application calls a first preset program interface, wherein the application cannot directly access the protection program; the first preset program interface calls a second preset program interface, and the second preset program interface directly calls the protection program; the protection program is returned to the application, and the protection program is used to run the application.
[0005] To solve the above technical problem, another technical solution adopted by the present invention is to provide an integrated circuit chip, which includes a memory and a processor coupled to each other, the memory stores program instructions, and the processor executes the program instructions to implement the above program running method.
[0006] In order to solve the above technical problem, another technical solution adopted by the present invention is to provide a storage device storing program instructions that can be executed by a processor, and the program instructions are used to implement the above program running method.
[0007] Through the above scheme, the beneficial effect of the present invention is: the application is set to be unable to directly access the protection program, the application calls the first preset program interface, so that the first preset program interface calls the second preset program interface, the second preset program interface directly calls the protection program, and then returns the protection program to the application, and uses the protection program to run the application, so when running the application, the dual protection mechanism of the first preset program interface and the second preset program interface can be used, so that the outside world cannot directly track and read the protection program, which can help reduce the possibility of leakage of the protection program, and because there is no need to encrypt and decrypt the protection program, there is no need to set up an independent processor or control unit. Therefore, while protecting the program, the integrated circuit chip area can be reduced and the cost can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0009] Figure 1 It is a structural diagram of an embodiment of a program running method provided by the present invention;
[0010] Figure 2 It is a state diagram of an embodiment of a program running method provided by the present invention;
[0011] Figure 3 It is a flowchart of another embodiment of the program running method provided by the present invention;
[0012] Figure 4 It is a schematic diagram of the framework of an embodiment of an integrated circuit chip provided by the present invention;
[0013] Figure 5 It is a schematic diagram of the framework of an embodiment of a storage device provided by the present invention. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0015] See also Figure 1 , Figure 1This is a schematic diagram of the structure of an embodiment of a program running method provided by the present invention. Specifically, it may include the following steps:
[0016] Step S11: the application program calls a first preset program interface.
[0017] In one implementation scenario, the application program can be a program custom-written by the user. Specifically, the application program can be stored in the memory of the integrated circuit chip. In a specific implementation scenario, the integrated circuit chip can include but is not limited to: SoC (System on Chip), MCU (Micro Control Unit). The specific functions of the application program can be set according to the actual application situation. For example, when the integrated circuit chip is a WiFi (Wireless Fidelity) chip, the application program can be a program written by the user for wireless network settings (for example, wireless network list refresh, etc.); or, when the integrated circuit chip is an audio chip, the application program can be a program written by the user for audio control (for example, volume adjustment, etc.); or, when the integrated circuit chip is a tire pressure monitoring chip, the application program can be a program written by the user for tire pressure monitoring control (for example, tire pressure monitoring frequency setting, etc.). Other scenarios are not given one by one here. In another implementation scenario, the application program can also be pre-written in the memory of the integrated circuit chip when the manufacturer leaves the factory, which is not limited here.
[0018] The first preset program interface is used to implement the call of the protection program, so that the application cannot directly access the protection program to reduce the possibility of leakage of the protection program. In the embodiment of the present invention, the protection program is a program that is expected to be protected from being cracked by the outside world, such as the manufacturer's core code, the core algorithm for implementing certain functions, etc., which can be set according to the actual application situation. For example, when the integrated circuit chip is a tire pressure monitoring chip, the protection program may include a tire pressure calibration algorithm, etc.; or, when the integrated circuit chip is a WiFi chip, the protection program may include a wireless network transmission data encryption algorithm, etc.; or, when the integrated circuit chip is an audio chip, the protection program may include an audio quality improvement algorithm, etc. Other scenarios are not given one by one here.
[0019] In one implementation scenario, the first preset program interface can be predefined based on the protection program, and the first preset program interface can call at least one protection program, for example, the first preset program interface can call 1 protection program, the first preset program interface can call 2 protection programs, the first preset program interface can call 3 protection programs, and so on, which are not limited here. For example, the protection program includes FW_Fun1 for implementing function 1, FW_Fun2 for implementing function 2, and Fw_Fun3 for implementing function 3, then the first preset program interface APP_Lib_Fun1 can be predefined, and APP_Lib_Fun1 can call FW_Fun1; the first preset program interface APP_Lib_Fun2 can also be defined, and APP_Lib_Fun2 can call FW_Fun2; the first preset program interface APP_Lib_Fun3 can also be defined, and APP_Lib_Fu n3 can call FW_Fun3; in addition, a first preset program interface APP_Lib_Fun4 can also be defined, and APP_Lib_Fun4 can call FW_Fun1 and FW_Fun2 to combine the functions of FW_Fun1 and FW_Fun2 to implement function 4; or, a first preset program interface APP_Lib_Fun5 can also be defined, and APP_Lib_Fun5 can call FW_Fun2 and FW_Fun3 to combine the functions of FW_Fun2 and FW_Fun3 to implement function 5, which is not limited here.
[0020] In a specific implementation scenario, multiple first preset program interfaces for calling the same protection program can be provided, and multiple first preset program interfaces for calling the same protection program can be configured in different layers of user protection program interface libraries for application programs to select one to call. In addition, the user protection program interface library can be provided with multiple layers, and each layer can have multiple first preset program interfaces. Figure 2 , Figure 2This is a state diagram of an embodiment of the program running method provided by the present invention. n first preset program interfaces APP_Lib1_Fun1, ..., APP_Libn_Fun1 for calling the same protection program can be set, and they are respectively configured in user protection program interface libraries APP_Lib1, ..., APP_Libn at different layers; or n first preset program interfaces APP_Lib1_Fun2, ..., APP_Libn_Fun2 for calling the same protection program can be set, and they are respectively configured in user protection program interface libraries APP_Lib1, ..., APP_Libn at different layers; or n first preset program interfaces APP_Lib1_Fun3, ..., APP_Libn_Fun3 for calling the same protection program can also be set, and they are respectively configured in user protection program interface libraries APP_Lib1, ..., APP_Libn at different layers. Other scenarios can be deduced by analogy, and examples are not given one by one here. By setting the first preset program interface in user protection program interface libraries of different layers, and selecting at least one layer to call, the protection program can be further protected and the probability of its leakage can be reduced.
[0021] In another specific implementation scenario, multiple first preset program interfaces for calling the same protection program may be provided, and at least some of the first preset program interfaces for calling the same protection program may be nested. Specifically, at least some may be two, three, etc. of the multiple first preset program interfaces for calling the same protection program, or at least some may be all the first preset program interfaces for calling the same protection program. Please continue to refer to Figure 2When all the first preset program interfaces for calling the same protection program are nested, APP_Lib1_Fun1 can call APP_Lib2_Fun1 (not shown in the figure), APP_Lib2_Fun1 can call APP_Lib3_Fun1 (not shown in the figure), APP_Lib3_Fun1 can call APP_Lib4_Fun1 (not shown in the figure), and so on. APP_Libn-1_Fun1 (not shown in the figure) can call APP_Libn_Fun1, which is equivalent to APP_Lib1_Fun1 realizing n-1 layers of nesting through APP_Lib2_Fun1, APP_Lib3_Fun1, APP_Lib4_Fun1, ..., APP_Libn-1_Fun1, APP_Libn_Fun1, so as to further protect the protection program and reduce the probability of leakage. Alternatively, when at least some of the first preset program interfaces for calling the same protection program are not all, for example, at least some of the first preset program interfaces for calling the same protection program are two of the multiple first preset program interfaces, APP_Lib1_Fun1 can call APP_Lib2_Fun1, so that APP_Lib1_Fun1 achieves one layer of nesting through APP_Lib2_Fun1, and can also protect the protection program and reduce the probability of leakage. The specific number of nesting layers can be set according to actual application needs and is not limited here.
[0022] In another specific implementation scenario, the application, the first preset program interface and the protection program can be stored in different memories of the integrated circuit chip. For example, the integrated circuit chip may include several memories, the application can be stored in memory 1, the first preset program interface can be stored in memory 2, and the protection program can be stored in memory 3.
[0023] In another specific implementation scenario, the application, the first preset program interface and the protection program can also be stored in different storage areas of the same memory in the integrated circuit chip. For example, the memory 1 of the integrated circuit chip may include several storage areas, the application can be stored in storage area 1, the first preset program interface can be stored in storage area 2, and the protection program can be stored in storage area 3.
[0024] In another specific implementation scenario, in order to improve the protection strength, the protection program can be stored together with the firmware of the integrated circuit chip. The firmware is usually a program written into an erasable programmable read-only memory or an electrically erasable programmable read-only memory, which generally cannot be directly read or modified by the user. Therefore, storing the protection program together with the firmware can reduce the probability of leakage of the protection program.
[0025] In another specific implementation scenario, the access rights of the storage area of the protection program can be set to be inaccessible to the outside, thereby reducing the probability of leakage of the protection program. Specifically, the protection program can be set to be inaccessible to external interface access (for example, debugging tools), or the protection program can be set to uniformly access external interface access to a preset value (for example, 0x0). By setting the access rights of the storage area of the protection program to include being inaccessible to the outside, the protection program can be protected from the external dimension of the integrated circuit chip.
[0026] Step S12: the first preset program interface calls the second preset program interface, and the second preset program interface directly calls the protection program.
[0027] In order to further reduce the probability of protection program leakage, the first preset program interface can also be used to call the second preset program interface, and the second preset program interface can directly call the protection program. Still taking the protection program including FW_Fun1 for implementing function 1, FW_Fun2 for implementing function 2, and Fw_Fun3 for implementing function 3 as an example, the first preset program interface can include APP_Lib_Fun1 that can call FW_Fun1, APP_Lib_Fun2 that can call FW_Fun2, and APP_Lib_Fun3 that can call FW_Fun3. In addition, in addition to being able to call one protection program, the first preset program interface can also call multiple protection programs, which is not limited here. For details, please refer to the relevant description in the aforementioned implementation scenario, which will not be repeated here. The second preset program interface may include FW_Lib_Fun1 that directly calls FW_Fun1 and is directly called by APP_Lib_Fun1, FW_Lib_Fun2 that directly calls FW_Fun2 and is directly called by APP_Lib_Fun2, and FW_Lib_Fun3 that directly calls FW_Fun3 and is directly called by APP_Lib_Fun3. In addition, in addition to being able to directly call one protection program, the second preset program interface can also directly call multiple protection programs. For details, please refer to the relevant description in the aforementioned implementation scenario, which will not be repeated here. Therefore, the first preset program interface can be used to call the second preset program interface, and the second preset program interface can call the protection program, so that the calling of the protection program is realized through the superposition combination of the first preset program interface and the second preset program interface, so as to improve the protection strength of the protection program and reduce the probability of its leakage.
[0028] In a specific implementation scenario, there may be multiple second preset program interfaces corresponding to the first preset program interface, and multiple second preset program interfaces for calling the same protection program may be configured in protection program interface libraries of different layers, and the first preset program interface may call at least one second program interface that calls the same protection program. Specifically, the first preset program interface and the second preset program interface corresponding to the first preset program interface call the same protection program. Figure 2 For example, if the protection program called by the first preset program interface APP_Lib1_Fun1 is FW_Fun1, then a second preset program interface FW_Lib1_Fun1 that calls the protection program FW_Fun1 can be set accordingly. In this case, the second preset program interface FW_Lib1_Fun1 corresponds to the first preset program interface APP_Lib1_Fun1; or, for example, if the protection program called by the first preset program interface APP_Lib1_Fun2 is FW_Fun2, then a second preset program interface FW_Lib1_Fun2 that calls the protection program FW_Fun2 can be set accordingly. In this case, the second preset program interface FW_Lib1_Fun2 corresponds to the first preset program interface APP_Lib1_Fun2. Other situations can be deduced by analogy, and examples are not given one by one here. Please continue to refer to Figure 2 , n second preset program interfaces FW_Lib1_Fun1, ..., FW_Libn_Fun1 for calling the same protection program can be set, and they are respectively configured in protection program interface libraries FW_Lib1, ..., FW_Libn at different layers; or, n second preset program interfaces FW_Lib1_Fun2, ..., FW_Libn_Fun2 for calling the same protection program can be set, and they are respectively configured in protection program interface libraries FW_Lib1, ..., FW_Libn at different layers; or, n second preset program interfaces FW_Lib1_Fun3, ..., FW_Libn_Fun3 for calling the same protection program can also be set, and they are respectively configured in protection program interface libraries FW_Lib1, ..., FW_Libn at different layers. Other scenarios can be deduced by analogy, and examples are not given one by one here. By setting the user protection program interface library containing the first preset program interface and the protection program interface library containing the second preset program interface to multiple layers, and selecting at least one layer of call in the multiple layers of the user protection program interface library and the protection program interface library respectively, the protection program can be further protected and the probability of its leakage can be reduced.
[0029] In another specific implementation scenario, multiple second preset program interfaces for calling the same protection program may be provided, and at least some of the second preset program interfaces for calling the same protection program may be nested. Specifically, at least some may be two, three, etc. of the multiple second preset program interfaces for calling the same protection program, or at least some may be all of the second preset program interfaces for calling the same protection program. Figure 2 When all the second preset program interfaces for calling the same protection program are nested, FW_Lib1_Fun1 can call FW_Lib2_Fun1 (not shown in the figure), FW_Lib2_Fun1 can call FW_Lib3_Fun1 (not shown in the figure), FW_Lib3_Fun1 can call FW_Lib4_Fun1 (not shown in the figure), and so on. FW_Libn-1_Fun1 (not shown in the figure) can call FW_Libn_Fun1, which is equivalent to FW_Lib1_Fun1 realizing n-1 layers of nesting through FW_Lib2_Fun1, FW_Lib3_Fun1, FW_Lib4_Fun1, ..., FW_Libn-1_Fun1, and FW_Libn_Fun1, thereby further protecting the protection program and reducing the probability of leakage. Alternatively, when at least some are not all of the second preset program interfaces for calling the same protection program, for example, at least some are two of the second preset program interfaces for calling the same protection program, FW_Lib1_Fun1 can call FW_Lib2_Fun1, so that FW_Lib1_Fun1 achieves one layer of nesting through FW_Lib2_Fun1, and can also protect the protection program and reduce the probability of leakage. The specific number of nesting layers can be set according to actual application needs and is not limited here.
[0030] In addition, at least part of the first preset program interface and the second preset program interface for calling the same protection program can adopt nested calls to further protect the protection program and reduce the probability of leakage. For example, when all the first preset program interfaces and the second preset program interfaces for calling the same protection program are nested, APP_Lib1_Fun1 can call APP_Lib2_Fun1 (not shown in the figure), APP_Lib2_Fun1 can call APP_Lib3_Fun1 (not shown in the figure), APP_Lib3_Fun1 can call APP_Lib4_Fun1 (not shown in the figure), and so on, APP_Libn-1_Fun1 (not shown in the figure) can call APP_Libn_Fun1, and APP_Libn_Fun1 can call the second preset program interface FW_Lib1_Fun1, which is equivalent to APP_Lib1_Fun1 through APP_Lib2_Fun1, APP_Lib3_Fun1, APP_Lib4_Fun1, ..., APP_Lib n-1_Fun1 and APP_Libn_Fun1 implement n-1 layers of nesting, and FW_Lib1_Fun1 can call FW_Lib2_Fun1 (not shown), FW_Lib2_Fun1 can call FW_Lib3_Fun1 (not shown), FW_Lib3_Fun1 can call FW_Lib4_Fun1 (not shown), and so on. FW_Libn-1_Fun1 (not shown) can call FW_Libn_Fun1, and FW_Libn_Fun1 can call the protection program FW_Fun1, which is equivalent to FW_Lib1_Fun1 implementing n-1 layers of nesting through FW_Lib2_Fun1, FW_Lib3_Fun1, FW_Lib4_Fun1, ..., FW_Libn-1_Fun1, and FW_Libn_Fun1. Therefore, the call from APP_Fun1 to FW_Fun1 can be considered to have gone through 2 (n-1) layers of nesting, which can further protect the protection program and reduce the probability of leakage. Alternatively, when multiple first preset program interfaces and second preset program interfaces for calling the same protection program are individually nested, for example, APP_Lib1_Fun1 can call APP_Lib2_Fun1 (not shown), and APP_Lib2_Fun1 can call the second preset program interface FW_Lib1_Fun1, FW_Lib1_Fun1 can call FW_Lib2_Fun1 (not shown), and FW_Lib2_Fun1 can call the protection program FW_Fun1, so the call from APP_Fun1 to FW_Fun1 has gone through 2 layers of nesting, which can also protect the protection program and reduce the probability of leakage.The specific nesting levels of the first preset program interface and the second preset program interface for calling the same protection program can be set according to actual application needs and are not limited here.
[0031] In another specific implementation scenario, the application, the first preset program interface, the second preset program interface, and the protection program may be stored in the same memory or different memories of the integrated circuit chip. Specifically, when stored in different memories, the integrated circuit chip may include several memories, for example, the application may be stored in memory 1, the first preset program interface may be stored in memory 2, the second preset program interface may be stored in memory 3, and the protection program may be stored in memory 4. When stored in the same memory, the memory of the integrated circuit chip may include several storage areas, for example, the memory 1 of the integrated circuit chip may include 4 storage areas, the application may be stored in storage area 1, the first preset program interface may be stored in storage area 2, the second preset program interface may be stored in storage area 3, and the protection program may be stored in storage area 4.
[0032] In another specific implementation scenario, the application and the first preset program interface may be stored in one memory, and the second preset program interface and the protection program may be stored in another memory. For example, the integrated circuit chip may include several memories, the application and the first preset program interface may be stored in memory 1, and the second preset program interface and the protection program may be stored in memory 2. Alternatively, the application and the first preset program interface, and the second preset program interface and the protection program may also be stored in different storage areas of the same memory, for example, the integrated circuit chip may include several storage areas, the application and the first preset program interface may be stored in storage area 1, and the second preset program interface and the protection program may be stored in storage area 2.
[0033] In another specific implementation scenario, the application program, the first preset program interface, the second preset program interface, and the protection program can also be selectively stored in different memories of the integrated circuit chip according to application needs, that is, at least one of the four can be stored in different memories, or stored in different storage areas of the same memory of the integrated circuit chip. For example, the integrated circuit chip may include several memories, the application program can be stored in memory 1, the first preset program interface, the second preset program interface, and the protection program can be stored in memory 2; or, the memory of the integrated circuit chip may include several storage areas, the application program can be stored in storage area 1, the first preset program interface, the second preset program interface, and the protection program can be stored in storage area 2. The specific settings can be made according to actual application needs, and examples are not given one by one here.
[0034] In another specific implementation scenario, the access rights of the storage area (or memory) storing the application program and the first preset program interface can be configured as externally accessible. The access rights of the storage area (or memory) storing the second preset program interface and the protection program can be configured as externally inaccessible. Specifically, the manner of configuring as externally inaccessible can refer to the relevant description in the aforementioned implementation scenario, which will not be repeated here.
[0035] In an embodiment of the present invention, the storage address of the currently called program can be used to determine that it is the first preset program interface. Specifically, the storage addresses of the above-mentioned application, the first preset program interface, the second preset program interface, and the protection program can be included in an address table, so that the storage address of the currently called program can be obtained by querying the address table, and the storage address obtained by querying and the address ranges of various programs divided in advance can be used to determine that the currently called program is the first preset program interface. For example, address range 1 can be set as the address range for storing application programs, address range 2 can be set as the address range for storing the first preset program interface, and address range 3 can be set as the address range for storing protection programs. According to the address table containing the storage addresses of various programs, it can be queried that the storage address of the currently called program is within address range 1, then it can be determined that the currently called program is the first preset program interface.
[0036] In one implementation scenario, the address table can be set to be inaccessible to the outside, thereby further reducing the probability of the protection program being tracked, read and leaked. For example, the address table can be set to be inaccessible to external interface access (for example, debugging tools), or the address table can be set to be uniformly accessed to a preset value (for example, 0x0) for external interface access.
[0037] In one implementation scenario, in order to further improve the protection strength of the protection program, the protection program can also be stored in a preset storage area and cannot be read. For example, the protection program can be stored together with the firmware of the integrated circuit chip. Therefore, before running the protection program, the protection program can be processed so that the protection program is readable to the processor, so that the processor can call the protection program through the first preset program interface to obtain the protection program. For example, the protection program can be transferred to the random access memory (Random Access Memory, RAM) of the integrated circuit chip. In addition, after calling the protection program through the first preset program interface to obtain the protection program, the protection program can be run to obtain the running result.
[0038] In a specific implementation scenario, the current calling program to be executed can be determined as a protected program through the storage address of the current calling program, and can be processed to make it readable to the processor.
[0039] In another specific implementation scenario, when the first preset program interface is configured to call the second preset program interface, and the second preset program interface is configured to directly call the protection program, the second preset program interface can be called through the first preset program interface, thereby directly calling the protection program through the second preset program interface. Figure 2 Taking the running of application APP_Fun1 as an example, the first preset program interface APP_Lib1_Fun1 called by APP_Fun1 can be run first, and then the second preset program interface FW_Lib1_Fun1 is called through APP_Lib1_Fun1, and the protection program FW_Fun1 is called through the second preset program interface FW_Lib1_Fun1. When the interface call of the application is set to other situations, it can be deduced by analogy, and no examples are given here one by one.
[0040] Step S13: Return the protection program to the application program, and run the application program using the protection program.
[0041] In one implementation scenario, after the protection program is called, the protection program can be returned to the first preset program interface, and the first preset program interface returns the protection program to the application. Specifically, after the protection program is called, the protection program can be run first to obtain the running result, and the running result is returned to the first preset program interface that calls the protection program, and the first preset program interface returns the running result to the application that calls the first preset program interface. Please continue to refer to Figure 2, still taking the running of the application APP_Fun1 as an example, the running result can be returned to the first preset program interface APP_Lib1_Fun1 that calls the protection program FW_Fun1, and the first preset program interface APP_Lib1_Fun1 returns the running result to the application APP_Fun1, and the running result is used to continue running the application APP_Fun1. Specifically, the subsequent code instructions of the application can be the first preset program interface that calls other functions, for example, the running result is used as the input parameter of the first preset program interface of other functions, or the subsequent code instructions can also be mathematical (or logical) operation instructions, for example, the running result is used as the input parameter of the mathematical (or logical) running instruction; or, the subsequent code instructions can also be output running results, for example, the code instructions can be written in C language, and the running result can eventually be assigned to a variable named result, and the subsequent code instructions can be return result, which is not limited here. By returning the running result to the first preset program interface that calls the protection program, and the first preset program interface returns the running result to the application that calls the first preset program interface, the probability of the protection program being tracked can be reduced, thereby improving the protection strength of the protection program and further reducing the probability of the protection program leaking.
[0042] In another implementation scenario, after the protection program is called, the protection program can be returned to the second preset program interface, and the second preset program interface returns the protection program to the first preset program interface, and then the first preset program interface returns the protection program to the application. Specifically, after the protection program is called, the protection program can be run first to obtain the running result, and then the running result is returned to the second preset program interface that calls the protection program, and the second preset program interface returns the running result to the first preset program interface that calls the second preset program interface, and then the first preset program interface returns the running result to the application that calls the first preset program interface. Please continue to refer to Figure 2 , still taking the running of the application APP_Fun1 as an example, the running result can be returned to the second preset program interface FW_Lib1_Fun1 that calls the protection program FW_Fun1, and the second preset program interface FW_Lib1_Fun1 returns the running result to the first preset program interface APP_Lib1_Fun1 that calls FW_Lib1_Fun1, and then APP_Lib1_Fun1 returns the running result to the application APP_Fun1, and the running result is used to continue running the application APP_Fun1. The subsequent code instructions of the application can refer to the relevant description in the aforementioned implementation scenario, which will not be repeated here.
[0043] In the above scheme, the application is set to be unable to directly access the protection program. The application calls the first preset program interface, so that the first preset program interface calls the second preset program interface, and the second preset program interface directly calls the protection program, returns the protection program to the application, and uses the protection program to run the application. Therefore, when running the application, the dual protection mechanism of the first preset program interface and the second preset program interface can be used to prevent the outside world from directly tracking and reading the protection program, which can help reduce the possibility of leakage of the protection program. Since there is no need to encrypt and decrypt the protection program, there is no need to set up an independent processor or control unit. Therefore, while protecting the program, the integrated circuit chip area can be reduced and the cost can be reduced.
[0044] See also Figure 3 , Figure 3 1 is a flow chart of another embodiment of the program running method provided by the present invention. Specifically, the protection program can be stored in a preset storage area and cannot be read. For example, the protection program can be stored together with the firmware of the integrated circuit chip. Specifically, the following steps can be included:
[0045] Step S31: The application program calls a first preset program interface, wherein the application program cannot directly access the protection program.
[0046] For details, please refer to the relevant steps in the above embodiments.
[0047] Step S32: Process the protection program to make it readable.
[0048] In one implementation scenario, processing the protection program may include loading the protection program into a random access memory (RAM) of an integrated circuit chip.
[0049] In another implementation scenario, the storage address of the acquired protection program is a base address, and the storage area corresponding to the base address can be set to empty so that no valid data can be read, or the access permission of the storage area corresponding to the base address can be set to unreadable. When the processor determines that the storage address is within a preset address range, or determines that there is no valid data in the storage space corresponding to the storage address, or determines that it does not have the read permission of the storage area corresponding to the storage address during execution, it can be determined that the program to be run is a protection program, and the processing of the protection program can include processing the base address using the preset offset address to obtain the actual address of the protection program, and using the actual address to read the protection program from the preset storage area. Specifically, the preset offset address can be set according to the actual application situation. For example, the base address is 0BAC in hexadecimal, and the preset offset address can be set to 0100 in hexadecimal. Then the actual address can be obtained by multiplying the base address by 16 and adding the preset offset address. After calculation, the actual address is 0BBC0 in hexadecimal. When the base address and the preset offset address are other values, it can be deduced by analogy, and examples are not given one by one here.
[0050] Step S33: the first preset program interface calls the second preset program interface, and the second preset program interface directly calls the protection program.
[0051] After the protection program is processed to be readable, the protection program can be read from the preset storage area, so that the protection program can be obtained. In an implementation scenario, after the protection program is obtained, the protection program can be run to obtain the running result. For details, please refer to the relevant steps in the above embodiment.
[0052] Step S34: Return the protection program to the application program, and run the application program using the protection program.
[0053] For details, please refer to the relevant steps in the above embodiments.
[0054] Different from the above-mentioned embodiment, the protection program is stored in a preset storage area and is unreadable, and the protection program is processed to make it readable, so that the protection program can be protected from the internal dimension of the integrated circuit chip.
[0055] See also Figure 4 , Figure 4: is a schematic diagram of a framework of an embodiment of an integrated circuit chip 40 provided by the present invention. The integrated circuit chip 40 includes a memory 41 and a processor 42 coupled to each other, the memory 41 stores program instructions, and the processor 42 executes the program instructions to implement the steps in any of the above-mentioned program running method embodiments. Specifically, the integrated circuit chip 40 may include SoC, MCU, etc., which are not limited here. The memory 41 included in the integrated circuit chip 40 may be provided with one or more, such as 2, 3, 4, etc., which are not limited here. The memory 41 may include ROM (Read-Only Memory), RAM, Flash Memory, which are not limited here. In addition, the integrated circuit chip 40 may also include a clock, an interrupter, an input / output port, a timer, an analog-to-digital converter, etc., which are not limited here. The program instructions may include an application program, a first preset program interface, a second preset program interface, and a protection program in any of the above-mentioned program running method embodiments, which are not limited here.
[0056] In this embodiment, the processor 42 is used to enable the application to call the first preset program interface, wherein the application cannot directly access the protection program; the processor 42 is used to enable the first preset program interface to call the second preset program interface, and the second preset program interface directly calls the protection program; the processor 42 is used to return the protection program to the application and use the protection program to run the application.
[0057] In the above scheme, the application is set to be unable to directly access the protection program. The application calls the first preset program interface, so that the first preset program interface calls the second preset program interface, and the second preset program interface directly calls the protection program, and then returns the protection program to the application, and uses the protection program to run the application. Therefore, when running the application, the dual protection mechanism of the first preset program interface and the second preset program interface can be used to prevent the outside world from directly tracking and reading the protection program, which can help reduce the possibility of leakage of the protection program. Since there is no need to encrypt and decrypt the protection program, there is no need to set up an independent processor or control unit. Therefore, while protecting the program, the integrated circuit chip area can be reduced and the cost can be reduced.
[0058] In some embodiments, the processor 42 is further configured to return the protection program to the first preset program interface, and the first preset program interface returns the protection program to the application program.
[0059] Different from the above-mentioned embodiment, returning the protection program to the first preset program interface, and returning the protection program to the application program via the first preset program interface can help reduce the probability of the protection program being tracked, thereby further reducing the possibility of leakage of the protection program.
[0060] In some embodiments, a plurality of first preset program interfaces for calling the same protection program are provided, and each of the first preset program interfaces is located in a user protection program interface library at a different layer, and the application program calls at least one first preset program interface.
[0061] Different from the aforementioned embodiment, a plurality of first preset program interfaces for calling the same protection program are provided, and each is in a user protection program interface library at a different layer. The application calls at least one first preset program interface, and the first preset program interface can be provided in multiple layers, which can help to further reduce the probability of the protection program being tracked, thereby helping to further reduce the possibility of leakage of the protection program.
[0062] In some embodiments, there are multiple second preset program interfaces corresponding one-to-one to the first preset program interface, and each is in a protection program interface library at a different layer. The first preset program interface calls at least one second preset program interface that calls the same protection program interface.
[0063] Different from the aforementioned embodiment, a plurality of second preset program interfaces corresponding one to one to the first preset program interface are provided, and each is in a protection program interface library of a different layer. The first preset program interface calls at least one second preset program interface that calls the same protection program, and the second preset program interface can be provided in multiple layers, which can help to further reduce the probability of the protection program being tracked, thereby helping to further reduce the possibility of leakage of the protection program.
[0064] In some embodiments, the application program, the first preset program interface, the second preset program interface, and the protection program are stored in different areas of the same memory, or at least one of the four is stored in different memories.
[0065] Different from the aforementioned embodiment, storing the application, the first preset program interface, the second preset program interface, and the protection program in different areas of the same memory, or storing at least one of the four in different memories, can facilitate protecting the protection program.
[0066] In some embodiments, the access rights of the storage area storing the application program and the first preset program interface are externally accessible; and the access rights of the storage area storing the second preset program interface and the protection program are externally inaccessible.
[0067] Different from the aforementioned embodiment, setting the access rights of the storage area storing the application and the first preset program interface to be externally accessible can facilitate users to customize the application according to the defined program interface; setting the access rights of the storage area storing the second preset program interface and the protection program to be externally inaccessible can help protect the protection program from the external dimension of the integrated circuit chip, thereby helping to further reduce the probability of the protection program being tracked, thereby helping to further reduce the possibility of leakage of the protection program.
[0068] In some embodiments, the protection program is stored in a preset storage area and is unreadable, and the processor 42 is further configured to process the protection program to make the protection program readable.
[0069] Different from the above-mentioned embodiment, the protection program is stored in a preset storage area and is unreadable, and the protection program is processed to make it readable, so that the protection program can be protected from the internal dimension of the integrated circuit chip.
[0070] In some embodiments, the storage addresses of the application program, the first preset program interface, the second preset program interface, and the protection program are included in an address table, and the address table is not accessible externally.
[0071] Different from the aforementioned embodiment, the storage addresses of the application, the first preset program interface, the second preset program interface and the protection program are included in an address table, and the address table is inaccessible from the outside, which can facilitate reading of the above-mentioned programs and can help reduce the probability of the above-mentioned programs being read, and can help further reduce the possibility of leakage of the protection program.
[0072] In some embodiments, the integrated circuit chip 40 may further include a tire pressure sensor coupled to the processor 42, and the tire pressure sensor is used to sense tire pressure. In a specific implementation scenario, the integrated circuit chip 40 may further include a temperature sensor for sensing tire temperature, and the temperature sensor is coupled to the processor 42. In another specific implementation scenario, the integrated circuit chip 40 may further include a radio frequency circuit for transmitting data, and the radio frequency circuit is coupled to the processor 42. Specifically, the components in the integrated circuit chip 40 can be set according to the actual application situation. For example, when the integrated circuit chip 40 needs to be equipped with a tire temperature monitoring function, a temperature sensor can be configured in the integrated circuit chip 40; or, when the integrated circuit chip 40 needs to be equipped with an energy-saving function, a low-frequency wake-up circuit can be configured in the integrated circuit chip 40 to wake up the integrated circuit chip 40 from a low-power mode in a static state, so that the integrated circuit chip 40 switches to a normal working mode. Specifically, the low-power mode can be a mode with a lower tire pressure monitoring frequency, and the tire pressure monitoring frequency in the normal working mode can be set to be higher than the tire pressure monitoring frequency in the low-power mode. For example, the tire pressure monitoring frequency in the low-power mode can be set to 10 minutes / time, 5 minutes / time, etc., and the tire pressure monitoring frequency in the normal working mode can be set to 1 minute / time, 30 seconds / time, etc., which is not limited here.
[0073] See also Figure 5 , Figure 5 1 is a schematic diagram of a framework of an embodiment of a storage device 50 provided by the present invention. The storage device 50 stores program instructions 501 that can be executed by a processor, and the program instructions 501 are used to implement the steps in any of the above-mentioned program running method embodiments. Specifically, the program instructions 501 may include an application program, a first preset program interface, a second preset program interface, and a protection program in any of the above-mentioned program running method embodiments, which are not limited here.
[0074] The above solution can reduce the integrated circuit chip area and reduce the cost while protecting the program.
[0075] The above are only embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A program running method, characterized in that: include: The application program calls a first preset program interface, wherein the application program cannot directly access the protection program, the first preset program interface is predefined based on the protection program, and the first preset program interface can call at least one of the protection programs; The first preset program interface calls the second preset program interface, and the second preset program interface directly calls the protection program; wherein the second preset program interface corresponds to the first preset program interface one-to-one, and the protection program called by the first preset program interface and the one-to-one corresponding second preset program interface is the same; The protection program is returned to the application program, and the application program is run using the protection program.
2. The program running method according to claim 1, characterized in that: The step of returning the protection program to the application program comprises: The protection program is returned to the first preset program interface, and the protection program is returned to the application program by the first preset program interface.
3. The program running method according to claim 1, characterized in that: There are multiple first preset program interfaces, each of which is in a user protection program interface library at a different layer, and the application calls at least one of the first preset program interfaces.
4. The program running method according to claim 1, characterized in that: There are multiple second preset program interfaces corresponding to the first preset program interface one by one, and each is in a protection program interface library of a different layer. The first preset program interface calls at least one of the second preset program interfaces corresponding to it.
5. The program running method according to claim 1, characterized in that: The application program, the first preset program interface, the second preset program interface, and the protection program are stored in different areas of the same memory, or at least one of the four is stored in a different memory.
6. The program running method according to claim 1, characterized in that: The access permission of the storage area storing the application program and the first preset program interface is externally accessible; The access permission of the storage area storing the second preset program interface and the protection program is inaccessible to the outside.
7. The program running method according to claim 1, characterized in that: The protection program is stored in a preset storage area and is unreadable; before the first preset program interface calls the second preset program interface, and the second preset program interface directly calls the protection program, the method further includes: The protection program is processed to make the protection program readable.
8. The program running method according to claim 1, characterized in that: The storage addresses of the application program, the first preset program interface, the second preset program interface and the protection program are included in an address table, and the address table is not accessible externally.
9. An integrated circuit chip, characterized in that: The invention comprises a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor executes the program instructions to implement the program running method according to any one of claims 1 to 8.
10. A storage device, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the program running method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Accessing processing method and accessing processing device of application program
CN106778208A
Method and device for application program interface calling based on HTTP service
CN107592358A
Access control method, device and system
CN107766717A
Resource access methods and devices
CN108256298A
Interface management method, device and system, and computer readable storage medium
CN109246092A
