A method, storage medium and system for improving the operating efficiency of a security chip

By specifying the object type in the multi-application chip operating system to determine the storage location, it solves the problems of slow update speed of NVM data and limited erase and write life, achieves fast access and flexible storage, and improves the operating efficiency and security of the security chip.

CN115562572BActive Publication Date: 2024-10-15BEIJING WATCH DATA SYSTEM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211045217.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2024-10-15
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

Existing multi-application chip operating systems have problems such as slow speed and limited erasing life when updating data in the non-volatile memory area (NVM), and cannot flexibly create instance objects and store them in the RAM area, resulting in problems in security application scenarios. Updates are not atomic enough, affecting efficiency and security.

Method used

By specifying the object type as content-persistent objects and content-ephemeral objects, and using high-level language methods, annotations, application programming interface methods, and class definition methods to determine the storage location of the object instance domain, the virtual machine checks the tag information when creating a new object to determine the storage location. Location, the object header is saved in NVM, and the object body is saved in RAM to achieve fast access and flexible storage.

Benefits of technology

It improves the execution speed of the application, reduces the number of NVM updates, extends the service life of the NVM, and improves the security of the application, especially when the intermediate results are frequently updated, the performance is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115562572B_ABST
    Figure CN115562572B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for improving the operating efficiency of a security chip, comprising the steps of: specifying the type of a newly created object; program execution of the operation of the newly created instance object; storing the object according to the type of the object. The present invention also provides a storage medium and a system for improving the operating efficiency of a security chip. The method, storage medium and system for improving the operating efficiency of a security chip according to the present invention can improve the execution speed of an application and reduce the number of NVM updates, thereby reducing the probability of NVM damage and increasing the service life of NVM.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of chip data storage, and in particular relates to a method, a storage medium and a system for improving the operating efficiency of a security chip. Background Art

[0002] In the field of chips (including smart cards, also known as security elements), multi-application chip operating systems that support dynamic download of applications have been widely deployed and used in the fields of finance, telecommunications, transportation, etc. Multi-application chip operating systems generally use high-level languages ​​to write application programs, which are compiled and converted into binary file formats supported by the chip operating system through compilers and related conversion tools, and can be downloaded and installed into the chip operating system for execution.

[0003] The virtual machine implemented in the existing multi-application chip operating system stores the newly created objects, arrays, and static fields of the application in the non-volatile storage area NVM. Even if the chip loses power, the stored data will not be lost, and the chip can continue to access the data after the next power-on. Updating data in NVM is slower than updating data in RAM, and when updating data, it is possible that only part of the data is updated due to power failure or hardware, firmware, and software reasons. This is unacceptable in security application scenarios. Therefore, additional mechanisms must be used to ensure the atomicity of sensitive data updates, which makes updating persistent data stored in NVM slower, and the number of NVM updates is also limited by the erase and write life. Therefore, for data that the application does not need to persist, such as intermediate calculation results, temporary data, etc., it is best to store them in RAM. Not only is the access speed fast, but the data will be cleared when the power is off, the chip is reset, or the application is deselected.

[0004] The existing chip operating system implementation also provides an API for creating volatile objects. The object headers created by the application by calling these APIs are stored in the NVM area, and the object body (object content) is stored in the RAM area. Since the content is stored in the RAM area, there is no need to consider transactions when accessing the object content. Therefore, the read and write access speed is faster than that of objects stored in the NVM area. However, the current API for creating volatile objects can only create arrays of specified types, and cannot create instance objects of a class whose instance fields can be stored in the RAM area. Summary of the invention

[0005] In view of the defects existing in the prior art, the purpose of the present invention is to provide a method, storage medium and system for improving the operating efficiency of a security chip so as to increase the flexibility of applications in using storage space, improve the execution efficiency of applications, increase the service life of NVM and improve the security of applications.

[0006] To achieve the above purpose, the technical solution adopted by the present invention is: a method for improving the operating efficiency of a security chip, comprising the steps of: specifying the type of a newly created object; program execution of the operation of creating a new instance object; storing the object according to the type of the object.

[0007] Furthermore, methods for specifying the type of a newly created object include a high-level programming language method, an annotation method, an application programming interface method, and a class definition method.

[0008] Furthermore, the high-level language method needs to add keywords, the virtual machine adds or expands the new object instruction, and the high-level language compiler generates new or expanded new object instructions for the new keywords.

