Operation method of security chip, security chip and electronic equipment

By storing session type objects in non-volatile memory within the security chip and loading them into the session storage space of volatile memory when the application is activated, the problem of limited storage space in the security chip is solved, thereby improving the utilization efficiency of volatile memory and the number of applications.

CN121935974APending Publication Date: 2026-04-28HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2024-10-25
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The limited storage space of volatile memory in security chips restricts the number of applications that can be installed on them.

Method used

The session type objects created by the application are stored in non-volatile memory and loaded into the session storage space of volatile memory when the application is activated, and the storage space is cleaned up when the application is deactivated. The storage space of volatile memory is dynamically allocated.

Benefits of technology

It improves the utilization efficiency of volatile memory, increases the number of applications that can be installed on the security chip, and eliminates the limitation of applications accessing volatile memory through shared interfaces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121935974A_ABST
    Figure CN121935974A_ABST
Patent Text Reader

Abstract

The invention provides an operation method of a security chip, the security chip and electronic equipment, and belongs to the technical field of security chips. The operation method comprises the following steps: storing a session type object created by an application in a nonvolatile memory; in response to the application being activated, the session type object is loaded to the session storage space of the volatile memory. According to the embodiment of the invention, under application activation scenes that the application is selected and the shared interface is provided for the client, the storage space is allocated for the session type object corresponding to the application in the session storage space, and the non-activated application does not occupy the storage space in the volatile memory; therefore, the situation that the transient object occupies a storage space with a fixed size in the volatile memory after the security chip is powered on is avoided, and the problem that the number of applications installed on the security chip is limited is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of security chips, and specifically relates to a method for operating a security chip, a security chip, and an electronic device. Background Technology

[0002] With the development of technology, chip operating systems (COS) dedicated to smart cards are also being applied to security chips; for example, in the secure element (SE) of mobile phones. Because the storage space of volatile memory (e.g., random access memory, RAM) in security chips is very limited, and the static allocation mechanism of volatile memory storage space easily leads to a limited number of applications that can be installed on the security chip. Summary of the Invention

[0003] This application provides an operating method for a security chip, a security chip, and an electronic device to improve the problem of the limited number of applications that can be installed on a security chip.

[0004] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0005] Firstly, a method for operating a security chip is provided. This method includes: storing a session-type object created by an application in non-volatile memory; and loading the session-type object into the session storage space of the volatile memory in response to application activation.

[0006] In this embodiment, when an application is activated, such as when it is selected or a shared interface is provided to the client, storage space is allocated in the session storage space for the session type object corresponding to the application. In this embodiment, inactive applications do not occupy storage space in the volatile memory, thus avoiding the problem of transient objects occupying a fixed amount of storage space in the volatile memory after the security chip is powered on, and improving the limited number of applications that can be installed on the security chip.

[0007] In some possible implementations, application activation includes: application selection, or application providing a shared interface to the client as a server. In the embodiments of this application, application activation includes not only application selection but also application providing a shared interface to the client as a server, thereby eliminating the restriction on the application's shared interface accessing volatile memory.

[0008] In some possible implementations, the method further includes: in response to the application being deactivated, clearing the storage space occupied by session type objects in the session storage space. This application's implementation dynamically allocates storage space in volatile memory. When an application is deactivated, the corresponding session type objects in the volatile memory are cleared, thereby freeing up storage space for other applications that require it, thus improving the utilization efficiency of the volatile memory.

[0009] In some possible implementations, the operation method further includes: distributing received application protocol data unit (APDU) instructions to the selected application, the APDU instructions instructing the selected application to create temporary type objects; loading the temporary type objects into temporary storage space of volatile memory; and clearing the storage space occupied by the temporary type objects in the temporary storage space in response to the selected application finishing executing the APDU instructions. This application's implementation supports temporary type objects with a lifespan of APDU instructions, thereby enabling the storage of temporary type objects in temporary storage space when volatile memory is temporarily needed in APDU instructions. The newly allocated temporary storage space achieves higher volatile memory utilization.

[0010] In some possible implementations, the APDU instruction also instructs the selected application to create a new session type object, and the operation further includes: loading the new session type object into the session store. In response to the application being deactivated, the storage space occupied by the new session type object is cleared from the session store.

