CN108376052B - Data processing method and device for security chip - Google Patents

Data processing method and device for security chip Download PDF

Info

Publication number
CN108376052B
CN108376052B CN201711340544.2A CN201711340544A CN108376052B CN 108376052 B CN108376052 B CN 108376052B CN 201711340544 A CN201711340544 A CN 201711340544A CN 108376052 B CN108376052 B CN 108376052B
Authority
CN
China
Prior art keywords
data
storage area
write
write operation
operation request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711340544.2A
Other languages
Chinese (zh)
Other versions
CN108376052A (en
Inventor
徐平江
赵东艳
王于波
袁艳芳
付青琴
张键强
郭敬宇
付丽莉
张彦荣
何旭杰
张萌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Corp of China SGCC
State Grid Information and Telecommunication Co Ltd
Beijing Smartchip Microelectronics Technology Co Ltd
Electric Power Research Institute of State Grid Ningxia Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
State Grid Information and Telecommunication Co Ltd
Beijing Smartchip Microelectronics Technology Co Ltd
Electric Power Research Institute of State Grid Ningxia Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Corp of China SGCC, State Grid Information and Telecommunication Co Ltd, Beijing Smartchip Microelectronics Technology Co Ltd, Electric Power Research Institute of State Grid Ningxia Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN201711340544.2A priority Critical patent/CN108376052B/en
Publication of CN108376052A publication Critical patent/CN108376052A/en
Application granted granted Critical
Publication of CN108376052B publication Critical patent/CN108376052B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools

Abstract

The invention relates to a data processing method and a data processing device of a security chip, wherein the data processing method comprises the following steps: acquiring a write operation request, wherein the write operation request comprises a request identifier of the write operation request and an actual storage address of write data corresponding to the write operation request; and storing the write data corresponding to the write operation request into a first storage area according to the request identifier of the write operation request, setting a recovery identifier, storing the write data stored in the first storage area into a second storage area according to the actual storage address of the write data, and clearing the recovery identifier. According to the data processing method of the security chip, provided by the invention, the written data are respectively processed when the written data are not stored in the second storage area and when the written data are already stored in the second storage area, so that the protection of key data in the security chip under an abnormal condition is realized, and the reliability of the security chip is improved.

Description

Data processing method and device for security chip
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a data processing method and apparatus for a security chip.
Background
Currently, security chips are becoming more and more popular in people's lives. Mobile phone cards, bank cards, water cards, electric cards, social security cards, access control cards and even identity cards are all applications of security chips in different industries. With the increase of the use of the security chip, the data stored in the security chip is more and more important, so the processing method of the data in the security chip seriously affects the reliability of the security chip.
In a method for processing data in a security chip in the prior art, when data is written, the data is directly written into a storage area of the security chip. If the security chip is storing the service data, that is, writing data, at this time, an unexpected power failure may cause a part of the data to be written completely, and a part of the data is not written yet. For example, a user charges the electric meter with the electric card, pulls out the electric card after waiting for two seconds, and if the electric card is writing a file at the moment of pulling out, half of service data may be stored as newly written data and the rest of data is still old data in case of unexpected power failure of the electric card.
Based on this, the inventor of the present invention finds that, in the data processing method in the prior art, when the write data of the security chip is unexpectedly powered down, half of the service data stored in the security chip may be stored as the newly written data while the rest of the service data is still the old data, which may cause confusion of the user data of the security chip and seriously affect the reliability of the security chip.
The information disclosed in this background section is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person skilled in the art.
Disclosure of Invention
Technical problem
In view of this, the technical problem to be solved by the present invention is how to provide a data processing method and apparatus for a security chip, so as to solve the problem that in the data processing method in the prior art, when data writing of the security chip is unexpectedly powered off, user data of the security chip is confused.
Solution scheme
To solve the above technical problem, the present invention provides, in a first aspect, a data processing method for a secure chip, including: acquiring a write operation request, wherein the write operation request comprises a request identifier of the write operation request and an actual storage address of write data corresponding to the write operation request; storing write data corresponding to the write operation request into a first storage area according to the request identifier of the write operation request, and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address; setting a recovery identifier, and storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data; clearing the recovery flag after storing the write data stored in the first storage area into the second storage area.
In a possible implementation manner, if the security chip is powered down before the recovery identifier is cleared, the data processing method further includes: when the safety chip is powered on again after power failure, judging whether the recovery mark exists or not; if the recovery identifier exists, storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data; initializing data stored in the first storage area and clearing the recovery flag.
In a possible implementation manner, the storing the write data corresponding to the write operation request into a first storage area, and storing a correspondence between a storage address of the write data in the first storage area and the actual storage address includes: acquiring a write operation identifier; judging whether the write operation identification bit is set; if the write operation identification position is set, storing the write data into the first storage area according to the request identification of the write operation request; and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address in the first storage area.
In a possible implementation manner, after the determining whether the write operation identification bit is set, the method further includes: if the write operation identification bit is not set, setting the write operation identification bit; and storing the write data into the first storage area according to the request identification of the write operation request.
In a possible implementation manner, the write operation request further includes a clear instruction; after storing the correspondence between the storage address of the write data in the first storage area and the actual storage address, the method further includes: and resetting the write operation identification bit according to the clearing instruction.
In one possible implementation manner, the data processing method further includes: acquiring a read operation request, and judging whether a corresponding relation matched with an actual storage address of read data is stored in the first storage area, wherein the read operation request comprises: reading the actual storage address of the data; if the first storage area stores a corresponding relation matched with the actual storage address of the read data, acquiring the storage address in the first storage area corresponding to the actual storage address of the read data according to the corresponding relation; and reading data according to the storage address in the first storage area.
In a possible implementation manner, after the determining whether the first storage area stores a corresponding relationship matching an actual storage address of read data, the method further includes: and if the first storage area does not have the corresponding relation matched with the actual storage address of the read data, reading the data according to the actual storage address of the read data.
In a possible implementation manner, the storing the correspondence between the storage address of the write data in the first storage area and the actual storage address includes: and storing the corresponding relation between the storage address of the written data in the first storage area and the actual storage address in a linked list mode.
In a possible implementation manner, the storing the write data corresponding to the write operation request into a first storage area, and storing a correspondence between a storage address of the write data in the first storage area and the actual storage address includes: when the write operation request corresponding to the request identifier of the write operation request is a preset write operation request, storing write data corresponding to the write operation request into a first storage area, and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address.
To solve the above technical problem, the present invention provides, in a second aspect, a data processing apparatus of a security chip, including: the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a write operation request, and the write operation request comprises a request identifier of the write operation request and an actual storage address of write data corresponding to the write operation request; the first storage module is used for storing write data corresponding to the write operation request into a first storage area according to the request identifier of the write operation request, and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address; the second storage module is used for setting a recovery identifier and storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data; the second storage module is further configured to clear the recovery flag after the write data stored in the first storage area is stored in the second storage area.
Advantageous effects
According to the data processing method and device of the security chip, the written data corresponding to the write operation request are stored in the first storage area, and the corresponding relation between the storage address of the written data in the first storage area and the actual storage address is stored; and setting a recovery identifier, storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data, and clearing the recovery identifier, so that the data is stored in a partitioned manner, and the write-in data is respectively processed when the write-in data is not stored into the second storage area and is already stored into the second storage area, so that the key data in the security chip is protected under an abnormal condition, and the reliability of the security chip is improved.
Other features and aspects of the present invention will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments, features, and aspects of the invention and, together with the description, serve to explain the principles of the invention.
Fig. 1 is a flowchart illustrating a data processing method of a security chip according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a data processing method of a security chip according to another embodiment of the present invention;
fig. 3 is a flowchart illustrating a data processing method of a security chip according to another embodiment of the present invention;
fig. 4 is a flowchart illustrating a data processing method of a security chip according to another embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data processing apparatus of a secure chip according to an embodiment of the present invention.
Detailed Description
The following detailed description of the present invention is provided in conjunction with the accompanying drawings, but it should be understood that the scope of the present invention is not limited to the specific embodiments.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. Throughout the specification and claims, unless explicitly stated otherwise, the word "comprise", or variations such as "comprises" or "comprising", will be understood to imply the inclusion of a stated element or component but not the exclusion of any other element or component.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present invention. It will be understood by those skilled in the art that the present invention may be practiced without some of these specific details. In some instances, methods, means, elements well known to those skilled in the art have not been described in detail so as not to obscure the present invention.
Example 1
Fig. 1 is a flowchart illustrating a data processing method of a secure chip according to an embodiment of the present invention, where as shown in fig. 1, the method includes:
step S1, acquiring a write operation request, where the write operation request includes a request identifier of the write operation request and an actual storage address of write data corresponding to the write operation request.
Specifically, the security chip is used in cooperation with a card operating system, and the card operating system is responsible for managing chip hardware resources and providing various functions specified by a user manual for a chip user.
The method includes the steps of obtaining a write operation request sent by a card operating system, wherein the write operation request may include a storage operation request. And the write operation request corresponds to the request identifier one by one.
Step S2, storing the write data corresponding to the write operation request into a first storage area according to the request identifier of the write operation request, and storing the corresponding relationship between the storage address of the write data in the first storage area and the actual storage address.
Specifically, the write operation request includes a source address, an actual memory address, and a length of the write data. The source address corresponds to a storage address of the write data in the first storage area. Each write requires space to be applied in the first storage area to store the data.
The corresponding relation between the storage address of the written data in the first storage area and the actual storage address can be stored in a linked list mode. And space allocation in the first storage area is performed according to the address and length of the write data.
And step S3, setting a recovery identifier, and storing the write data stored in the first storage area into the second storage area according to the actual storage address of the write data.
Specifically, the actual storage address is an address pointing into the second storage area. By determining whether the recovery flag exists, it can be determined whether the write data has already been stored in the actual storage address.
Step S4, after the write data stored in the first storage area is stored in the second storage area, the recovery flag is cleared.
The recovery identifier is used for indicating that the written data is not completely stored in the second storage area, and the existence of the recovery identifier indicates that the written data is not completely imported from the first storage area to the second storage area. The recovery flag may be a fixed flag, such as AABB, 1122, etc., or may be a CRC value or an exclusive or value obtained by operating on the write data.
It should be noted that, the method in this embodiment is executed after the secure chip is powered on, that is, connected to the card operating system of the secure chip. The presence of the resume flag indicates that the import of the write data from the first storage area to the second storage area is not complete.
The data processing method of the security chip stores the write-in data corresponding to the write operation request into a first storage area, and stores the corresponding relation between the storage address of the write-in data in the first storage area and the actual storage address; and setting a recovery identifier, storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data, and clearing the recovery identifier, so that the data is stored in a partitioned manner, and the write-in data is respectively processed when the write-in data is not stored into the second storage area and is already stored into the second storage area, so that the key data in the security chip is protected under an abnormal condition, and the reliability of the security chip is improved.
In a possible implementation manner, step S2 may specifically include: when the write operation request corresponding to the request identifier of the write operation request is a preset write operation request, storing write data corresponding to the write operation request into a first storage area, and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address.
The preset write operation request may include a write operation request that needs to be protected.
Specifically, there are some write operations of files in the business application, some data of which are important and need to ensure the security and reliability of data writing, and it can be determined whether the write operation request corresponding to the request identifier is a write operation request that needs to be protected or not by identifying the request.
Correspondingly, when the write operation request corresponding to the request identifier is not a preset write operation request, and the write operation request corresponding to the request identifier is a write operation request which does not need to be protected, the write data corresponding to the write operation request is stored in the second storage area according to the actual storage address.
According to the data processing method of the security chip, provided by the invention, by judging that an operation request is a write operation request needing to be protected, when the operation request corresponding to the request identifier is the write operation request needing to be protected, write-in data corresponding to the write operation request is stored in a first storage area, and the corresponding relation between the storage address of the write-in data in the first storage area and the actual storage address is stored; when the operation request corresponding to the request identifier is a write operation request which does not need to be protected, the write data corresponding to the write operation request is stored in a second storage area according to the actual storage address, the write data are respectively stored according to the type of the operation request, and unimportant data are directly stored, so that the processing efficiency of the security chip is improved, and the reliability of the security chip is further ensured.
Example 2
Fig. 2 is a flowchart illustrating a data processing method of a security chip according to another embodiment of the present invention, and steps in fig. 2 that use the same reference numerals as those in fig. 1 are all the same as those in fig. 1 for the same text description, and are not repeated herein. This example further defines the first embodiment.
In this embodiment, if the security chip loses power before the recovery identifier is cleared, the data processing method may further include:
and step S51, judging whether the recovery mark exists when the safety chip is powered on again after power failure.
Step S52, if the recovery flag exists, storing the write data stored in the first storage area into the second storage area according to the actual storage address of the write data.
Step S53, initializing the data stored in the first storage area and clearing the recovery flag.
Wherein, the power down may include disconnection of the security chip from the card operating system of the security chip.
Specifically, if the power failure of the security chip occurs when the data in the first storage area is transferred to the second storage area, the recovery identifier already exists at this time, the system checks that the recovery identifier exists after the power is turned on again, the data in the first storage area is transferred to the second storage area again, and the flag is cleared and the first storage area is initialized after the power is successfully turned off. This ensures that the data is successfully written in the event of a power failure. The presence of the resume flag indicates that the import of the write data from the first storage area to the second storage area is not complete. Accordingly, if the recovery flag does not exist, the steps S52 and S53 are not executed.
Therefore, by judging whether the recovery identifier exists or not, if the recovery identifier exists, the written data stored in the protection area is stored in the actual storage address of the written data, the data is stored in a partitioned mode, the written data are processed when the written data are not stored in the second storage area and when the written data are stored in the second storage area, the key data in the safety chip are protected under the abnormal condition, and the reliability of the safety chip is improved.
Example 3
Fig. 3 is a flowchart illustrating a data processing method of a security chip according to another embodiment of the present invention, and steps in fig. 3 that use the same reference numerals as those in fig. 1 are all the same as those in fig. 1 for the same text description, and are not repeated herein. This example further defines the first embodiment.
In this embodiment, step S3 may specifically include:
in step S31, a write operation flag is acquired.
Step S32, determine whether the write flag bit is set.
Step S33, if the write operation flag bit is set, storing the write data in the first storage area according to the request flag of the write operation request.
Specifically, whether a write operation is currently being performed can be determined by whether the write operation flag is set. This may be accomplished by setting the write operation identification to a global variable.
Step S34, if the write operation flag bit is not set, setting the write operation flag bit, and storing the write data in the first storage area according to the request flag of the write operation request.
Specifically, if the write operation flag bit is not set, it indicates that no write operation has been executed before, the write operation flag bit is set, and the write operation process starts.
Step S35, storing the corresponding relationship between the storage address of the written data in the first storage area and the actual storage address in the first storage area.
In particular, the writing of the service data may be divided into several times to write different files. And when the step corresponding to the write operation request is one of a series of steps, judging whether the write operation identification bit is set. If the write operation identification position is set, the current write flow is non-first-time write, and the write data is stored in the first storage area according to the request identification of the write operation request. If the write operation identification bit is not set, it indicates that no write operation is executed before, and the write operation is the first write operation. And storing the write data into the first storage area according to the request identification of the write operation request.
In a possible implementation manner, the write operation request may further include a clear instruction.
When the write operation request may further include a clear instruction, step S35 may further include:
and step S36, resetting the write operation identification bit according to the clearing instruction.
Specifically, when the step corresponding to the write operation request is the last step of a series of steps, the write operation request may include a clear instruction, for example, the write operation request is user registration, when the last step of user registration is executed, the write operation request may further include a clear instruction, and after the instruction is executed, the write operation flag is reset.
The setting and the resetting are two states of the write operation identification bit respectively, and can be realized by setting the setting to be 1 and the resetting to be 0.
During the execution of steps S31-S36, if the security chip is powered off, the write flag is reset. That is, if a power failure occurs during the execution of the write operation, the write data is not completely written into the first storage area, after the power-on check recovery flag is re-turned on, it indicates that no data needs to be recovered, and the system operates normally after initializing the data in the first storage area. The write operation can be abandoned at any time in the write operation process, and the service data is guaranteed not to be confused although the data write fails.
Therefore, in the data processing method of the security chip provided by the invention, when the write operation identification bit is set, if the write operation identification bit is not set, the write operation identification bit is set; and storing the write data into the first storage area according to the request identification of the write operation request. And storing the corresponding relation between the storage address of the write-in data in the first storage area and the actual storage address in the first storage area, so that the key data in the security chip is protected under an abnormal condition, and the reliability of the security chip is improved.
Example 4
Fig. 4 is a flowchart illustrating a data processing method of a security chip according to another embodiment of the present invention, and steps in fig. 4 that use the same reference numerals as those in fig. 1 are all the same as those in fig. 1 for the same text description, and are not repeated herein. In this embodiment, on the basis of the above embodiments, a reading method of the security chip is further defined. The data processing method in this embodiment further includes:
step S61, obtaining a read operation request, and determining whether the first storage area stores a corresponding relationship matching an actual storage address of read data, where the read operation request includes: the actual memory address of the data is read.
Step S62, if the first storage area stores a corresponding relationship matching the actual storage address of the read data, acquiring the storage address in the first storage area corresponding to the actual storage address of the read data according to the corresponding relationship.
Specifically, if the first storage area stores a correspondence that matches the actual storage address of the read data, it indicates that the data is not transferred from the first storage area to the second storage area, and data is stored in the first storage area.
In step S63, data is read according to the storage address in the first storage area.
Step S64, if there is no corresponding relationship matching the actual storage address of the read data in the first storage area, reading the data according to the actual storage address of the read data.
The execution sequence of step S61 may be executed after or simultaneously with any step in fig. 4, and fig. 4 is only one implementation manner and does not limit the execution sequence.
Of course, if the first storage area stores a correspondence relationship matching the actual storage address of the read data, it is also possible that a part of the data is stored in the first storage area and another part of the data is stored in the second storage area. At this time, part of the data is read according to the storage address in the first storage area, and the other part of the data is read according to the actual storage address of the read data.
It should be noted that, in the present embodiment, data reading is divided into three cases. In this case, the data can be read based on the actual storage address of the read data. The second case is that the secure chip is powered down when the data in the first storage area is transferred to the second storage area, that is, powered down during the execution of step S3, and the data is all stored in the first storage area. The third situation is that when the content of the update file is written, the data to be updated is stored in the first storage area and is not transferred to the second storage area, and the data which is stored last time is stored in the second storage area, so that a part of the data in the update file is stored in the first storage area and a part of the data in the update file is stored in the second storage area. The reading method provided by the embodiment can realize the reading of the data under the three conditions.
Therefore, according to the data processing method of the security chip provided by the invention, whether the corresponding relation matched with the actual storage address of the read data is stored in the first storage area or not is judged, and if the corresponding relation matched with the actual storage address of the read data is stored in the first storage area, the storage address in the first storage area corresponding to the actual storage address of the read data is acquired according to the corresponding relation, so that the data is read. And if the first storage area does not have the corresponding relation matched with the actual storage address of the read data, reading the data according to the actual storage address of the read data. Accurate reading of data can be achieved.
Example 5
Fig. 5 is a schematic structural diagram of a data processing apparatus of a security chip according to an embodiment of the present invention, and as shown in fig. 5, the apparatus 10 includes:
the obtaining module 1 is configured to obtain a write operation request, where the write operation request includes a request identifier of the write operation request and an actual storage address of write data corresponding to the write operation request.
Specifically, the security chip is used in cooperation with a card operating system, and the card operating system is responsible for managing chip hardware resources and providing various functions specified by a user manual for a chip user.
The method includes the steps of obtaining a write operation request sent by a card operating system, wherein the write operation request may include a storage operation request. And the write operation request corresponds to the request identifier one by one.
The first storage module 2 is configured to store, according to the request identifier of the write operation request, write data corresponding to the write operation request in a first storage area, and store a correspondence between a storage address of the write data in the first storage area and the actual storage address.
Specifically, the write operation request includes a source address, an actual memory address, and a length of the write data. The source address corresponds to a storage address of the write data in the first storage area. Each write requires space to be applied in the first storage area to store the data.
The corresponding relation between the storage address of the written data in the first storage area and the actual storage address can be stored in a linked list mode. And space allocation in the first storage area is performed according to the address and length of the write data.
The second storage module 3 is configured to set a recovery identifier, and store the write data stored in the first storage area into the second storage area according to the actual storage address of the write data;
the second storage module 3 is further configured to clear the recovery flag after the write data stored in the first storage area is stored in the second storage area.
Specifically, the actual storage address is an address pointing into the second storage area. By determining whether the recovery flag exists, it can be determined whether the write data has already been stored in the actual storage address.
The recovery identifier is used for indicating that the written data is not completely stored in the second storage area, and the existence of the recovery identifier indicates that the written data is not completely imported from the first storage area to the second storage area. The recovery flag may be a fixed flag, such as AABB, 1122, etc., or may be a CRC value or an exclusive or value obtained by operating on the write data.
The device in this embodiment may be disposed on a security chip for use.
The data processing device of the security chip stores the written data corresponding to the write operation request into a first storage area, and stores the corresponding relation between the storage address of the written data in the first storage area and the actual storage address; and setting a recovery identifier, storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data, and clearing the recovery identifier, so that the data is stored in a partitioned manner, and the write-in data is respectively processed when the write-in data is not stored into the second storage area and is already stored into the second storage area, so that the key data in the security chip is protected under an abnormal condition, and the reliability of the security chip is improved.
The foregoing descriptions of specific exemplary embodiments of the present invention have been presented for purposes of illustration and description. It is not intended to limit the invention to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teaching. The exemplary embodiments were chosen and described in order to explain certain principles of the invention and its practical application to enable one skilled in the art to make and use various exemplary embodiments of the invention and various alternatives and modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims and their equivalents.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.

Claims (8)

1. A data processing method of a security chip is provided, wherein the security chip is applied to a card and used in cooperation with a card operating system, and the data processing method of the security chip comprises the following steps:
acquiring a write operation request, wherein the write operation request comprises a request identifier of the write operation request and an actual storage address of write data corresponding to the write operation request; and
when the write operation request corresponding to the request identifier of the write operation request is a preset write operation request, storing write data corresponding to the write operation request into a first storage area, and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address; setting a recovery identifier, and storing the write-in data stored in the first storage area into a second storage area according to the actual storage address of the write-in data; clearing the recovery flag after storing the write data stored in the first storage area into the second storage area;
the data processing method of the security chip further comprises the following steps: when the write operation request corresponding to the request identifier is not a preset write operation request, storing write data corresponding to the write operation request into a second storage area according to the actual storage address;
wherein, if the power of the security chip is lost before the recovery identifier is cleared, the data processing method further comprises:
when the safety chip is powered on again after power failure, judging whether the recovery mark exists or not, wherein the power failure comprises disconnection between the safety chip and a card operating system of the safety chip;
if the recovery identifier exists, storing the write-in data stored in the first storage area into the second storage area according to the actual storage address of the write-in data; initializing data stored in the first storage area and clearing the recovery identification; and if the recovery identifier does not exist, initializing the data stored in the first storage area.
2. The data processing method according to claim 1, wherein the write data corresponding to the write operation request is stored in a first storage area, and storing the correspondence between the storage address of the write data in the first storage area and the actual storage address comprises:
acquiring a write operation identifier;
judging whether the write operation identification bit is set;
if the write operation identification position is set, storing the write data into the first storage area according to the request identification of the write operation request;
and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address in the first storage area.
3. The data processing method according to claim 2, further comprising, after said determining whether the write operation identification bit is set:
if the write operation identification bit is not set, setting the write operation identification bit;
and storing the write data into the first storage area according to the request identification of the write operation request.
4. The data processing method according to claim 2, wherein the write operation request further includes a clear instruction;
after storing the correspondence between the storage address of the write data in the first storage area and the actual storage address, the method further includes:
and resetting the write operation identification bit according to the clearing instruction.
5. The data processing method of claim 1, further comprising:
acquiring a read operation request, and judging whether a corresponding relation matched with an actual storage address of read data is stored in the first storage area, wherein the read operation request comprises: reading the actual storage address of the data;
if the first storage area stores a corresponding relation matched with the actual storage address of the read data, acquiring the storage address in the first storage area corresponding to the actual storage address of the read data according to the corresponding relation;
and reading data according to the storage address in the first storage area.
6. The data processing method according to claim 5, further comprising, after said determining whether the first storage area stores a correspondence matching an actual storage address of read data:
and if the first storage area does not have the corresponding relation matched with the actual storage address of the read data, reading the data according to the actual storage address of the read data.
7. The data processing method according to claim 1, wherein storing the correspondence between the storage address of the write data in the first storage area and the actual storage address comprises:
and storing the corresponding relation between the storage address of the written data in the first storage area and the actual storage address in a linked list mode.
8. The data processing method according to claim 1, wherein the storing the write data corresponding to the write operation request into a first storage area, and the storing the correspondence between the storage address of the write data in the first storage area and the actual storage address comprises:
when the write operation request corresponding to the request identifier of the write operation request is a preset write operation request, storing write data corresponding to the write operation request into a first storage area, and storing the corresponding relation between the storage address of the write data in the first storage area and the actual storage address.
CN201711340544.2A 2017-12-14 2017-12-14 Data processing method and device for security chip Active CN108376052B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711340544.2A CN108376052B (en) 2017-12-14 2017-12-14 Data processing method and device for security chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711340544.2A CN108376052B (en) 2017-12-14 2017-12-14 Data processing method and device for security chip

Publications (2)

Publication Number Publication Date
CN108376052A CN108376052A (en) 2018-08-07
CN108376052B true CN108376052B (en) 2021-08-13

Family

ID=63016372

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711340544.2A Active CN108376052B (en) 2017-12-14 2017-12-14 Data processing method and device for security chip

Country Status (1)

Country Link
CN (1) CN108376052B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2003241894A1 (en) * 2003-05-29 2005-01-21 Fujitsu Limited Data restoring method, data restoring system, information processing device, data restoring program, and computer-readable record medium on which the program is recorded
CN101645027A (en) * 2008-08-07 2010-02-10 中兴通讯股份有限公司 Object storage controller, powder-down protection device thereof and powder-down protection method thereof
CN102460371A (en) * 2009-04-30 2012-05-16 网络存储技术公司 Flash-based data archive storage system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0563997A1 (en) * 1992-04-02 1993-10-06 Kabushiki Kaisha Toshiba Memory card apparatus
TWI362588B (en) * 2007-10-12 2012-04-21 Asustek Comp Inc Monitor apparatus, a monitoring method thereof and computer apparatus therewith
CN101923513B (en) * 2010-08-11 2012-08-22 深圳市同洲电子股份有限公司 Data writing and reading method of memory, system and FLASH memory
CN102486719B (en) * 2010-12-06 2015-04-15 普天信息技术研究院有限公司 Intelligent memory card and transaction-writing method thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2003241894A1 (en) * 2003-05-29 2005-01-21 Fujitsu Limited Data restoring method, data restoring system, information processing device, data restoring program, and computer-readable record medium on which the program is recorded
CN101645027A (en) * 2008-08-07 2010-02-10 中兴通讯股份有限公司 Object storage controller, powder-down protection device thereof and powder-down protection method thereof
CN102460371A (en) * 2009-04-30 2012-05-16 网络存储技术公司 Flash-based data archive storage system

Also Published As

Publication number Publication date
CN108376052A (en) 2018-08-07

Similar Documents

Publication Publication Date Title
CN106155596B (en) Data writing method and device
CN106155915B (en) Data storage processing method and device
CN109240622B (en) Method and system for writing EEPROM data
CN108874414A (en) Method for upgrading software, device, readable storage medium storing program for executing and television equipment
CN105281937A (en) Server, service management system, and service management method
CN104809046A (en) Application program networking control method and application program networking control device
CN104272251A (en) Modify executable bits of system management memory page table
KR20160048173A (en) Storage processing method, device and terminal
US11137947B2 (en) Recognizing hard disk movement
CN105376728A (en) Boot method and communication terminal
CN108170456B (en) Firmware upgrading method and device for electronic equipment
CN108376052B (en) Data processing method and device for security chip
CN102984330A (en) Contact person data management method of communication device
US20190208471A1 (en) Smart card control method and device, terminal device and smart card
US20170147247A1 (en) Data Processing Method and Device for Storage Card
CN114153396B (en) Data processing method and device, data storage device and terminal device
CN105653412A (en) Fingerprint device compatibility detection method and terminal
CN105260133A (en) Data writing method and system for EMMC (Embedded Multi Media Card) of mobile terminal
US20090235365A1 (en) Data access system
CN111433765A (en) Log storage method, log reading method, intelligent battery and unmanned aerial vehicle
CN105573802B (en) Multiprocessor mainboard power supply management program remote upgrading method
CN114115755B (en) Method and device for data writing and storage medium
US20090235328A1 (en) Data accessing system
CN109101436A (en) Data dynamic addressing storage method, device and storage medium, terminal device
CN112654964A (en) Brush machine control method, brush machine control device and terminal equipment

Legal Events

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