[0009] Furthermore, the annotation method requires the instance field to be marked, and the class conversion tool needs to add corresponding tags to the class definition information of the marked instance field to specify the storage location of the instance field of the newly created object. When the virtual machine creates a new object, it needs to first check the tag of the corresponding class and then determine the type of the newly created object.

[0010] Furthermore, the application programming interface method needs to define a specified method to modify the default type of a newly created object. When the virtual machine creates a new object, it needs to first check the corresponding new object type and create the specified new object type, or it needs to define a specified method to create a content transient object. The specified method needs to have one or more input parameters with the fully qualified name of the specified class.

[0011] Furthermore, the class definition method is that when a virtual machine creates a new class object instance, it checks whether the class inherits a specific type of superclass or implements a specific marker interface, and places the newly created object instance domain in a specific position based on the check result.

[0012] Furthermore, the types of storage include non-volatile storage and volatile storage.

[0013] Furthermore, the objects are divided into content persistent objects and content transient objects. The objects include an object header and an object body. The instance object header stores information about the security attributes of the object, the class to which the object belongs, and the package in which the class is located. The array object header stores information about the security attributes of the array, the type of the array, and the number of array elements. The object body is used to store all instance domains of the object or all elements of the array. The object body of the content persistent object is stored in the NVM, while the object body of the content transient object is stored in the RAM.

[0014] The present invention also provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method for improving the operating efficiency of a security chip when running.

[0015] The present invention also provides a system for improving the operating efficiency of a security chip, comprising: an object type specifying module for specifying the type of a newly created object; an object creating module for a program to execute operations on the newly created object; an object access module for reading and writing access to the object; and an object recycling module for recycling garbage objects.

[0016] The present invention has the effect of improving the execution speed of applications, especially significantly improving the performance of operations that frequently update intermediate results, and reducing the number of NVM updates, thereby reducing the probability of NVM damage and increasing the service life of NVM. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 The present invention is a flowchart of the steps of a method for improving the operating efficiency of a security chip.

[0018] Figure 2 The present invention's content transient object and content persistent object storage method diagram DETAILED DESCRIPTION

[0019] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments.

[0020] like Figure 1-2 As shown, the present invention provides a method for improving the operating efficiency of a security chip, which comprises the steps of:

[0021] S1, specifies the type of the new object;

[0022] Specifically, objects are divided into content persistent objects and content transient objects, among which, content persistent objects: virtual machines implemented by resource-constrained devices, such as SE, create objects that are stored in non-volatile memory NVM, and the content will not be lost after SE is powered off. This type of object is referred to as content persistent objects or simply objects in this article. Updates to object instance domains usually need to ensure atomicity, and updates to multiple instance domains need to be guaranteed atomicity through transaction application programming interfaces, so read and write access to instance domains is slow.

[0023] Content-transient objects: The object header is saved to the non-volatile area NVM, while the object body that saves the object instance field (and array elements) is stored in the RAM area. The RAM area can be divided into a memory area (DTR area) that is cleared when the application cancels the selection and a memory area (RTR area) that is cleared when the SE is reset, depending on the event that causes the content to be cleared. Compared with regular objects, updating the instance field does not require atomicity guarantees. Therefore, accessing the instance field of content-transient objects is very fast, which is very suitable for scenarios where a small amount of temporary (or intermediate result) data needs to be modified frequently but does not need to cross selection sessions.

[0024] An object usually consists of two parts: an object header and an object body. The instance object header stores information such as the object's security attributes, the class to which the object belongs, and the package in which the class is located. The array object header stores information such as the array object's security attributes, the array type, and the size of the array elements. The object body is used to store all instance fields of the object or all elements of the array. The object body of a persistent object is stored in NVM, while the object body of a transient object is stored in RAM.

[0025] Before creating a new object, you can specify the type of the new object as a content persistent object or a content transient object, so that the corresponding object can be stored in the corresponding storage area.

[0026] Further, the method of specifying the type of the newly created object includes a high-level programming language method: adding a keyword for specifying the type when creating a new class object instance or array;

[0027] Annotation method: annotate a certain instance field of a class to indicate that all instance fields of the class are placed in the RAM area;

[0028] Application programming interface method: Before creating a new object, call the application programming interface provided by the system to specify the object type when creating a new object subsequently; or define a specified method to create a content transient object, and the specified method requires one or more input parameters with the fully qualified name of the specified class.