[0011] Secondly, another method for operating the security chip is also provided. This method includes: distributing received Application Protocol Data Unit (APDU) instructions to a selected application, the APDU instructions instructing the selected application to create a temporary type object; loading the temporary type object into a temporary storage space in volatile memory; and clearing the storage space occupied by the temporary type object from the temporary storage space in response to the selected application finishing executing the APDU instructions.

[0012] Thirdly, a security chip is provided. This security chip includes a processor, volatile memory, and non-volatile memory. The processor is configured to: store session-type objects created by an application in the non-volatile memory; and load the session-type objects into the session storage space of the volatile memory in response to application activation.

[0013] In some possible implementations, application activation includes: the application being selected, or the application acting as a server providing a shared interface to the client.

[0014] In some possible implementations, the processor is also configured to: in response to the application being deactivated, clear the storage space occupied by session type objects in the session storage space.

[0015] In some possible implementations, the security chip further includes interface circuitry for receiving Application Protocol Data Unit (APDU) instructions. The processor is also configured to: distribute the received APDU instructions to a selected application, instructing the selected application to create a temporary type object; load the temporary type object into temporary storage space in volatile memory; and, in response to the selected application finishing executing the APDU instructions, clear the storage space occupied by the temporary type object from the temporary storage space.

[0016] In some possible implementations, the APDU instruction also instructs the selected application to create a new session type object, and the processor is further configured to load the new session type object into the session storage space. In response to the application being deactivated, the storage space occupied by the new session type object is cleared from the session storage space.

[0017] Fourthly, another security chip is also provided. This security chip includes a processor and volatile memory. The processor is configured to: distribute received Application Protocol Data Unit (APDU) instructions to the selected application, the APDU instructions instructing the selected application to create a temporary type object; load the temporary type object into a temporary storage space in the volatile memory; and, in response to the selected application finishing executing the APDU instructions, clear the storage space occupied by the temporary type object from the temporary storage space.

[0018] Fifthly, an electronic device is provided. The electronic device includes a device housing and a security chip according to any one of the third or fourth aspects described above, wherein the security chip is partially or wholly disposed within the device housing.

[0019] It should be understood that the technical effects of the second to fifth aspects refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;

[0021] Figure 2 This is a schematic diagram of the hardware architecture of the security chip provided in an embodiment of this application;

[0022] Figure 3 This is a schematic diagram of the system architecture of the on-chip operating system provided in the embodiments of this application;

[0023] Figure 4This is a schematic diagram of a volatile memory storage space system architecture managed according to an embodiment of this application;

[0024] Figure 5 This is a schematic diagram illustrating the general allocation of storage space in a volatile memory managed by a high-level language, as provided in the embodiments of this application.

[0025] Figure 6 This is a flowchart illustrating a first operating method of the security chip provided in this application embodiment;

[0026] Figure 7 This is a flowchart illustrating a second operating method of the security chip provided in this application embodiment;

[0027] Figure 8 This is a flowchart illustrating a third operating method of the security chip provided in this application embodiment;

[0028] Figure 9 This is a schematic diagram illustrating the allocation of storage space in a volatile memory managed by a high-level language, as provided in an embodiment of this application.

[0029] Reference numerals: 100, electronic device; 110, security chip; 120, device housing; 210, processor; 220, volatile memory; 230, non-volatile memory; 240, interface circuit. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0031] The terms "exemplary" or "for example" used in the embodiments of this application are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0032] This application provides an electronic device, including but not limited to smart terminals (e.g., mobile phones), smart cards (e.g., bank cards, access control cards), car keys, smart locks, and other types of electronic devices. Figure 1 As shown, the electronic device includes a device housing 120 and a security chip 110, with the security chip 110 partially or entirely disposed within the device housing 120.

[0033] Figure 2A schematic diagram of the hardware architecture of the security chip is shown. (For example...) Figure 2 As shown, in some embodiments, the security chip 110 includes a processor 210, a volatile memory 220, a non-volatile memory (NVM) 230, and an interface circuit 240.

[0034] In some examples, processor 210 may include an 8-bit or 16-bit central processing unit (CPU) or other types of processor 210.