[0029] Class definition method: When the virtual machine creates a new class object instance, it checks whether the class inherits a specific type of superclass or implements a specific marker interface, and places the newly created object instance domain in a specific location based on the check results.

[0030] Furthermore, the high-level language method needs to add keywords, the virtual machine adds or expands the new object instruction, and the high-level language compiler generates new or expanded new object instructions for the new keywords.

[0031] Taking a specific example as an example, adding keywords: adding keywords dtr / rtr is used to specify the type of a newly created class object instance or array, such as new dtr is a newly created object or array of the DTR type, and new rtr is a newly created object or array of the RTR type.

[0032] The virtual machine is implemented by adding new instructions or extending existing new object instructions. For example, taking the extension of existing new object instructions as an example, new class reference (2 sections) memory type (1 byte); the class reference specifies the information of the class to create an instance object; the memory type can be Flash, DTR or RTR type.

[0033] The compiler implementation needs to modify the compiler's lexical analyzer, syntax analyzer, and code generation parts to directly generate the corresponding new object instructions.

[0034] Furthermore, the annotation method requires the instance fields to be marked. The class conversion tool needs to add corresponding tags to the class definition information of the marked instance fields to specify the storage location of the instance fields of the newly created object. When the virtual machine creates a new object, it needs to first check the tag of the corresponding class and then determine the type of the newly created object.

[0035] Take a specific example as an example. Take the Java source file as an example. The following annotation is provided before the instance field definition:

[0036] @RamInstanceField(RamInstanceFieldType=DTR) or

[0037] @RamInstanceField(RamInstanceFieldType=RTR)

[0038] The Class file generated by compiling the Java file contains the RuntimeVisibleAnnotations attribute for the instance field in the field_info. The conversion tool parses the instance field in the class to determine whether the attribute is included. It can be determined whether the user has marked the instance field. If so, it can be determined whether the storage is of DTR or RTR type. If an instance field of a class is marked, a flag is added to the definition class of the instance field to indicate the storage location of the object instance field when a new class instance object is created.

[0039] When writing applications in the Java high-level programming language, annotations are used to specify the storage location when declaring instance fields in the code. In this way, in the generated process file, the instance field has an annotation attribute, and the attribute value specifies the specific storage location.

[0040] When creating a new object, you need to check the flag information of the storage location of the object instance domain of the class, and create a new object of the specified type based on this flag information.

[0041] Furthermore, a preferred embodiment is described below using an application programming interface.

[0042] A specified method needs to be defined to modify the default type of a newly created object. When a virtual machine creates a new object, it needs to first check the corresponding new object type and create the specified new object type.

[0043] Before creating a new object, you can call the application programming interface provided by the system to specify the object type when creating new objects subsequently.

[0044] The SESystem class defines the following static method setNewObjectType(type):

[0045] The input parameter type of the method specifies the type of storage area, which can be Flash, DTR or RTR.

[0046] The default type of a new object is TYPE_FLASH. The application can modify the default type of a new object by calling this method. The virtual machine implements recording the type of the new object set by the SESystem.setNewObjectType method. When a new object is created, it is created based on the current object type. The object header of the object needs to record the object type.

[0047] Still further, another embodiment is described by means of an application programming interface.

[0048] The SESystem class defines methods for creating Transient objects of a specified type, static public makeDesectTransientObject(byte[]className, short offset, short length); static public makeResetTransientObject(byte[]className, short offset, short length);

[0049] className is the fully qualified name of the class. For example, the fully qualified name of the class tgomos.base.Object is the ASCII-encoded string tgomos / base / Object.

[0050] The makeXXXTransientObject static method call is specially processed as follows:

[0051] 1) The value of the method parameter needs to be modified. The fully qualified name of the class is replaced with a 2-byte class export item identifier (the class of the imported package) or a method segment offset (the declaration of this package)

[0052] Adjust the array assignment operation instruction putarray-b before calling the makeXXXTransientObject static method.

[0053] 2) The static method call is converted to the instruction newTransientObject.

[0054] Furthermore, when a virtual machine creates a new class object instance, the class definition method checks whether the class inherits a specific type of superclass or implements a specific marker interface, and places the newly created object instance domain in a specific position based on the check result.

[0055] S2, the program executes the operation of creating a new instance object;

[0056] Specifically, after specifying the object type, the program executes operations to create a new instance object, including array operations.

[0057] S3, stores objects according to their types;

[0058] Specifically, the storage types include non-volatile storage and volatile storage, as described in Table 1.

[0059]

[0060]