[0035] In some examples, volatile memory 220 may be dynamic random access memory (DRAM), static random access memory (SRAM), synchronous dynamic random access memory (SDRAM), or double data rate synchronous dynamic random access memory (DDRSDRAM), etc. Volatile memory 220 can be used to store the stack during program execution, temporary data, and buffers for data input / output. Non-volatile memory 230 may include read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, etc. Non-volatile memory 230 can be used to store the on-chip operating system and critical program code such as applications (applets) of the security chip 110.

[0036] In some examples, the interface circuit 240 can adopt physical and communication interfaces defined by the ISO / IEC 7816 standard, mainly including contact interfaces, contactless interfaces, serial interfaces and parallel interfaces, etc. These interfaces can be used to realize data transmission and interaction, and realize functions such as resource sharing.

[0037] Figure 3 A schematic diagram of the system architecture for the on-chip operating system is shown. (For example...) Figure 3 As shown, in some implementations, the development of an on-chip operating system involves code developed in a low-level native language (e.g., C) (e.g., a virtual machine) and code developed in a high-level language (e.g., Java) (e.g., applications). In some examples, the code developed in the high-level language can be compiled into bytecode and interpreted and executed on a virtual machine developed in the native language.

[0038] like Figure 4As shown, the volatile memory 220 in the security chip 110 running the on-chip operating system also includes two parts: one part is the storage space managed by the native language, used to store heap, stack and global variables, etc., and the other part is the storage space managed by the high-level language, used to store transient objects created by the application.

[0039] When creating transient objects, you can specify the type of the transient object. For example... Figure 5 As shown, in some implementations, transient objects can include two types: clear on reset and clear on deselect. The clear on reset type transient objects have statically allocated storage space in the volatile memory 220. That is, when the security chip 110 is powered on, the clear on reset type transient objects occupy a fixed amount of storage space in the volatile memory 220. Each time an application creates a clear on reset type transient object, it occupies corresponding storage space in the volatile memory 220 until the security chip 110 is reset, at which point the clear on reset type transient objects are cleared. In other words, even if the application is in an unselected, non-running state, the clear on reset type transient objects will still occupy corresponding storage space in the volatile memory 220, reducing storage space utilization efficiency and limiting the number of applications that can be installed.

[0040] This application provides an operation method for a security chip, applied to a security chip 110, for managing the volatile memory 220 within the security chip 110. For example... Figure 6 As shown, the operation method includes S110-S130, as follows:

[0041] S110. Store the session type object created by the application in non-volatile memory.

[0042] In some implementations, the application first calls an application programming interface (API) during the installation process to create a session type object, and then stores the created session type object in the non-volatile memory 230 of the security chip 110. The API called by the application can be either specification-defined or custom-defined.

[0043] S120. In response to the application being activated, load the session type object into the session storage space of the volatile memory.

[0044] In some implementations, application activation includes application selection. For example, multiple applications can be downloaded to the security chip 110, each with a unique application identifier (AID). When an external terminal device (e.g., a card reader) communicates with the security chip 110, the terminal device can send a selection command (which typically includes an application identifier to indicate the application to be selected) to select an application. Once selected, the application is activated and can accept further commands for interaction.

[0045] Activated applications can access various resources and functions in the security chip 110 hardware through logical channels; for example, reading and writing the volatile memory of the security chip 110, obtaining and setting security chip 110 parameter information and setting information, etc. In this embodiment, when an application is selected or a shared interface is provided to a client, the session type object corresponding to the application is loaded into the session storage space of the volatile memory; that is, storage space is allocated for the session type object. The size of the storage space is the sum of the sizes of all session type objects corresponding to the application. Therefore, after the security chip 110 is powered on, the session type objects corresponding to inactive applications will not occupy the storage space of the volatile memory 220. Compared to the static allocation of storage space in the volatile memory 220 for reset and clear transient objects, this embodiment can effectively improve the problem of the limited number of applications installed on the security chip 110.