[0061] Table 1

[0062] It can be understood that by proposing a variety of implementable methods, when creating an instance object of a specified class, its instance domain can be specified to be stored in NVM or RAM area. If stored in RAM area, the access speed of the instance domain of the specified object can be improved, thereby improving application execution performance.

[0063] For some sensitive data, such as data for generating session keys, it is not desired to save it in non-volatile memory for security reasons, and you can choose to put it in the RAM instance domain.

[0064] Content ephemeral objects of specified classes can be used together with content ephemeral objects of array type. For intermediate results that need to use multiple different types, creating content ephemeral objects of specified classes is more flexible than creating content ephemeral objects of array type. Because different instance field names can be used for different types, the code using content ephemeral objects of specified classes is more readable and RAM usage is more efficient.

[0065] The present invention also provides a system for improving the operating efficiency of a security chip, which comprises:

[0066] Object type specification module, used to specify the type of the newly created object;

[0067] Object creation module, the program executes the operation of creating new objects with data;

[0068] Object access module, used for read and write access to objects;

[0069] Object recycling module, used for recycling garbage objects.

[0070] It can be seen from the above embodiments that the present invention can improve the execution speed of applications, especially in the case of frequent updates of intermediate results, the performance is significantly improved, and the number of NVM updates is reduced, thereby reducing the probability of NVM damage and increasing the service life of NVM.

[0071] The method and system described in the present invention are not limited to the embodiments described in the specific implementation manner. Those skilled in the art may derive other implementation manners based on the technical solution of the present invention, which also fall within the technical innovation scope of the present invention.

Claims

1. A method for improving the operating efficiency of a security chip, It is characterized in that Includes steps: Specify the type of the new object; The program executes the operation of creating a new instance object; Store objects according to their type; Among them, the methods of specifying the type of the newly created object include a high-level programming language method, an annotation method, an application programming interface method, and a class definition method; The class definition method is that when a virtual machine creates a new class object instance, it checks whether the class inherits a specific type of superclass or implements a specific marker interface, and places the newly created object instance domain into a specific type of storage location based on the check result.

2. A method for improving the operating efficiency of a security chip as claimed in claim 1, Features: The high-level programming language method needs to add keywords to specify the type of a new class object instance or array, the virtual machine adds or expands the new object instruction, and the high-level language compiler generates new or expanded new object instructions for the new keywords.

3. A method for improving the operating efficiency of a security chip as claimed in claim 1, Features: The annotation method requires the instance field to be marked, and the class conversion tool needs to add corresponding tags to the class definition information of the marked instance field to specify the storage location of the instance field of the newly created object. When the virtual machine creates a new object, it needs to first check the tag of the corresponding class and then determine the type of the newly created object.

4. A method for improving the operating efficiency of a security chip as claimed in claim 1, Features: The application programming interface method needs to define a specified method to modify the default type of a newly created object. When the virtual machine creates a new object, it needs to first check the corresponding new object type and create the specified new object type, or it needs to define a specified method to create a content transient object. The specified method needs to have one or more input parameters with the fully qualified name of the specified class.

5. A method for improving the operating efficiency of a security chip as claimed in claim 1, Features : The types of storage include non-volatile storage and volatile storage.

6. A method for improving the operating efficiency of a security chip as claimed in claim 1, Features : The objects are divided into content persistent objects and content transient objects. The objects include an object header and an object body. The instance object header stores the object's security attributes, the class to which the object belongs, and the package information where the class is located. The array object header stores the object's security attributes, array type information, and the size of the array elements. The object body is used to store all instance fields of the object or all elements of the array. The object body of the content persistent object is stored in the NVM, while the object body of the content transient object is stored in the RAM.

7. A storage medium, Features: The storage medium stores a computer program, wherein the computer program is configured to execute the method for improving the operating efficiency of a security chip as described in any one of claims 1 to 6 when running.

8. A system for improving the operating efficiency of a security chip, It is characterized in that include: Object type specification module, used to specify the type of the newly created object; The object creation module is used by the program to execute the operation of creating a new object; Object access module, used for read and write access to objects; Object recycling module, used for recycling garbage objects; Among them, the methods of specifying the type of the newly created object include a high-level programming language method, an annotation method, an application programming interface method, and a class definition method; The class definition method is that when a virtual machine creates a new class object instance, it checks whether the class inherits a specific type of superclass or implements a specific marker interface, and places the newly created object instance domain into a specific type of storage location based on the check result.