[0046] The temporary objects of the cancellation cleanup class are dynamically allocated storage space in volatile memory 220. That is, when an application is selected, the temporary objects of the cancellation cleanup class will occupy corresponding storage space in volatile memory 220, and the corresponding storage space will be cleared when the application is deselected. In some scenarios, applications need to provide shared interfaces, but the application may not be in a selected state, thus restricting the application's access to volatile memory 220 through its shared interfaces.

[0047] In other implementations, application activation also includes the application acting as a server to provide shared interfaces to the client. For example, the server application defines shared interfaces for the client to call, enabling data transmission and interaction. For instance, a banking application might define a transfer service interface. The client can initiate a command APDU, which requests the server application to perform a transfer operation. Upon receiving the command APDU, the banking server application on the security chip 110 processes the request according to its internal logic and completes the transfer operation. Finally, the server application constructs a response APDU and sends it back to the client, providing feedback on the server's operation result on the command APDU. Compared to eliminating the dynamic allocation of storage space in volatile memory 220 for transient objects of the cleanup class, this implementation also eliminates the restriction that the application's shared interfaces cannot access volatile memory 220 when the application needs to provide shared interfaces.

[0048] like Figure 7 As shown, in other embodiments, the activated application may also create a new session type object when executing APDU instructions. In this embodiment, when the activated application executes APDU instructions to create a new session type object, it also loads the new session type object into the session storage space.

[0049] S130. In response to the application being deactivated, clear the storage space occupied by session type objects in the session storage space.

[0050] In some implementations, application deactivation includes, but is not limited to, application deselection and closing the logical channel where the application resides. This application's implementation dynamically allocates storage space in the volatile memory 220. When an application is deactivated, the session type object corresponding to that application (including session type objects created during the application's installation process and new session type objects created when the application executes APDU instructions) in the volatile memory 220 is cleaned up; that is, the storage space occupied by the session type object is released. The freed-up storage space can then be provided to other applications that require it, thereby improving the utilization efficiency of the volatile memory 220.

[0051] After activation, the application may need to execute one or more ADPU instructions. Executing ADPU instructions also creates objects for temporary computation or encryption / decryption, which require a certain amount of storage space in the volatile memory 220. For example... Figure 8 As shown, in some embodiments, the operation method provided by this application further includes S210-S230, as follows.

[0052] S210. Distribute the received Application Protocol Data Unit (APDU) instruction to the selected application.

[0053] The security chip 110 can distribute APDU instructions received from an external terminal device to the currently selected application for execution. In some implementations, when an application is in the selected state, after receiving the distributed APDU instructions, the application can create ephemeral objects for temporary computation or encryption / decryption as needed.

[0054] S220. Load the temporary type object into the temporary storage space of the volatile memory.

[0055] like Figure 9 As shown, in some embodiments, both the temporary storage space and the session storage space are storage spaces within the volatile memory 220 managed by the high-level language. The temporary storage space is used to store temporary type objects, and the session storage space is used to store session type objects.

[0056] S230. In response to the selected application ending, execute the APDU instruction to clear the storage space occupied by temporary type objects in the temporary storage space.

[0057] This application supports temporary type objects with a lifespan of APDU instructions. In scenarios where volatile memory 220 is temporarily needed in APDU instructions (e.g., caching intermediate data for encryption and decryption operations), temporary type objects can be stored in temporary storage space. The newly allocated temporary storage space achieves a more efficient utilization rate of volatile memory 220.

[0058] This application provides a security chip 110. The security chip 110 includes a processor 210, a volatile memory 220, and a non-volatile memory 230. The non-volatile memory 230 stores a computer program, which the processor 210 can execute. When the processor 210 executes the computer program, it can achieve the above-mentioned functions. Figures 6-8 The method shown in any one of the embodiments. Furthermore, the security chip 110 provided in this application can be applied to smart terminals (e.g., mobile phones), smart cards (e.g., bank cards, access control cards), car keys, smart locks, and other types of electronic devices.

[0059] In this embodiment, during application activation scenarios such as application selection and provision of shared interfaces to clients, storage space is allocated in the session storage space for the session type object corresponding to the application. Inactive applications will not occupy storage space in the volatile memory 220. The size of the storage space is the sum of the sizes of all session type objects corresponding to the application. This avoids transient objects occupying storage space in the volatile memory 220 after the security chip 110 is powered on, thus mitigating the problem of limited application installation capacity on the security chip. Furthermore, it eliminates the restriction that the application's shared interface cannot access the volatile memory 220 when the application needs to provide a shared interface.

[0060] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the descriptions of each embodiment in the above embodiments have different focuses. For parts not described in detail in a certain embodiment, refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0061] In the embodiments provided by this invention, it should be understood that the provided method can be implemented in other ways. For example, the division of a certain step is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0062] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0063] In the several embodiments provided in this application, it should be understood that the disclosed circuits, methods, and terminals can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.

[0064] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located on one device or distributed across multiple devices. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0065] In addition, the functional modules in the various embodiments of this application can be integrated into one device, or each module can exist physically separately, or two or more modules can be integrated into one device.

[0066] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks, SSDs), etc.

[0067] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for operating a security chip, characterized in that, include: Store the session type objects created by the application in non-volatile memory; In response to the application being activated, the session type object is loaded into the session storage space of the volatile memory.

2. The operating method according to claim 1, characterized in that, The application being activated includes: the application being selected, or the application acting as a server to provide a shared interface to the client.

3. The operating method according to claim 1 or 2, characterized in that, Also includes: In response to the application being deactivated, the storage space occupied by the session type object in the session storage space is cleared.

4. The operating method according to any one of claims 1-3, characterized in that, Also includes: Distribute received Application Protocol Data Unit (APDU) instructions to the selected application, the APDU instructions being used to instruct the selected application to create a temporary type object; Load the temporary type object into the temporary storage space of the volatile memory; In response to the selected application ending execution of the APDU instruction, the storage space occupied by the temporary type object in the temporary storage space is cleared.

5. The operating method according to claim 4, characterized in that, The APDU instruction further instructs the selected application to create a new session type object, and the operation method further includes: Load the new session type object into the session storage space; In response to the application being deactivated, the storage space occupied by the new session type object in the session storage space is cleared.

6. A method for operating a security chip, characterized in that, include: Distribute received Application Protocol Data Unit (APDU) instructions to the selected application, the APDU instructions being used to instruct the selected application to create a temporary type object; Load the temporary type object into the temporary storage space of the volatile memory; In response to the selected application ending execution of the APDU instruction, the storage space occupied by the temporary type object in the temporary storage space is cleared.

7. A security chip, characterized in that, Includes a processor, volatile memory, and non-volatile memory, wherein the processor is configured to: The session type object created by the application is stored in the non-volatile memory; In response to the application being activated, the session type object is loaded into the session storage space of the volatile memory.

8. The security chip according to claim 7, characterized in that, The application being activated includes: the application being selected, or the application acting as a server to provide a shared interface to the client.

9. The security chip according to claim 7 or 8, characterized in that, The processor is also configured to: In response to the application being deactivated, the storage space occupied by the session type object in the session storage space is cleared.

10. The security chip according to any one of claims 7-9, characterized in that, It also includes an interface circuit for receiving Application Protocol Data Unit (APDU) instructions; the processor is further configured to: The received APDU instruction is distributed to the selected application, the APDU instruction being used to instruct the selected application to create a temporary type object; Load the temporary type object into the temporary storage space of the volatile memory; In response to the selected application ending execution of the APDU instruction, the storage space occupied by the temporary type object in the temporary storage space is cleared.

11. The security chip according to claim 10, characterized in that, The APDU instruction also instructs the selected application to create a new session type object, and the processor is further configured to: Load the new session type object into the session storage space; In response to the application being deactivated, the storage space occupied by the new session type object in the session storage space is cleared.

12. A security chip, characterized in that, Includes a processor and volatile memory, the processor being configured to: Distribute received Application Protocol Data Unit (APDU) instructions to the selected application, the APDU instructions being used to instruct the selected application to create a temporary type object; Load the temporary type object into the temporary storage space of the volatile memory; In response to the selected application ending execution of the APDU instruction, the storage space occupied by the temporary type object in the temporary storage space is cleared.

13. An electronic device, characterized in that, The device includes a housing and a security chip as described in any one of claims 7-11 or 12, wherein the security chip is partially or wholly disposed within the housing.