WO2019210490A1 - Data processing method and apparatus, and system chip - Google Patents

Data processing method and apparatus, and system chip Download PDF

Info

Publication number
WO2019210490A1
WO2019210490A1 PCT/CN2018/085495 CN2018085495W WO2019210490A1 WO 2019210490 A1 WO2019210490 A1 WO 2019210490A1 CN 2018085495 W CN2018085495 W CN 2018085495W WO 2019210490 A1 WO2019210490 A1 WO 2019210490A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
data
verification information
key
stored
Prior art date
Application number
PCT/CN2018/085495
Other languages
French (fr)
Chinese (zh)
Inventor
潘时林
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201880076079.2A priority Critical patent/CN111386513B/en
Priority to PCT/CN2018/085495 priority patent/WO2019210490A1/en
Publication of WO2019210490A1 publication Critical patent/WO2019210490A1/en

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

Definitions

  • the present application relates to the field of data processing and, more particularly, to a method, apparatus and system chip for data writing and data reading.
  • mobile phones play an increasingly important role in mobile e-commerce with the wide application of the Internet and the continuous improvement of mobile phone performance.
  • mobile phones must implement various functions such as bank cards, bus cards, keys, and ID cards.
  • functions such as bank cards, bus cards, keys, and ID cards.
  • mobile phone chips are required to provide hardware-level security solutions.
  • an external secure element (SE) can be used, which is usually provided in the form of a chip, and the SE chip is integrated on the mobile phone product board to prevent external malicious attack attacks and protect data security. Safely complete application services such as finance.
  • the external dedicated storage chip needs to have a large capacity, and the cost is high. For example, 4MB of external dedicated storage space costs are high, and the cost of subsequent security space will continue to rise.
  • the SOC security module to have no non-volatile memory (NVM), and the capacity integrated into the main chip inSE is limited.
  • NVM non-volatile memory
  • OTP One Time Programmable
  • ROM Read Only Memory
  • RAM Random-access memory
  • Other memory capacities are also limited and cannot be effectively implemented as NVM for data storage. Therefore, an implementation process of secure storage is needed, which can meet the requirements of all security business scenarios while ensuring cost.
  • the present application provides a method, device and system chip for data writing and data reading, which can reduce the cost and improve the security level.
  • a system chip comprising a secure element and a central processor, the secure element coupled to the central processor, the central processor for controlling the secure element,
  • the security element is configured to: determine verification information, where the verification information is used to verify the legality of the data to be stored; perform security processing on the data to be stored according to the verification information to obtain first data; and store the first data to a first memory and storing the verification information to a second memory, wherein the first memory and the second memory are different memories than the system chip.
  • the first memory is a shared memory of the SE and the central processing unit CPU
  • the second memory is a dedicated secure memory (Secure Flash) of the secure element SE.
  • the embodiment of the present application sets the first memory and the second memory.
  • the first memory is a general-purpose memory, has no security requirements, and has a large capacity.
  • the first memory may be an intrinsic memory of the mobile phone itself.
  • the size of the current mobile phone memory is generally 64 GB, 132 GB, etc., and has a relatively large storage space.
  • the first memory 202 involved in the embodiment of the present application is 4 MB or 16 MB of 64 GB or 132 GB.
  • the capacity of such a first memory has substantially no cost impact on the currently large mobile phone inherent storage, and even if the user's demand grows in the future, the capacity of the first memory is increased, and the cost of the mobile phone is not affected. .
  • the second memory is a dedicated secure memory and does not require a large storage capacity, specifically, an externally authenticated dedicated secure storage Secure Flash.
  • the Secure Flash is placed inside the SE and belongs to the scope of security certification, or the Secure Flash is a device external to the secure element.
  • SE an example. It should be understood that the application includes but is not limited thereto.
  • the first memory may include different storage areas that are isolated from each other, and store information such as SE or CPU data or programs, respectively.
  • the embodiment of the present application further sets a third memory, and the third memory may be a one-time programmable OTP memory inside the SE.
  • the third memory is used to store the ID of the SE, HUK 1 and HUK 2.
  • HUK 1 and HUK 2 are explained.
  • HUK 1 is a key for storing data or reading data between the SE and the external first memory
  • HUK2 is for storing verification information or reading between the SE and the external second memory. The key to verify the information. It should be understood that in a secure application scenario, data and programs stored outside of the SE need to be encrypted for storage to ensure data and program security.
  • HUK1 is an independent and unique key for each SE, and is used for the first stored data storage to encrypt and decrypt the root key.
  • the HUK 1 is mainly for the encryption of the first memory, and all the programs and application data are placed in the first memory. Since the first memory is an external memory, the encryption is required, and the key can be derived using HUK 1 as the root key, so that each The stored small unit is used as an encrypted block unit, and the encryption keys are different.
  • the key used for data encryption to be stored may be derived according to the root key HUK 1, for example, according to the root key HUK1, the storage address of the data to be stored in the storage address of the first memory, and other sequences.
  • the key is encrypted by the stored data and stored in the first memory.
  • the key used to encrypt the data to be stored stored in the first memory in the present application is referred to as a first key.
  • the HUK 2 is also a unique key key for each SE, and is a shared key for pairing with the second memory.
  • Secure Flash is a special secure memory for SE. When binding with SE, the binding process depends on the product. It can be written to the Secure flash in the whole machine production line or in the chip packaging production line. This enables Secure Flash and SE devices to establish a secure channel using the same shared key HUK2 for secure communication, ensuring that Secure Flash content is encrypted and verified for reading or writing. That is, the same shared key is used for secure communication between the second memory 201 and the SE.
  • the key used to encrypt the authentication information stored in the second memory in this application is referred to as a second key.
  • the second memory 201 also stores the HUK 2 inside, which can be written to the HUK 2 at the time of production.
  • the third memory can store keys required by other systems in addition to the IDs of the SE, HUK1, and HUK2. These keys are written to the OTP during chip production.
  • the SOC can be internally written to the third storage OTP by random number generator during production, and can not be changed after writing. . It should be understood that the application includes but is not limited thereto.
  • the embodiment of the present application sets a first memory for storing data or a program, and the second memory is used for storing verification information corresponding to the data to be stored. Assuming that the size of the data to be stored is 4 KB, and the size of the verification information is smaller than the size of the data to be stored, for example, the check segment of the verification information is only 32 bytes, if the second memory size is 128 KB, the first memory of 16 MB can be supported. Safety. That is, the system architecture and method provided by the embodiments of the present application can reduce the cost and ensure the security of the data application. At the same time, since the large-capacity inherent storage space of the terminal device can be fully utilized as the first memory, the capacity is increased while the cost is reduced.
  • the data writing method provided by the above application can reduce the cost and fully utilize the large capacity space of the first memory to support more applications, compared to the current inSE solution using Secure Flash.
  • the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met.
  • the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
  • the verification information includes at least one of the following information: a check sequence generated by performing verification processing on the data to be stored; and recorded by a counter Count value; or a random sequence generated by a random number.
  • the verification information may be that the SE processes the to-be-stored data according to a preset verification algorithm to generate a check sequence
  • the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm. (Message Authentication Code, MAC) (such as the advanced encryption standard AES-CMAC algorithm).
  • MAC Message Authentication Code
  • the verification information can include the generated verification sequence.
  • the verification information includes a count value recorded by the counter.
  • the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
  • the verification information includes a random sequence generated by a random number Random-x-valid.
  • a random sequence generated by a random number Random-x-valid For example, it may be a random sequence generated according to a preset random function.
  • the performing security processing on the to-be-stored data according to the verification information includes at least one of: using the verification information Performing a verification process on the data to be stored; or determining a first key according to the verification information, and encrypting the first data by using the first key.
  • the SE processes the data to be stored according to a preset verification algorithm to generate a check sequence, where the verification information is a check sequence
  • the verification information and the data to be stored have been verified in the process of the check processing. relationship.
  • the verification information and the data to be stored may together constitute the first data.
  • the algorithm algorithm authentication code secure MAC algorithm is verified
  • the 240 bytes of data to be stored are processed by the MAC algorithm to generate a 16-byte check sequence, and the 240-byte data to be stored and the 16-byte check sequence form the first data.
  • the first key encryption generates 256 bytes of ciphertext and stores it in the first memory.
  • the verification information includes the count value Count recorded by the counter.
  • the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the count value Count is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
  • the SE brings the count value Count to the data plaintext for MAC processing, and the count value is used as the verification information, and is stored after being encrypted by the second key. Go to the second memory; the data to be stored and the count value are processed by the MAC to generate the first data, so that the first data is stored in the first memory after being encrypted by the first key.
  • the count value Count is not added. After the MAC processing is completed, when the encryption is performed, the count value Count may participate in determining the first key. The process, the SE encrypts the first data by using the first key.
  • the SE derives the first key according to the HUK1 and the count value, and then stores the first data in the first memory after being encrypted by the first key.
  • the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
  • the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
  • the verification information includes a random sequence generated by a random number Random-x-valid.
  • a random sequence generated by a random number Random-x-valid For example, it may be a random sequence generated according to a preset random function. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the random sequence is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
  • the SE brings the random sequence to the data plaintext for MAC processing.
  • the random sequence is used as the verification information, and is stored in the second memory after being encrypted by the second key; the data to be stored and the random sequence are processed by the MAC to generate the first data, thereby passing the first data to the first key.
  • the encryption process is stored in the first memory.
  • the SE does not add a random sequence in the process of secure MAC address processing of the message authentication code of the data to be stored. After the MAC processing is completed, the random sequence may participate in determining the first key when performing encryption. The process, the SE encrypts the first data by using the first key.
  • the SE derives the first key according to the HUK1 and the random sequence, and then stores the first data in the first memory through the encryption process of the first key.
  • the SE derives the first key according to the ID address of the HUK1, the Page 2, and the random sequence, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
  • the random sequence may be directly derived as the first key of the first data in Page 2 in the first memory without derivation.
  • the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
  • the secure element is further configured to: verify the verification according to the second key pair before storing the verification information to the second memory
  • the information is encrypted, the second key being different from the first key.
  • the determining, according to the verification information, the first key comprises: determining, according to the verification information and a first preset sequence, a key; and the secure element is further configured to: determine the second key according to a second preset sequence, the second preset sequence being different from the first preset sequence.
  • first preset sequence herein may be the above-mentioned HUK1
  • second preset sequence may be the above.
  • the first memory includes N regions
  • the second memory includes N regions
  • the N regions of the first memory and the second The N areas of the memory are in one-to-one correspondence
  • N is a positive integer
  • the storing the first data to the first memory and storing the verification information to the second memory comprises: storing the first data Going to a first one of the N regions of the first memory, and storing the verification information to a second region of the N regions of the second memory, wherein the first region and the first region The two areas correspond.
  • each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to Verifying the size of the information
  • the secure element is further configured to perform the storing the storing the first data to the first memory and storing the verification information to the second memory in an order of: storing the verification information And the sub-area that is not occupied in the second area; storing the first data to the first area; and deleting historical verification information stored in the sub-area that has been occupied in the second area.
  • the verification block 2 of the second memory is divided into two sub-areas, which are an effective area and a blank area, and each area can store verification information of the data to be stored.
  • each area can store verification information of the data to be stored.
  • Second verification information the process refers to the above method of the first data, and will not be described again here; (2) retaining the first verification information corresponding to the original first data of the valid area of the verification block 2 of the second memory, and passing the second key The encrypted second verification information is written to the blank area of the verification block 2; (3) the second data to be stored is subjected to security processing, and then encrypted according to the first key and then written to the first memory storage block Page 2 (4) deleting the first verification information corresponding to the original first data of the valid area of the verification block 2 of the second memory, the original valid area becomes a blank area, and the newly written second verification information is used as valid verification information.
  • each verification block is divided into two areas because it can prevent power loss when data is written, and power-down protection is performed.
  • the system may be powered down at any point.
  • the verification block of the second memory is valid for one area and one area is blank.
  • the field included in the valid area is taken as the verification information.
  • both areas have verification information
  • the stored data of page 2 of the first memory is read again, and the verification information of both areas is tried to be verified.
  • the data can be protected from power failure, and any link is powered down, which does not affect the correspondence between the verification information and the stored data, and can maintain the security of the data and improve the user experience.
  • the first memory is a shared memory of the secure element and the central processor
  • the second memory is the secure element Dedicated memory
  • a system chip comprising a security element and a central processor, the security element being coupled to the central processor, the central processor for controlling the security
  • An element for: acquiring first data from a first memory; obtaining verification information from a second storage space, the verification information being used to verify validity of the first data, the first memory and The second memory is a different memory than the system chip; and the first data is de-secured according to the verification information to obtain processed data.
  • the cost can be reduced, and the large capacity of the first memory can be fully utilized to support more applications.
  • the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met.
  • the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
  • the verification information includes at least one of the following information: a check sequence generated by performing verification processing on the data to be stored; and recorded by a counter Count value; or a random sequence generated by a random number.
  • the performing the de-secure processing on the first data according to the verification information includes at least one of: using the verification information to Decoding the first data; or determining a first key according to the verification information, and decrypting the first data by using the first key.
  • the secure element is configured to decrypt the verification information according to the second key before acquiring the verification information from the second memory, where The second key is different from the first key.
  • the determining, according to the verification information, the first key comprises: determining, according to the verification information and a first preset sequence, The first key; and the secure element is further configured to: determine the second key according to the second preset sequence, where the second preset sequence is different from the first preset sequence.
  • the first memory includes N regions
  • the second memory includes N regions
  • the N regions of the first memory are The N areas of the second memory are in one-to-one correspondence
  • N is a positive integer
  • the acquiring the first data from the first memory includes: acquiring the first area from the N areas of the first memory The first data; and the obtaining the verification information from the second memory, comprising: obtaining verification information from a second one of the N regions of the second memory, wherein the first region corresponds to the second region .
  • each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to The size of the verification information, the de-securing the first data according to the verification information, comprising: using information stored in a first sub-area of the second area as the verification information, and The first data is subjected to de-secure processing; the information stored in the second sub-area of the second area is used as the verification information, and the first data is de-secured.
  • the first memory is a shared memory of the secure element and the central processor
  • the second memory is the secure element Corresponding dedicated memory
  • a method of processing data is provided, which is applied to a system chip including a secure element and a central processor, the secure element being coupled to the central processor, the central processor for controlling The security element, the security element performing the method, the method comprising: determining verification information, the verification information is used to verify validity of data to be stored; and the data to be stored is secured according to the verification information Processing the first data; storing the first data to the first memory, and storing the verification information to the second memory, wherein the first memory and the second memory are outside the system chip Different memory.
  • the verification information includes at least one of the following information: a check sequence generated by performing verification processing on the data to be stored; and recorded by a counter Count value; or a random sequence generated by a random number.
  • the performing security processing on the to-be-stored data according to the verification information includes at least one of: using the verification information Performing a verification process on the data to be stored; or determining a first key according to the verification information, and encrypting the first data by using the first key.
  • the method further includes: performing the verification information according to the second key before storing the verification information to the second memory Encrypted, the second key being different from the first key.
  • the determining, according to the verification information, the first key comprises: determining, according to the verification information and the first preset sequence, a key; and the method further comprises: determining the second key according to a second preset sequence, the second preset sequence being different from the first preset sequence.
  • the first memory includes N regions
  • the second memory includes N regions
  • the N regions of the first memory are The N areas of the second memory are in one-to-one correspondence
  • N is a positive integer
  • the storing the first data to the first memory and storing the verification information to the second memory includes: The first data is stored to a first one of the N regions of the first memory, and the verification information is stored to a second region of the N regions of the second memory, wherein the first region Corresponding to the second region.
  • each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to Verifying the size of the information, the method further comprising performing the storing the first data to the first memory and storing the verification information to the second memory in an order of: storing the verification information to the Determining the unoccupied sub-area in the second area; storing the first data to the first area; deleting historical verification information stored in the occupied sub-area in the second area.
  • the first memory is a shared memory of the secure element and the central processor
  • the second memory is the secure element Dedicated memory
  • a method of processing data is provided, which is applied to a system chip including a secure element and a central processor, the secure element being coupled to the central processor, the central processor for controlling The secure element, the secure element performing the method, the method comprising: acquiring first data from a first memory; obtaining verification information from a second memory, the verification information being used to verify validity of the first data And the first memory and the second memory are different memories except the system chip; and the first data is de-secured according to the verification information to obtain processed data.
  • the verification information includes at least one of the following information: a verification sequence generated by performing verification processing on the to-be-stored data; recorded by a counter Count value; or a random sequence generated by a random number.
  • the performing the de-secure processing on the first data according to the verification information includes at least one of: using the verification Decoding the first data by the information; or determining the first key according to the verification information, and decrypting the first data by using the first key.
  • the method before the obtaining the verification information from the second memory, the method further includes: decrypting the verification information according to the second key, The second key is different from the first key.
  • the determining, according to the verification information, the first key includes: determining, according to the verification information and a first preset sequence, a first key; and the method further comprises: determining the second key according to a second preset sequence, the second preset sequence being different from the first preset sequence.
  • the first memory includes N regions
  • the second memory includes N regions
  • the N regions of the first memory are The N areas of the second memory are in one-to-one correspondence
  • N is a positive integer
  • the acquiring the first data from the first memory includes: acquiring the first area from the N areas of the first memory The first data; and the obtaining the verification information from the second memory, comprising: obtaining verification information from a second one of the N regions of the second memory, wherein the first region corresponds to the second region .
  • each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to The size of the verification information, the de-securing the first data according to the verification information, comprising: using information stored in a first sub-area of the second area as the verification information, and The first data is subjected to de-secure processing; the information stored in the second sub-area of the second area is used as the verification information, and the first data is de-secured.
  • the first memory is a shared memory of the secure element and the central processor
  • the second memory is the secure element Corresponding dedicated memory
  • a communication device comprising: the first aspect, any possible implementation manner of the first aspect, and the second aspect, any one of the possible implementation manners of the first aspect A system chip, a first memory and a second memory.
  • a communication device which may be a terminal device or a chip disposed in the terminal device.
  • the communication device includes a processor coupled to the memory and operative to execute instructions in the memory to implement any of the possible implementations of the third and third aspects above, and any of the fourth and fourth aspects. A step performed in one possible implementation.
  • the communication device further comprises a memory.
  • the communication device further includes a communication interface, the processor being coupled to the communication interface.
  • a computer program product comprising: computer program code, when the computer program code is run on a computing device or a secure element, causing the computing device or the secure element to perform the third aspect described above And any one of the possible implementations of the third aspect and the method of any one of the fourth aspect and the fourth aspect.
  • a computer readable medium storing program code for causing a computing device or a secure element to perform the third step when the computer program code is run on a computing device or a secure element
  • a system chip comprising a processor for supporting a terminal device to implement the functions involved in the foregoing aspects, such as writing data, encrypting, decrypting, reading data, or other processing Data and/or information involved in the method.
  • the system chip further includes a memory for storing necessary program instructions and data of the terminal device.
  • the system chip can be composed of chips, and can also include chips and other discrete devices.
  • Figure 1 is a schematic diagram of a possible chip design architecture.
  • FIG. 2 is a schematic diagram of a system chip architecture provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of still another example of memory storage content provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of an example of processing data according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of a storage sub-area of another memory provided by an embodiment of the present application.
  • FIG. 12 is a schematic diagram of another method for processing data according to an embodiment of the present application.
  • the size of the sequence number of each process does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiment of the present application.
  • the implementation process constitutes any limitation.
  • the size of the sequence number of each process does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiment of the present application.
  • the implementation process constitutes any limitation.
  • pre-definition may be implemented by pre-storing corresponding codes, tables or other manners in the device (for example, including the terminal device), which may be used to indicate related information.
  • the specific implementation manner is not limited.
  • pre-definition can be defined in the protocol.
  • a terminal device may also be called a user equipment (UE), an access terminal, a subscriber unit, a subscriber station, a mobile station, a mobile station, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, and a user.
  • Agent or user device may be a mobile phone, a tablet, a computer with a wireless transceiver function, a virtual reality (VR) terminal device, and an augmented reality (AR) terminal.
  • VR virtual reality
  • AR augmented reality
  • the embodiment of the present application does not limit the application scenario.
  • the foregoing terminal device and a chip that can be disposed in the foregoing terminal device are collectively referred to as a terminal device.
  • the terminal device may also be a terminal device in an Internet of Things (IoT) system, and the IoT is an important component of future information technology development, and its main technical feature is to pass the article through the communication technology. Connected to the network to realize an intelligent network of human-machine interconnection and physical interconnection.
  • IoT Internet of Things
  • FIG. 1 is a schematic diagram of a possible chip design architecture. As shown in the chip architecture 100 of FIG. 1, the chip architecture 100 incorporates the secure element SE 104 in the system chip SOC 103, which may include the following components.
  • A, Power Management Unit (PMU) 101 A, Power Management Unit (PMU) 101
  • the power management unit 101 in the chip architecture 100 integrates all power management functions of the chip architecture 100.
  • the main functions include system reset, phase-locked loop and frequency divider, pin signal recognition and decoding, sleep mode, and module power management.
  • the power management system can be connected to the processor logic to manage functions such as charging, discharging, and power consumption through a power management system.
  • the RF circuit 102 can be used to transmit and receive information and receive and transmit signals during a call.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like.
  • the RF circuit 102 can also communicate with other devices such as network devices through wireless communication.
  • the wireless communication may use any communication standard or protocol, including but not limited to Wireless Local Area Networks (WLAN), Global System of Mobile communication (GSM) systems, Code Division Multiple Access (Code Division Multiple) Access, CDMA) system, Wideband Code Division Multiple Access (WCDMA) system, General Packet Radio Service (GPRS), Long Term Evolution (LTE) system, LTE frequency division dual (Frequency Division Duplex (FDD) system, LTE Time Division Duplex (TDD), Universal Mobile Telecommunication System (UMTS), Worldwide Interoperability for Microwave Access (WiMAX) communication System, future 5th Generation (5G) system or New Radio (NR).
  • WLAN Wireless Local Area Networks
  • GSM Global System of Mobile communication
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • GPRS General Packet Radio Service
  • LTE Long Term Evolution
  • FDD Frequency Division Duplex
  • TDD Time Division Duplex
  • UMTS Universal Mobile Telecommunication System
  • WiMAX Worldwide Interoperability for Microwave Access
  • the main chip 103 that is, the system chip SOC described above, is an integrated circuit chip, and the logic core includes a central processing unit (CPU) 105, a clock circuit, a timer, an interrupt controller, a serial parallel interface, and other peripheral devices. Input/output (I/O) ports and glue logic for various IP cores, etc.; memory cores include various volatile memory, non-volatile memory (Non-Volatile Memory) , NVM) and Cache and other memory; analog cores include Analog to Digital Converter (ADC), Digital to Analog Converter (DAC), Phase Locked Loop (PLL) and some Analog circuits used in high speed circuits.
  • ADC Analog to Digital Converter
  • DAC Digital to Analog Converter
  • PLL Phase Locked Loop
  • the CPU 105 is the control center of the SOC 103, that is, the control center of the terminal device, which connects various parts of the entire terminal device by various interfaces and lines, by running or executing software programs and/or modules stored in the memory, and calling the storage in The data in the memory performs various functions and processing data of the terminal device, thereby performing overall monitoring on the terminal device.
  • the processor may include one or more processing units; preferably, the processor may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, etc., and modulates The demodulation processor primarily handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor.
  • the CPU 105 can optionally include an operator and a controller, which are core components of the system chip for acquiring instructions and processing data. Specifically, it can be used to perform control of an instruction execution sequence, operation control, time control, and arithmetic and logical operations on data, or processing of other information.
  • eMMC embedded multimedia media
  • UFS universal flash storage
  • DDR Double Rate
  • RPMB Replay Protected Memory Block
  • the memory device also includes a program and a module that can be used to store software programs and modules that execute various functional applications and data processing of the terminal device by running software programs and modules stored in the memory device.
  • the storage device further includes a storage program area and a storage data area, such as a read-only memory (ROM), a random access memory (RAM), and the like in the chip architecture 100.
  • the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the storage data area may store data created according to the use of the terminal device (such as audio data, Phone book, etc.).
  • the memory device may also include a high speed random access memory, and may also include a non-volatile memory (NVM), such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • NVM non-volatile memory
  • the Near Filed Communication (NFC) controller 108 can be a chip that combines an inductive card reader, an inductive card, and a peer-to-peer function on a single chip to identify compatible devices in a short distance. And data exchange.
  • the NFC chip has mutual communication capability and computing power, and may further include an encryption logic circuit, an encryption/decryption module, and the like.
  • Other input devices can be used to receive input numeric or character information, as well as to generate key signal inputs related to user settings and function control of the terminal device.
  • system chip also includes other units or modules not shown, such as the storage unit and the controller together to implement a multimedia storage (Multi Media Card, MMC) controller on the system chip, double The rate controller (Double Data Rate Controler, DDRC), etc., will not be described here.
  • MMC Multi Media Card
  • DDRC Double Data Rate Controler
  • the SE 104 inside the SOC 103 will be highlighted below.
  • the inSE system which can enhance the security level of the mobile phone.
  • the SE 104 is controlled by the central processing unit CPU 105 of the SOC 103, specifically including controlling the opening, closing, controlling power consumption or operating state of the SE 104, and the like.
  • the CPU 105 can control other parts of the system chip as the core of the system chip, which is not limited in this embodiment.
  • the secure element SE 104 is typically provided in the form of an embedded SOC 103 that can run a smart card application, preventing external malicious resolution attacks and protecting data security. In addition, there is an encryption/decryption logic circuit in the system chip.
  • the conventional secure element SE can be used in an IC chip in a smart card, but now the SIM card, SD and other chips in the mobile phone also perform the same function.
  • the SE 104 has a complete CPU, ROM, RAM, and the like. The following is a brief introduction to the internal structure of the SE. As shown by 104 in Fig. 1, SE as an element also includes most of the elements or structures similar to those described above in SOC 103, and specifically includes the following components.
  • the processor can include one or more processing units.
  • the CPU 106 can optionally include an operator and a controller, which are core components of the SE 104 for fetching instructions and processing data. Specifically, it can be used to perform control of an instruction execution sequence, operation control, time control, and arithmetic and logical operations on data, or processing of other information.
  • the CPU 106 of the secure element SE can be in communication connection with the CPU 105 of the system chip SOC, and the central processing unit SE of the system chip SOC controls the secure element SE, including controlling the opening and closing of the SE. Control power consumption or working status, etc.
  • the storage device can be used to store data, software programs, and modules, and the processor can perform various functional applications and perform data processing by running software programs and modules stored in the storage device.
  • the memory device also includes a memory program area and a memory data area, such as ROM, RAM, etc., shown in chip architecture 100.
  • the SE also includes One Time Programmable (OTP) memory.
  • OTP One Time Programmable
  • the UART is part of the hardware and is a general-purpose serial data bus for asynchronous communication.
  • the bus bidirectional communication enables full duplex transmission and reception. It converts data or programs between serial communication and parallel communication.
  • the UART is usually integrated into the links of other communication interfaces.
  • the UART can be used as a stand-alone modular chip or as a peripheral device integrated in the microprocessor as an interface to external devices.
  • SWP single wire connection protocol
  • the single-line connection protocol is mainly a mobile payment solution based on NFC technology, which is applied to communication between a mobile phone SIM card or an SD card to a contactless front end (CLF).
  • the inSE system can be connected to the NFC controller via NFC and SWP interfaces and has three modes of operation: off, wired and virtual. It can usually be communicated to the SE via an external reader or via an internal connection interface.
  • CIPE uses encrypted IP packets, which are given header information and encrypted using the default CIPE encryption mechanism.
  • a random number generator is a device that generates random numbers through physical processes rather than computer programs.
  • the inSE system security solution integrates the security components into the processor, and is more resistant to attacks from the physical level and has higher security.
  • the SE module integrated into the main chip SOC has no non-volatile memory NVM, because the current SOC main chip process is very advanced, the mainstream has reached 7nm, and in this process, the NVM media flash cannot be integrated into the main The chip's die Die.
  • the security level of the SE is very high.
  • the non-volatile storage NVM stores data and can meet the following requirements:
  • NVM storage can guarantee the confidentiality, integrity and anti-return capability of data.
  • the inSE system there is no NVM.
  • the prior art has realized the requirement of ensuring data confidentiality and integrity, and anti-backup for data ( The ability to anti-rollback is mainly achieved using an on-chip One Time Programmable (OTP).
  • OTP On-chip One Time Programmable
  • the data counter rollback is performed using the bit counter inside the OTP, and the security can also meet the certification requirements of the CC EAL4+.
  • the current bit counter inside the OTP can currently reach tens of K bits.
  • a few tens of K bits means that the maximum number of secure writes is tens of thousands of times, so there is a limit on the number of writes.
  • the tens of thousands of write restrictions can meet the needs of current consumers' cards, car keys, ID cards, etc., these times are not enough for some security scenarios. For example, the scenario in which the mobile phone is used as a Pos machine, the system security against brute force cracking, etc., which frequently need to be recorded in the security application scenario of the secure element SE, tens of thousands of write restrictions cannot meet the user's needs.
  • a possible secure storage system in addition to the system chip SOC 103 and the secure element SE 104 described above, stores a data and a program to be stored in Secure Flash by setting a dedicated secure memory chip Secure Flash 201 outside the SOC.
  • the security meets the requirements.
  • the program can even be executed on-chip, without all being transferred to the internal RAM.
  • the data writing requirements can satisfy various security application scenarios.
  • the storage uses dedicated Secure Flash, which generally takes about 4MB to meet the security requirements of the mobile phone, such as completing the smart. Mobile payment for mobile phones, bus cards, security shields, etc.
  • the cost of 4MB Flash is very high and will not be adopted. Moreover, if there is more and more demand for mobile phone security space, the cost will continue to rise.
  • the embodiment of the present application provides a process for implementing secure storage based on the current inSE chip architecture, and supports the secure application data space by fully multiplexing the inherent storage space of the terminal device, and uses the external secure Flash memory chip to perform data defense only. Rollback and key storage management, without actual data storage, resulting in less demand for secure Flash storage capacity.
  • FIG. 2 is a schematic diagram of a system chip architecture provided by an embodiment of the present application.
  • the system architecture 200 includes a secure element SE 104 built into the system chip SOC 103, which is coupled to a central processing unit CPU 105 of the SOC 103 for controlling the secure element SE 104.
  • system architecture 200 also includes a first memory 202 and a second memory 201, which are different memories than the system chip SOC 103.
  • the first memory 202 is used to store data and programs
  • the second memory 201 is used to store verification information for verifying the legality of the data to be stored.
  • FIG. 1 Communication between the second memory 201 and the SE 104 via a high speed serial interface (SerDes Framer Interface, SFI) is shown in FIG.
  • SFI Serial Framer Interface
  • the first memory 202 is a shared memory of the SE 104 and the central processing unit CPU
  • the second memory 201 is a dedicated secure memory (Secure Flash) of the secure element SE 104.
  • the first embodiment of the present application sets the first memory 202 and the second memory 201.
  • the first memory 202 is a general-purpose memory and has no security requirements and has a large capacity; the second memory 201 is a dedicated secure memory.
  • the first memory may be a memory that the mobile phone itself has.
  • the size of the current mobile phone memory is generally 64 GB, 132 GB, etc., and has a relatively large storage space.
  • the first memory 202 involved in the embodiment of the present application is 4 MB or 16 MB of 64 GB or 132 GB.
  • the capacity of such a first memory has substantially no cost impact on the currently large mobile phone inherent storage, and even if the user's demand grows in the future, the capacity of the first memory is increased, and the cost of the mobile phone is not affected. .
  • the second memory 201 is a dedicated secure memory, and specifically may be an externally authenticated dedicated secure storage Secure Flash.
  • the Secure Flash is placed inside the SE 104 and belongs to the scope of security certification, or the Secure Flash is a device external to the secure element.
  • the embodiment of the present application is described in detail by taking the SE 104 as an example. It should be understood that the application includes but is not limited thereto.
  • the first memory 202 may include different storage areas that are isolated from each other, and store information such as data or programs of the SE 104 and the CPU 105, respectively.
  • the embodiment of the present application sets a first memory for storing data or a program, and the second memory is used for storing verification information corresponding to the data to be stored. Assuming that the size of the data to be stored is 4 KB, and the size of the verification information is much smaller than the size of the data to be stored, for example, the verification segment of the verification information is only 32 bytes, if the second memory size is 128 KB, the first 16 MB can be supported. Memory security. That is, the system architecture and method provided by the embodiments of the present application can reduce the cost and ensure the security of the data application. At the same time, since the large-capacity inherent storage space of the terminal device can be fully utilized as the first memory, the capacity is increased while the cost is reduced.
  • the embodiment of the present application further sets a third memory, which may be a one-time programmable OTP memory inside the SE, such as the OTP 203 shown in FIG. 2 .
  • the OTP 203 is integrated into the digital logic portion of the SOC chip to enable one-time programming of non-volatile storage (NVS).
  • This third memory is used to store the IDs of the SE 104, HUK1 and HUK2.
  • HUK1 and HUK2 are explained.
  • HUK1 is a key for storing data or reading data between the SE and the external first memory
  • HUK2 is for storing verification information or reading verification information between the SE and the external second memory. Key. It should be understood that in a secure application scenario, data and programs stored outside of the SE need to be encrypted for storage to ensure data and program security.
  • HUK1 is an independent and unique key for each SE, and is used for the first stored data storage to encrypt and decrypt the root key.
  • HUK1 is mainly used for the encryption of the first memory. All programs and application data are placed in the first memory. Since the first memory is an external memory, encrypted storage is required, and the key can be derived using HUK1 as a root key, so that each storage is The small unit is used as an encryption block unit, and its encryption keys are different.
  • the key used for data encryption to be stored may be derived according to the root key HUK1, for example, a key derived from the root key HUK1, a storage address of the data to be stored in the first memory, and other sequences.
  • the stored data is encrypted and stored in the first memory 202.
  • the key used to encrypt the data to be stored stored in the first memory in the present application is referred to as a first key.
  • HUK2 is also a unique key key for each SE, and is a shared key for pairing with the second memory.
  • Secure Flash is a dedicated secure memory for SE. When binding with SE, the binding process depends on the product. It can be written to the Secure flash in the whole machine production line or in the chip packaging production line.
  • the Secure Flash and SE devices can use the same shared key HUK2 to establish a secure channel for secure communication, ensuring that Secure Flash content is encrypted and has a verified read or write. That is, the same shared key is used for secure communication between the second memory 201 and the SE.
  • the key used to encrypt the authentication information stored in the second memory in the present application is referred to as a second key.
  • the second memory 201 also stores the HUK 2 inside, which can be written to the HUK 2 during the production of the whole machine.
  • the third memory can store keys required by other systems in addition to the IDs of the SE 104, HUK1, and HUK2. These keys are written to the OTP when the chip is produced.
  • the SOC can be internally written into the third storage OTP by a random number generator during production, and cannot be changed after being written. It should be understood that the application includes but is not limited thereto.
  • the first memory includes N regions
  • the second memory includes N regions
  • the N regions of the first memory are in one-to-one correspondence with the N regions of the second memory, where N is a positive integer.
  • FIG. 3 is a schematic diagram showing an example of memory storage contents provided by an embodiment of the present application, that is, the first memory or the second memory may be divided according to a certain size.
  • the first memory is divided into N storage blocks according to the size of 4 KB, such as Page 1 , Page 2...Page N shown in FIG. 3;
  • the second memory is divided into N verification blocks according to the size of 32 bytes, for example The verification block 1, the verification block 2, ... the verification block N shown in FIG.
  • Each page has a corresponding secure authentication storage block of the Secure Flash (second memory), that is, the second memory retains the verification information corresponding to the page, and ensures that the data stored in the first memory is not tampered or rolled back.
  • Secure Flash second memory
  • the first key may be Kenc_page 1, Kenc_page 2...Kenc_page N derived from the ID of HUK1 and different Pages, and then the data to be stored stored in different pages is respectively encrypted, and then Write the corresponding Page. It should be understood that this application includes, but is not limited to, this.
  • FIG. 4 is a schematic diagram of an example of processing data according to an embodiment of the present application.
  • the method 400 illustrates a specific process of data writing applied to the architecture 200 described above, including a secure element SE and a system chip of a central processor coupled to the central processor for controlling
  • the secure element SE includes controlling its opening, closing, controlling power consumption or working state, and the like.
  • the method 400 includes the following.
  • the secure element SE determines verification information, which is used to verify the legality of the data to be stored.
  • the data to be stored needs to be encrypted and stored in the first memory.
  • data may be tampered with or attacked at any point outside the processing of the secure element SE. Therefore, in order to ensure the legitimacy of the data, certain verification information is required to verify the legitimacy of the data.
  • the data to be stored is then written to the first memory, and the corresponding verification information of the data to be stored is stored to the second memory.
  • the verification information includes at least one of the following information: a check sequence generated by performing check processing on the data to be stored; or a count value recorded by a counter; or a random sequence generated by a random number.
  • the verification process here is to verify whether the data has been tampered with, and to perform an integrity check, for example, to obtain a verification message by the verification process.
  • the de-verification process is performed, that is, the verification information obtained by the verification process is used to verify whether the data is tampered or maliciously attacked during the process, thereby ensuring security.
  • the verification information may be that the SE processes the to-be-stored data according to a preset verification algorithm to generate a check sequence
  • the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm. (Message Authentication Code, MAC) (such as the advanced encryption standard AES-CMAC algorithm).
  • MAC Message Authentication Code
  • the verification information can include the generated verification sequence.
  • the verification information includes a count value recorded by the counter.
  • the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
  • the verification information includes a random sequence generated by a random number Random-x-valid.
  • a random sequence generated by a random number Random-x-valid For example, it may be a random sequence generated according to a preset random function.
  • the secure element SE performs security processing on the data to be stored according to the verification information to obtain first data.
  • the verification information is obtained, and the data to be stored may be securely processed according to the verification information to obtain the first data.
  • the security process includes at least one of the following processes: performing MAC processing on the data to be stored by using the verification information; or determining a first key according to the verification information, using the first key to the first data Encrypt.
  • the secure element SE stores the first data to the first memory and stores the verification information to the second memory, wherein the first memory and the second memory are different memories outside the system chip.
  • the secure element SE obtains the verification information, but the verification information and the data to be stored constitute a verification relationship, and the read data can be verified by the verification information in the process of reading the data. Legitimacy, otherwise it makes no sense. That is, the verification information is to be involved in the data processing process to be stored, otherwise the two have no relationship and cannot be verified.
  • the verification information may be at least one of the three listed information. Specifically, it is divided into the following three cases for detailed description.
  • the SE processes the data to be stored according to a preset verification algorithm to generate a check sequence, where the verification information is a check sequence
  • the verification information and the data to be stored have been verified in the process of the check processing. relationship.
  • the verification information and the data to be stored may together constitute the first data.
  • the algorithm algorithm authentication code secure MAC algorithm is verified
  • the 240 bytes of data to be stored are processed by the MAC algorithm to generate a 16-byte check sequence, and the 240-byte data to be stored and the 16-byte check sequence form the first data.
  • the first key is encrypted to generate 256 bytes of ciphertext and stored in the first memory, and the 16-byte check sequence is stored as the verification information of the first data by the second key and stored in the second memory.
  • the first key and the first memory or the second key and the second memory have been described in detail above, and are not described herein again for the sake of brevity.
  • a check sequence is generated, and the check sequence is encrypted by the second key and stored in the second memory.
  • the check sequence is generated according to the data to be stored, so the check sequence can uniquely verify the legality of the data to be stored.
  • the data to be stored is used as the first data, encrypted according to the first key, and stored in the first memory.
  • the first memory is divided into N memory blocks in a size of 4 KB
  • the second memory is divided into N verification blocks in a size of 32 bytes.
  • 4 KB of data to be stored is stored in the first memory through the first key encryption process; and a 32-byte check sequence is stored in the second memory through the encryption process of the second key. It should be understood that the application includes but is not limited thereto.
  • the verification information includes the count value Count recorded by the counter.
  • the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the count value Count is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
  • FIG. 7 and 8 are diagrams showing a process of a process in which a count value participates in data to be stored.
  • the data to be stored is subjected to a verification process, for example, performing message authentication code secure MAC processing, and the count value Count is brought into the data plaintext to be stored for MAC processing, and the count value is As the verification information, after the encryption process of the second key, the second data is stored in the second memory; the data to be stored and the count value are processed by the MAC to generate the first data, so that the first data is encrypted by the first key and then stored. Go to the first memory.
  • a verification process for example, performing message authentication code secure MAC processing
  • the count value Count is brought into the data plaintext to be stored for MAC processing
  • the count value is
  • the second data is stored in the second memory
  • the data to be stored and the count value are processed by the MAC to generate the first data, so that the first data is encrypted by the first key and then stored. Go to the first memory.
  • FIG. 8 Another processing method in which the count value participates in the data to be stored is as shown in FIG. 8.
  • the message authentication code to be stored in the secure MAC address process does not include the count value Count.
  • the count value Count can participate in the process of determining the first key when the encryption is performed, and the SE uses the first The key encrypts the first data.
  • the SE derives the first key according to the HUK1 and the count value, and then stores the first data in the first memory after being encrypted by the first key.
  • the first key belongs to the prior art, and this embodiment does not introduce the expansion.
  • the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
  • the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
  • the verification information includes a random sequence generated by a random number Random-x-valid.
  • a random sequence generated by a random number Random-x-valid For example, it may be a random sequence generated according to a preset random function. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the random sequence is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
  • FIG. 9 and 10 are schematic diagrams showing a processing procedure in which a random sequence participates in data to be stored.
  • the random sequence is brought into the data plaintext for MAC processing.
  • the random sequence is used as the verification information, and is stored in the second memory after being encrypted by the second key.
  • the data to be stored and the random sequence are processed by the MAC to generate the first data, so that the first data is first encrypted.
  • the key is encrypted and stored in the first memory.
  • FIG. 1 Another processing method in which a random sequence participates in data to be stored is shown in FIG. During the secure MAC processing of the message authentication code to be stored, the random sequence is not added. After the MAC processing is completed, the random sequence may participate in the process of determining the first key when the encryption is performed, and the SE uses the first key. The first data is encrypted.
  • the SE derives the first key according to the HUK 1 and the random sequence, and then stores the first data in the first memory after being encrypted by the first key.
  • the SE derives the first key according to the ID address of the HUK1, the Page 2 and the random sequence, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
  • the random sequence may be directly derived as the first key of the first data in Page 2 in the first memory without derivation.
  • the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
  • the above examples of the data size for example, 240 bytes, 32 bytes, or 4 KB are examples, and the actual situation can be modified. Even the size of the memory block Page in the first memory or the size of the verification block in the second memory can be The type of data stored varies. It should be understood that this application includes, but is not limited to, this.
  • first memory and the second memory may be divided when introducing the first memory and the second memory.
  • first memory includes N regions
  • second memory includes N regions
  • the N regions of the first memory are in one-to-one correspondence with the N regions of the second memory
  • N is a positive integer.
  • each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to a size of the verification information
  • the security element is further used as follows Performing an operation of storing the first data to the first memory and storing the verification information to the second memory: the secure element stores the verification information to the unoccupied sub-area in the second area; The first data is stored in the first area; and the historical verification information stored in the occupied sub-area in the second area is deleted.
  • the verification block 2 of the second memory is divided into two sub-areas, which are an effective area and a blank area, and each area can store verification information of the data to be stored.
  • the verification information is written in the process of verifying block 2 of the second memory, the verification information is written to the valid area of the verification block 2, and the blank area has no data.
  • the original valid area becomes a blank area, and the newly written second verification information is used as valid verification information.
  • each verification block is divided into two areas because it can prevent power loss when data is written, and power-down protection is performed.
  • the system may be powered down at any point.
  • the verification block of the second memory is valid for one area and one area is blank.
  • the field included in the valid area is taken as the verification information.
  • both areas have verification information
  • the stored data of page 2 of the first memory is read again, and the verification information of both areas is tried to be verified.
  • the data can be protected from power failure, and any link is powered down, which does not affect the correspondence between the verification information and the stored data, and can maintain the security of the data and improve the user experience.
  • the verification information may be a check sequence generated by the message authentication code MAC processing of the data to be stored; or a count value recorded by a counter; or a random sequence generated by a random number.
  • the verification information is the count value recorded by the counter, it is not necessary to perform the method of dividing the memory block of the second memory into two areas and the data writing flow as described above, because the counter value of the counter is incremented by one every time it is written. Therefore, when the second data is written, it is sufficient to add 1 to the first verification information, and it is not necessary to re-determine the second verification information, so that the correctness of the verification information can be ensured. That is, if there is a correlation between the verification information of different memory blocks of the second memory, the flow of data writing can be simplified, and the validity of the data can be determined based on the verification information.
  • This application includes but is not limited to this.
  • the data writing method provided by the above application can reduce the cost and fully utilize the large capacity space of the first memory to support more applications, compared to the current inSE solution using Secure Flash.
  • the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met.
  • the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
  • FIG. 12 is a schematic diagram of another method for processing data according to an embodiment of the present application.
  • the method 1200 illustrates a specific process of data reading applied to the architecture 200 described above, including a secure element SE and a system chip of a central processor coupled to the central processor for controlling
  • the secure element SE includes controlling its opening, closing, controlling power consumption or working state, and the like.
  • the method 1200 includes the following.
  • the secure element SE acquires the first data from the first memory.
  • the secure element SE obtains verification information from the second memory, where the verification information is used to verify the validity of the first data, and the first memory and the second memory are different memories outside the system chip.
  • the secure element SE performs de-secured processing on the first data according to the verification information to obtain processed data.
  • the first memory is used to store data and a program
  • the second memory is used to store data of the first memory and verification information of the program.
  • the secure element SE first obtains the verification information corresponding to the first data encrypted by the second key from the second memory, and acquires the first data encrypted by the first key from the first memory. . Thereafter, the secure element performs de-secure processing on the encrypted first data to obtain the first data. Similarly, the secure component needs to perform security processing on the encrypted verification information to obtain verification information. Finally, the validity of the first data is determined according to the verification information.
  • the verification information includes at least one of the following information: a check sequence generated by the message authentication code MAC processing on the to-be-stored data; a count value recorded by the counter; or a random sequence generated by the random number.
  • the verification information may be that the SE processes the to-be-stored data according to a preset verification algorithm to generate a check sequence
  • the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm. (Message Authentication Code, MAC) (such as the advanced encryption standard AES-CMAC algorithm).
  • MAC Message Authentication Code
  • the verification information can include the generated verification sequence.
  • the verification information includes a count value recorded by the counter.
  • the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
  • the verification information includes a random sequence generated by a random number Random-x-valid.
  • a random sequence generated by a random number Random-x-valid For example, it may be a random sequence generated according to a preset random function.
  • the security element SE performs de-secure processing on the first data according to the verification information, including at least one of: performing MAC processing on the first data by using the verification information; or determining, according to the verification information, a key that decrypts the first data using the first key.
  • the secure element SE needs to acquire the first key.
  • the secure element SE may store the first key for encrypting the data to be stored in the SE during the writing process, and in the process of reading the data, The stored first key is directly extracted for decryption.
  • the secure element SE first decrypts the verification information acquired according to the second key pair.
  • the obtained verification information is obtained by decrypting the acquired verification information according to HUK2.
  • the first data can be de-MAC processed by using the verification information. Specifically, it is divided into the following three cases for detailed description. It should be understood that the SE can select a corresponding processing procedure when reading data according to a corresponding processing procedure when writing data.
  • the SE selects a corresponding security process to perform security processing.
  • the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm MAC.
  • the SE obtains the processed data according to the inverse process of the verification algorithm.
  • the verification process is the process shown in FIG. 5, that is, the data to be stored and the check sequence are included in the first data
  • the first data is encrypted by the first key.
  • the check sequence is encrypted by the second key and stored in the second memory.
  • the SE decrypts the data stored in the first memory, and acquires the first check sequence in the stored data, and simultaneously corresponds to the second memory according to the second key pair.
  • the verification information is decrypted to obtain a second verification sequence.
  • the validity of the data is verified by the first check sequence and the second check sequence.
  • the first check sequence and the second check sequence are the same, it is determined that the data is legal. It should be understood that this application includes, but is not limited to, this.
  • the verification process is a process as shown in FIG. 6, the data to be stored is stored in the first memory after being encrypted by the first key; the check sequence is encrypted by the second key and stored in the second memory. .
  • the SE decrypts the stored data, and obtains the first check sequence in the stored data according to the check algorithm, and simultaneously pairs the second memory according to the second key.
  • the corresponding verification information is decrypted to obtain a second check sequence.
  • the validity of the data is verified by the first check sequence and the second check sequence.
  • the first check sequence and the second check sequence are the same, it is determined that the data is legal. It should be understood that this application includes, but is not limited to, this. Case 2:
  • the verification information includes the count value Count recorded by the counter.
  • the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
  • the SE participates in the processing of the data to be stored according to the count value, and selects a corresponding solution security processing method.
  • the reverse process of the MAC processing may be performed first. Get the count value Count in the data. And comparing the count value Count obtained in the first memory with the verification information count value Count obtained in the second memory. If the two values are consistent, it is determined that the acquired data is legal data; if the two values are inconsistent, If it is judged that the acquired data is illegal, it is determined that it is subjected to a security attack, the acquisition is invalid, and an error is reported.
  • the count value Count may participate in the process of determining the first key, and the SE uses the first key.
  • the first data is encrypted.
  • the SE derives the first key according to the HUK1 and the count value, and then stores the first data through the encryption process of the first key and stores it in the first memory.
  • the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
  • the SE decrypts the data acquired according to the first key pair, obtains the count value Count, and then obtains the count value Count obtained in the first memory and the second memory. Verify the information count value Count for comparison. If the two values are consistent, it is judged that the acquired data is legal data; if the two values are inconsistent, it is judged that the acquired data is illegal, and it is determined that the security is attacked, the acquisition is invalid, and an error is reported.
  • the verification information includes a random sequence generated by a random number Random-x-valid.
  • a random sequence generated by a random number Random-x-valid For example, it may be a random sequence generated according to a preset random function.
  • the reverse processing of the MAC processing may be performed first.
  • a random sequence in the data comparing the random sequence obtained in the first memory with the random sequence of the verification information acquired in the second memory, if the two values are consistent, determining that the acquired data is legal data; if the two values are inconsistent, determining The acquired data is illegal, and it is determined that it is subjected to a security attack, the acquisition is invalid, and an error is reported.
  • the random sequence may participate in the process of determining the first key, and the SE uses the first key to The first data is encrypted.
  • the SE derives the first key according to the HUK1 and the count value, and then stores the first data through the encryption process of the first key and stores it in the first memory.
  • the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then encrypts the first data by the first key. After processing, it is stored in the storage area of Page 2 of the first memory.
  • the SE decrypts the data acquired according to the first key, acquires a random sequence, and then obtains the random sequence acquired in the first memory and the verification information acquired in the second memory. Random sequences were compared. If the two values are consistent, it is judged that the acquired data is legal data; if the two values are inconsistent, it is judged that the acquired data is illegal, and it is determined that the security is attacked, the acquisition is invalid, and an error is reported.
  • the random sequence may be directly derived as the first key of the first data in Page 2 in the first memory without derivation.
  • the SE can use the random sequence as the first key to decrypt the acquired data.
  • the first memory includes N regions
  • the second memory includes N regions
  • the N regions of the first memory are in one-to-one correspondence with the N regions of the second memory, where N is a positive integer .
  • the SE may acquire the first data from a first one of the N regions of the first memory; and the SE acquires verification information from a second region of the N regions of the second memory, wherein the first region and the first region The second area corresponds.
  • each of the N regions of the second memory includes at least two sub-regions, and the size of each sub-region is greater than or equal to the size of the verification information, and the SE may be the first sub-region of the second region.
  • the stored information is used as the verification information, and the first data is de-secured; and the information stored in the second sub-area of the second area is further used as the verification information, and the first data is de-secured. deal with. Any one of the two sub-areas can be verified by the verification information.
  • the verification block 2 of the second memory is divided into two sub-areas, which are an effective area and a blank area, and each area can store verification information of the data to be stored.
  • each process has the possibility of power failure, so the two sub-areas of the verification block 2 of the second memory may have the following three cases:
  • the valid area has verification information, and the blank area has no verification information
  • the verification information may be obtained, and as long as the verification data obtained by the verification information is legal, the data is determined as legal data; if the two verification information are not correct, then It is considered that a security attack is received, the storage is invalid, and an error is reported.
  • each verification block is divided into two areas because it can prevent power loss when data is written, and power-down protection is performed.
  • the specific process has been described in detail when writing data. For the sake of brevity, it will not be described here.
  • the method provided by the embodiment of the present application is specifically described in terms of two aspects of writing data and reading data, respectively, in conjunction with FIG. 2 to FIG.
  • the method for writing and reading data by the data provided by the above application can reduce the cost and fully utilize the large capacity of the first memory to support more than the current inSE solution using Secure Flash. More applications.
  • the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met.
  • the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
  • the functions described in the above embodiments may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product.
  • the technical solution of the present application which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device or computing processor, such as the security element previously described, to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

Provided in the present application are a system chip, and a data writing and data reading method and apparatus; the system chip comprises a security element and a central processor, the security element and the central processor being coupled, the central processor being used to control the security element, and the security element being used to: determine verification information, the verification information being used to verify the legitimacy of data to be stored; according to the verification information, performing security processing on the data to be stored so as to obtain first data; storing the first data to a first memory, and storing the verification information to a second memory, the first memory and the second memory being different memories outside of the system chip; the described solution may reduce costs and increase the level of security.

Description

数据处理的方法、装置和系统芯片Data processing method, device and system chip 技术领域Technical field
本申请涉及数据处理领域,并且更具体地,涉及一种数据写入和数据读取的方法、装置和系统芯片。The present application relates to the field of data processing and, more particularly, to a method, apparatus and system chip for data writing and data reading.
背景技术Background technique
手机作为一种应用最广泛的终端设备,随着互联网的广泛应用和手机性能的不断提升,在移动电子商务中发挥着越来越重要的作用。手机未来要实现银行卡,公交卡,钥匙,身份证等各种功能,实现这些功能,需要手机芯片提供硬件级安全的解决方案。As the most widely used terminal device, mobile phones play an increasingly important role in mobile e-commerce with the wide application of the Internet and the continuous improvement of mobile phone performance. In the future, mobile phones must implement various functions such as bank cards, bus cards, keys, and ID cards. To achieve these functions, mobile phone chips are required to provide hardware-level security solutions.
在现有的手机安全存储中,可以采用外置一块安全元件(Secure Element,SE),通常以芯片形式提供,将SE芯片集成到手机产品板上,防止外部恶意解析攻击,保护数据安全,从而安全的完成金融等应用服务。在该方案中,要达到通用手机所有安全应用场景的要求,需要该外置专用存储芯片容量较大,则成本较高。例如4MB的外置专用存储空间成本就很高,而且后续对安全空间需求越来越大的话,成本还会继续上升。In the existing mobile phone secure storage, an external secure element (SE) can be used, which is usually provided in the form of a chip, and the SE chip is integrated on the mobile phone product board to prevent external malicious attack attacks and protect data security. Safely complete application services such as finance. In this solution, in order to meet the requirements of all security application scenarios of the universal mobile phone, the external dedicated storage chip needs to have a large capacity, and the cost is high. For example, 4MB of external dedicated storage space costs are high, and the cost of subsequent security space will continue to rise.
另外,还有一种将SE模块集成到系统芯片(System on Chip,SOC)中,实现移动支付和多业务公用平台。但是,目前SOC的工艺流程致使SOC的安全模块内部无非易失性存储器(Non-Volatile Memory,NVM),这种集成到主芯片inSE的容量有限。例如包括只可以一次性编程的(One Time Programmable,OTP)存储、只读存储器(Read Only Memory,ROM)和随机存储器(random-access memory,RAM),其中,OTP的写入次数受限,不能满足增长的业务需求。其他存储器容量也很有限,无法作为NVM有效实现数据存储。因此,亟需一种安全存储的实现流程,能够在保证成本的情况下,满足所有安全业务场景的需求。In addition, there is a common platform for integrating the SE module into the System on Chip (SOC) to implement mobile payment and multi-service. However, the current SOC process flow causes the SOC security module to have no non-volatile memory (NVM), and the capacity integrated into the main chip inSE is limited. For example, it includes One Time Programmable (OTP) storage, Read Only Memory (ROM), and Random-access memory (RAM), where the number of OTP writes is limited and cannot be Meet growing business needs. Other memory capacities are also limited and cannot be effectively implemented as NVM for data storage. Therefore, an implementation process of secure storage is needed, which can meet the requirements of all security business scenarios while ensuring cost.
发明内容Summary of the invention
本申请提供一种数据写入和数据读取的方法、装置和系统芯片,能够降低成本,且提高了安全等级。The present application provides a method, device and system chip for data writing and data reading, which can reduce the cost and improve the security level.
第一方面,提供了一种系统芯片,所述系统芯片包括安全元件和中央处理器,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件用于:确定验证信息,所述验证信息用于验证待存储数据的合法性;根据所述验证信息对所述待存储数据进行安全处理得到第一数据;将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,其中,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器。In a first aspect, a system chip is provided, the system chip comprising a secure element and a central processor, the secure element coupled to the central processor, the central processor for controlling the secure element, The security element is configured to: determine verification information, where the verification information is used to verify the legality of the data to be stored; perform security processing on the data to be stored according to the verification information to obtain first data; and store the first data to a first memory and storing the verification information to a second memory, wherein the first memory and the second memory are different memories than the system chip.
可选地,该第一存储器是SE和中央处理器CPU的共享存储器,该第二存储器是该安全元件SE的专用安全存储器(Secure Flash)。Optionally, the first memory is a shared memory of the SE and the central processing unit CPU, and the second memory is a dedicated secure memory (Secure Flash) of the secure element SE.
本申请实施例设置第一存储器和第二存储器,应理解,该第一存储器是通用存储器, 没有安全要求,容量大。具体地,第一存储器可以是手机本身的固有存储器。例如,我们当前手机存储器的大小一般为64GB、132GB等,有比较大的存储空间,本申请实施例涉及的第一存储器202是64GB或132GB中的4MB或者16MB。这样的第一存储器的容量对于目前比较大的手机固有存储来说基本没有任何成本影响,即使未来随着用户需求的增长,要增大该第一存储器的容量,也不会对手机成本造成影响。The embodiment of the present application sets the first memory and the second memory. It should be understood that the first memory is a general-purpose memory, has no security requirements, and has a large capacity. Specifically, the first memory may be an intrinsic memory of the mobile phone itself. For example, the size of the current mobile phone memory is generally 64 GB, 132 GB, etc., and has a relatively large storage space. The first memory 202 involved in the embodiment of the present application is 4 MB or 16 MB of 64 GB or 132 GB. The capacity of such a first memory has substantially no cost impact on the currently large mobile phone inherent storage, and even if the user's demand grows in the future, the capacity of the first memory is increased, and the cost of the mobile phone is not affected. .
第二存储器是专用安全存储器,不需要大的存储容量,具体地,是外部认证过的专用安全存储Secure Flash。一种可能的情况,该Secure Flash是放在SE的内部,属于安全认证范围,或者该Secure Flash属于安全元件外部的设备。本申请实施例以SE为例详细进行说明。应理解,本申请包括但不限于此。The second memory is a dedicated secure memory and does not require a large storage capacity, specifically, an externally authenticated dedicated secure storage Secure Flash. In a possible case, the Secure Flash is placed inside the SE and belongs to the scope of security certification, or the Secure Flash is a device external to the secure element. The embodiment of the present application is described in detail by taking SE as an example. It should be understood that the application includes but is not limited thereto.
作为SE和中央处理器CPU的共享存储器,该第一存储器可以包括不同的彼此隔离的存储区,分别存放SE和CPU的数据或程序等信息。As a shared memory of the SE and the central processing unit CPU, the first memory may include different storage areas that are isolated from each other, and store information such as SE or CPU data or programs, respectively.
可选地,本申请实施例还设置第三存储器,第三存储器可以是SE内部的一次性编程OTP存储器。该第三存储器用于存储SE的ID、HUK 1和HUK 2。这里解释一下HUK 1和HUK 2,HUK 1是SE和外部的第一存储器之间进行存储数据或读取数据的密钥,HUK2是SE和外部的第二存储器之间进行储验证信息或读取验证信息的密钥。应理解,在安全应用场景中,存储在SE之外的数据和程序都是需要加密储存,从而确保数据和程序的安全性。Optionally, the embodiment of the present application further sets a third memory, and the third memory may be a one-time programmable OTP memory inside the SE. The third memory is used to store the ID of the SE, HUK 1 and HUK 2. Here, HUK 1 and HUK 2 are explained. HUK 1 is a key for storing data or reading data between the SE and the external first memory, and HUK2 is for storing verification information or reading between the SE and the external second memory. The key to verify the information. It should be understood that in a secure application scenario, data and programs stored outside of the SE need to be encrypted for storage to ensure data and program security.
其中,HUK1是每个SE独立唯一的key,用于第一存储的数据存储加密解密的根密钥(root key)。HUK 1主要为了第一存储器的加密,所有程序以及应用数据放在第一存储器,由于第一存储器是外部存储器,故需要加密存储,密钥可以采用HUK 1作为根密钥进行派生,使得每个存储的小单元作为加密块单位,其加密密钥各不相同。具体地,用于待存储数据加密的密钥可以根据该根密钥HUK 1进行派生,例如,根据该根密钥HUK1、待存储数据在第一存储器的存储地址以及其他序列等派生出的密钥,对待存储数据进行加密,从而存储到第一存储器。本申请中将用于对存储到第一存储器的待存储数据进行加密的密钥称为第一密钥。Among them, HUK1 is an independent and unique key for each SE, and is used for the first stored data storage to encrypt and decrypt the root key. The HUK 1 is mainly for the encryption of the first memory, and all the programs and application data are placed in the first memory. Since the first memory is an external memory, the encryption is required, and the key can be derived using HUK 1 as the root key, so that each The stored small unit is used as an encrypted block unit, and the encryption keys are different. Specifically, the key used for data encryption to be stored may be derived according to the root key HUK 1, for example, according to the root key HUK1, the storage address of the data to be stored in the storage address of the first memory, and other sequences. The key is encrypted by the stored data and stored in the first memory. The key used to encrypt the data to be stored stored in the first memory in the present application is referred to as a first key.
HUK 2也是每个SE独立唯一的密钥key,是用于和第二存储器进行配对的共享密钥(Share key)。Secure Flash作为SE的专用安全存储器,在与SE绑定时,绑定过程视产品不同,可以在整机生产线,也可以在芯片封装生产线,会将HUK 2也会写入到Secure flash中;从而使得Secure Flash和SE这两个器件可以采用同一个共享密钥HUK2建立安全通道,从而进行安全通信,确保Secure Flash的内容加密并有校验的读取或写入。即第二存储器201和SE之间采用同一个共享密钥进行安全通信,本申请中将用于对存储到第二存储器的验证信息进行加密的密钥称为第二密钥。相应地,第二存储器201内部也存储有HUK2,可以在整机生产时写入HUK 2。The HUK 2 is also a unique key key for each SE, and is a shared key for pairing with the second memory. Secure Flash is a special secure memory for SE. When binding with SE, the binding process depends on the product. It can be written to the Secure flash in the whole machine production line or in the chip packaging production line. This enables Secure Flash and SE devices to establish a secure channel using the same shared key HUK2 for secure communication, ensuring that Secure Flash content is encrypted and verified for reading or writing. That is, the same shared key is used for secure communication between the second memory 201 and the SE. The key used to encrypt the authentication information stored in the second memory in this application is referred to as a second key. Correspondingly, the second memory 201 also stores the HUK 2 inside, which can be written to the HUK 2 at the time of production.
此外,第三存储器除了存储有SE的ID、HUK1和HUK2,也可以存储其他系统所需的密钥。这些密钥都是芯片生产时写入OTP的,例如对于HUK 1和HUK 2,SOC内部在生产时可以通过随机数发生器产生随机数写入第三存储OTP中,写入后不可再被更改。应理解,本申请包括但不限于此。In addition, the third memory can store keys required by other systems in addition to the IDs of the SE, HUK1, and HUK2. These keys are written to the OTP during chip production. For example, for HUK 1 and HUK 2, the SOC can be internally written to the third storage OTP by random number generator during production, and can not be changed after writing. . It should be understood that the application includes but is not limited thereto.
应理解,本申请实施例设置了用于存储数据或程序的第一存储器,第二存储器用于存储待存储数据对应的验证信息。假设待存储数据的大小为4KB,而验证信息的大小小于 该待存储数据的大小,例如验证信息的校验段只有32byte,那么第二存储器大小如果是128KB,就可以支持16MB的第一存储器的安全。即,通过本申请实施例提供的系统架构和方法就能够降低成本,保证了数据应用的安全。同时,因为又能充分利用终端设备的大容量的固有存储空间作为第一存储器,容量加大的同时降低了成本。It should be understood that the embodiment of the present application sets a first memory for storing data or a program, and the second memory is used for storing verification information corresponding to the data to be stored. Assuming that the size of the data to be stored is 4 KB, and the size of the verification information is smaller than the size of the data to be stored, for example, the check segment of the verification information is only 32 bytes, if the second memory size is 128 KB, the first memory of 16 MB can be supported. Safety. That is, the system architecture and method provided by the embodiments of the present application can reduce the cost and ensure the security of the data application. At the same time, since the large-capacity inherent storage space of the terminal device can be fully utilized as the first memory, the capacity is increased while the cost is reduced.
通过上述本申请提供的数据写入的方法,一方面,相对于当前的已有采用Secure Flash的inSE方案,能够降低成本,又能充分利用第一存储器的大容量空间来支持更多的应用。另一方面,相对不用Secure Flash的inSE方案,本申请安全写入数据的次数没有限制,可以满足所有安全业务场景需求。通过本方案,使inSE这种芯片架构能够满足CC EAL5+认证需求,且不受存储容量、写入次数等限制,降低成本,提高了安全等级和用户体验。The data writing method provided by the above application, on the one hand, can reduce the cost and fully utilize the large capacity space of the first memory to support more applications, compared to the current inSE solution using Secure Flash. On the other hand, the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met. Through this solution, the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
结合第一方面,在第一方面的某些实现方式中,所述验证信息包括以下信息中的至少一种信息:对所述待存储数据进行校验处理生成的校验序列;由计数器记录的计数值;或由随机数生成的随机序列。With reference to the first aspect, in some implementations of the first aspect, the verification information includes at least one of the following information: a check sequence generated by performing verification processing on the data to be stored; and recorded by a counter Count value; or a random sequence generated by a random number.
具体地,验证信息可以是SE根据预设的校验算法对所述待存储数据进行处理后生成校验序列,校验算法可以是安全Hash算法如散列算法SHA-256或者消息认证码安全算法(Message Authentication Code,MAC)(例如高级加密标准AES-CMAC算法)等。这种情况下,可以该验证信息就包括该生成的校验序列。Specifically, the verification information may be that the SE processes the to-be-stored data according to a preset verification algorithm to generate a check sequence, and the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm. (Message Authentication Code, MAC) (such as the advanced encryption standard AES-CMAC algorithm). In this case, the verification information can include the generated verification sequence.
另一种可能的情况,该验证信息包括计数器记录的计数值。例如,单向计数器记录计数值,从0开始计数,每次写入一次数据到第一存储器(或者第一存储器的Page x),对应的计数值就加1。In another possible case, the verification information includes a count value recorded by the counter. For example, the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
又一种可能的情况,该验证信息包括随机数Random-x-valid生成的随机序列。例如,可以是根据预设的随机函数生成的随机序列。In another possible case, the verification information includes a random sequence generated by a random number Random-x-valid. For example, it may be a random sequence generated according to a preset random function.
结合第一方面和上述实现方式,在第一方面的某些实现方式中,所述根据所述验证信息对所述待存储数据进行安全处理包括以下处理中的至少一种:利用所述验证信息对所述待存储数据进行校验处理;或根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行加密。With reference to the first aspect and the foregoing implementation manner, in some implementation manners of the first aspect, the performing security processing on the to-be-stored data according to the verification information includes at least one of: using the verification information Performing a verification process on the data to be stored; or determining a first key according to the verification information, and encrypting the first data by using the first key.
针对上述介绍了三种不同的验证信息种类,有不同的处理方式,以下也具体进行说明。Three different types of verification information are introduced for the above, and there are different processing methods, and the following is also specifically described.
当SE根据预设的校验算法对该待存储数据进行处理后生成校验序列,这是验证信息就是校验序列,则该验证信息和待存储数据已经在校验处理的过程中构成校验关系。在这种情况下,该验证信息和待存储的数据可以一起构成第一数据。例如,当校验算法消息认证码安全MAC算法时,该240byte的待存储数据经过该MAC算法处理生成16byte校验序列,该240byte的待存储数据和16byte的校验序列构成第一数据之后,经过第一密钥加密生成256byte的密文存储到第一存储器。When the SE processes the data to be stored according to a preset verification algorithm to generate a check sequence, where the verification information is a check sequence, the verification information and the data to be stored have been verified in the process of the check processing. relationship. In this case, the verification information and the data to be stored may together constitute the first data. For example, when the algorithm algorithm authentication code secure MAC algorithm is verified, the 240 bytes of data to be stored are processed by the MAC algorithm to generate a 16-byte check sequence, and the 240-byte data to be stored and the 16-byte check sequence form the first data. The first key encryption generates 256 bytes of ciphertext and stores it in the first memory.
当验证信息包括计数器记录的计数值Count。例如,单向计数器记录计数值,从0开始计数,每次写入一次数据到第一存储器(或者第一存储器的Page x),对应的计数值就加1。那么,此时要保证验证信息和待存储的数据之间要构成校验关系,即计数值Count要参与到待存储数据的处理过程,否则两者没有关系,就不能构成校验关系。When the verification information includes the count value Count recorded by the counter. For example, the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the count value Count is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
可选地,SE在进行消息认证码安全MAC处理过程中,将计数值Count带入到数据明文一起进行MAC处理,而将该计数值就作为验证信息,经过第二密钥的加密处理后存储到第二存储器;待存储数据和计数值经过MAC处理后生成第一数据,从而将该第一数据 经过第一密钥的加密处理后存储到第一存储器。Optionally, in the process of performing the secure authentication of the message authentication code, the SE brings the count value Count to the data plaintext for MAC processing, and the count value is used as the verification information, and is stored after being encrypted by the second key. Go to the second memory; the data to be stored and the count value are processed by the MAC to generate the first data, so that the first data is stored in the first memory after being encrypted by the first key.
另一种可能的实现方式,待存储数据的消息认证码安全MAC处理过程中,并不加入计数值Count,MAC处理完成后,在进行加密时,该计数值Count可以参与到确定第一密钥的过程,SE利用该第一密钥对该第一数据进行加密。In another possible implementation manner, during the secure MAC processing of the message authentication code of the data to be stored, the count value Count is not added. After the MAC processing is completed, when the encryption is performed, the count value Count may participate in determining the first key. The process, the SE encrypts the first data by using the first key.
具体的,当待存储数据需要存储到第一存储器中,SE根据HUK1和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器。Specifically, when the data to be stored needs to be stored in the first memory, the SE derives the first key according to the HUK1 and the count value, and then stores the first data in the first memory after being encrypted by the first key.
或者,当待存储数据需要存储到第一存储器中的Page 2时,SE根据HUK1、该Page 2的ID地址和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器的Page 2的存储区域。Alternatively, when the data to be stored needs to be stored in Page 2 in the first memory, the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
应理解,以上两种将计数值参与到待存储数据的处理过程方法任选一种应用可以实现,两种方法一起应用也是可以实现的。只要保证采用什么样的方式参与,就采用对应的方法校验即可。应理解,本申请包括但不限于此。It should be understood that the above two processing methods for participating in the count value to the data to be stored may be implemented by an application, and the two methods may be implemented together. As long as you are sure to participate in any way, you can use the corresponding method to verify. It should be understood that the application includes but is not limited thereto.
经过上述数据写入过程的相关处理,可以实现验证信息和待存储数据之间的关联性。由于存在关联,下一步在读取数据时,将第一存储器的数据,第二存储器的对应验证信息读进内部RAM后,就可以验证数据的合法性。Through the related processing of the above data writing process, the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
当验证信息包括随机数Random-x-valid生成的随机序列。例如,可以是根据预设的随机函数生成的随机序列。那么,此时要保证验证信息和待存储的数据之间要构成校验关系,即随机序列要参与到待存储数据的处理过程,否则两者没有关系,就不能构成校验关系。When the verification information includes a random sequence generated by a random number Random-x-valid. For example, it may be a random sequence generated according to a preset random function. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the random sequence is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
可选地,SE在进行消息认证码安全MAC处理过程中,将随机序列带入到数据明文一起进行MAC处理。将该随机序列就作为验证信息,经过第二密钥的加密处理后存储到第二存储器;待存储数据和随机序列经过MAC处理后生成第一数据,从而将该第一数据经过第一密钥的加密处理后存储到第一存储器。Optionally, in the process of performing secure MAC address processing on the message authentication code, the SE brings the random sequence to the data plaintext for MAC processing. The random sequence is used as the verification information, and is stored in the second memory after being encrypted by the second key; the data to be stored and the random sequence are processed by the MAC to generate the first data, thereby passing the first data to the first key. The encryption process is stored in the first memory.
另一种可能的实现方式,SE在待存储数据的消息认证码安全MAC处理过程中,并不加入随机序列,MAC处理完成后,在进行加密时,该随机序列可以参与到确定第一密钥的过程,SE利用该第一密钥对该第一数据进行加密。In another possible implementation manner, the SE does not add a random sequence in the process of secure MAC address processing of the message authentication code of the data to be stored. After the MAC processing is completed, the random sequence may participate in determining the first key when performing encryption. The process, the SE encrypts the first data by using the first key.
具体的,当待存储数据需要存储到第一存储器中,SE根据HUK1和随机序列派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器。Specifically, when the data to be stored needs to be stored in the first memory, the SE derives the first key according to the HUK1 and the random sequence, and then stores the first data in the first memory through the encryption process of the first key.
或者,当待存储数据需要存储到第一存储器中的Page 2时,SE根据HUK1、该Page 2的ID地址和随机序列派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器的Page 2的存储区域。Alternatively, when the data to be stored needs to be stored in Page 2 in the first memory, the SE derives the first key according to the ID address of the HUK1, the Page 2, and the random sequence, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
又或者,随机序列可以不经过派生,直接作为第一存储器中的Page 2中第一数据的第一密钥。Alternatively, the random sequence may be directly derived as the first key of the first data in Page 2 in the first memory without derivation.
应理解,以上三种将随机序列参与到待存储数据的处理过程方法任选一种应用可以实现,三种方法一起应用也是可以实现的。只要保证采用什么样的方式参与,就采用对应的方法校验即可。应理解,本申请包括但不限于此。It should be understood that the above three processing methods for participating in the random sequence to the data to be stored may be implemented by an application, and the three methods may be implemented together. As long as you are sure to participate in any way, you can use the corresponding method to verify. It should be understood that the application includes but is not limited thereto.
经过上述数据写入过程的相关处理,可以实现验证信息和待存储数据之间的关联性。由于存在关联,下一步在读取数据时,将第一存储器的数据,第二存储器的对应验证信息读进内部RAM后,就可以验证数据的合法性。Through the related processing of the above data writing process, the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
结合第一方面和上述实现方式,在第一方面的某些实现方式中,所述安全元件还用于: 在将所述验证信息存储到第二存储器之前,根据第二密钥对所述验证信息进行加密,所述第二密钥不同于所述第一密钥。In conjunction with the first aspect and the implementation described above, in some implementations of the first aspect, the secure element is further configured to: verify the verification according to the second key pair before storing the verification information to the second memory The information is encrypted, the second key being different from the first key.
结合第一方面和上述实现方式,在第一方面的某些实现方式中,所述根据所述验证信息确定第一密钥包括:根据所述验证信息和第一预设序列,确定所述第一密钥;以及所述安全元件还用于:根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。With reference to the first aspect and the foregoing implementation manner, in some implementation manners of the first aspect, the determining, according to the verification information, the first key comprises: determining, according to the verification information and a first preset sequence, a key; and the secure element is further configured to: determine the second key according to a second preset sequence, the second preset sequence being different from the first preset sequence.
应理解,这里的第一预设序列可以是上述的HUK1,第二预设序列可以是上述的It should be understood that the first preset sequence herein may be the above-mentioned HUK1, and the second preset sequence may be the above.
HUK2。HUK2.
结合第一方面,在第一方面的某些实现方式中,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,包括:将所述第一数据存储到所述第一存储器的N个区域中的第一区域,并将所述验证信息存储到所述第二存储器的N个区域中的第二区域,其中,所述第一区域与所述第二区域对应。In conjunction with the first aspect, in some implementations of the first aspect, the first memory includes N regions, the second memory includes N regions, and the N regions of the first memory and the second The N areas of the memory are in one-to-one correspondence, N is a positive integer, and the storing the first data to the first memory and storing the verification information to the second memory comprises: storing the first data Going to a first one of the N regions of the first memory, and storing the verification information to a second region of the N regions of the second memory, wherein the first region and the first region The two areas correspond.
结合第一方面和上述实现方式,在第一方面的某些实现方式中,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述安全元件还用于按照如下顺序执行所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器的操作:将所述验证信息存储到所述第二区域中未被占用的子区域;将所述第一数据存储到所述第一区域;删除所述第二区域中已被占用的子区域中存储的历史验证信息。With reference to the first aspect and the foregoing implementation manner, in some implementations of the first aspect, each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to Verifying the size of the information, the secure element is further configured to perform the storing the storing the first data to the first memory and storing the verification information to the second memory in an order of: storing the verification information And the sub-area that is not occupied in the second area; storing the first data to the first area; and deleting historical verification information stored in the sub-area that has been occupied in the second area.
具体地,第二存储器的验证块2分为两个子区域,分别是有效区和空白区,每个区域都能够存放该待存储数据的验证信息。在利用上述方法得到经过第一密钥加密的第一数据和经过第二密钥加密的验证信息之后,假如将第一数据写入第一存储器的存储块Page 2,在将该验证信息写入第二存储器的验证块2的过程中,将该验证信息写到验证块2的有效区,空白区没有任何数据。当有新数据需要存储到该存储块Page 2时,假设第二数据为新待存储数据,需要按照如下的写入流程:(1)待存储的第二数据,确定该第二数据对应的第二验证信息,过程参照上述第一数据的方法,此处不再赘述;(2)保留第二存储器的验证块2有效区的原第一数据对应的第一验证信息,将经过第二密钥加密后的第二验证信息写入到该验证块2的空白区;(3)将待存储的第二数据经过安全处理后根据第一密钥加密后写入到第一存储器地存储块Page 2;(4)删除第二存储器的验证块2有效区的原第一数据对应的第一验证信息,则原有效区变为空白区,新写入的第二验证信息作为有效验证信息。Specifically, the verification block 2 of the second memory is divided into two sub-areas, which are an effective area and a blank area, and each area can store verification information of the data to be stored. After obtaining the first data encrypted by the first key and the verification information encrypted by the second key by using the above method, if the first data is written to the storage block Page 2 of the first memory, the verification information is written In the process of verifying block 2 of the second memory, the verification information is written to the valid area of the verification block 2, and the blank area has no data. When there is new data to be stored in the storage block Page 2, assuming that the second data is new to be stored, the following writing process is required: (1) the second data to be stored, and the second data corresponding to the second data is determined. Second verification information, the process refers to the above method of the first data, and will not be described again here; (2) retaining the first verification information corresponding to the original first data of the valid area of the verification block 2 of the second memory, and passing the second key The encrypted second verification information is written to the blank area of the verification block 2; (3) the second data to be stored is subjected to security processing, and then encrypted according to the first key and then written to the first memory storage block Page 2 (4) deleting the first verification information corresponding to the original first data of the valid area of the verification block 2 of the second memory, the original valid area becomes a blank area, and the newly written second verification information is used as valid verification information.
之所以每个验证块要划分两个区域,是因为可以防止数据写入时掉电,进行掉电保护。上述数据写入时,任意环节都有可能系统掉电。有了上述写入的流程后,任何时候掉电,启动时会发现第二存储器的验证块要么1个区域有效,1个区域空白,此时取有效区域包含的字段作为验证信息。The reason why each verification block is divided into two areas is because it can prevent power loss when data is written, and power-down protection is performed. When the above data is written, the system may be powered down at any point. After the above-mentioned writing process, if the power is turned off at any time, it will be found that the verification block of the second memory is valid for one area and one area is blank. At this time, the field included in the valid area is taken as the verification information.
或者,2个区域都有验证信息,则再读取第一存储器的page 2的存储的数据,将两个区域的验证信息都去尝试验证下。Alternatively, if both areas have verification information, the stored data of page 2 of the first memory is read again, and the verification information of both areas is tried to be verified.
又或者,有一个区域的验证信息是正确的,则擦除另一个不正确的验证信息。如果两 个验证信息都不正确,则认为是收到安全攻击,存储无效,进行报错。Or, if the verification information of one area is correct, another incorrect verification information is erased. If the two verification information are not correct, it is considered to be a security attack, the storage is invalid, and an error is reported.
通过以上的执行流程,能够对数据进行掉电保护,任何一个环节掉电,并不会影响验证信息和存储数据的对应性,能够时刻保持数据的安全性,提高用户体验。Through the above execution process, the data can be protected from power failure, and any link is powered down, which does not affect the correspondence between the verification information and the stored data, and can maintain the security of the data and improve the user experience.
结合第一方面和上述实现方式,在第一方面的某些实现方式中,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件的专用存储器。In conjunction with the first aspect and the implementation described above, in some implementations of the first aspect, the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Dedicated memory.
第二方面,提供了一种系统芯片,其特征在于,所述系统芯片包括安全元件和中央处理器,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件用于:从第一存储器获取第一数据;从第二存储空间获取验证信息,所述验证信息用于验证所述第一数据的合法性,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器;根据所述验证信息对所述第一数据进行解安全处理得到处理后的数据。In a second aspect, a system chip is provided, characterized in that the system chip comprises a security element and a central processor, the security element being coupled to the central processor, the central processor for controlling the security An element for: acquiring first data from a first memory; obtaining verification information from a second storage space, the verification information being used to verify validity of the first data, the first memory and The second memory is a different memory than the system chip; and the first data is de-secured according to the verification information to obtain processed data.
通过上述本申请提供的数据读取的方法,一方面,相对于当前的已有采用Secure Flash的inSE方案,能够降低成本,又能充分利用第一存储器的大容量空间来支持更多的应用。另一方面,相对不用Secure Flash的inSE方案,本申请安全写入数据的次数没有限制,可以满足所有安全业务场景需求。通过本方案,使inSE这种芯片架构能够满足CC EAL5+认证需求,且不受存储容量、写入次数等限制,降低成本,提高了安全等级和用户体验。According to the data reading method provided by the above application, on the one hand, compared with the current inSE solution using Secure Flash, the cost can be reduced, and the large capacity of the first memory can be fully utilized to support more applications. On the other hand, the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met. Through this solution, the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
结合第二方面,在第二方面的某些实现方式中,所述验证信息包括以下信息中的至少一种信息:对所述待存储数据进行校验处理生成的校验序列;由计数器记录的计数值;或由随机数生成的随机序列。With reference to the second aspect, in some implementations of the second aspect, the verification information includes at least one of the following information: a check sequence generated by performing verification processing on the data to be stored; and recorded by a counter Count value; or a random sequence generated by a random number.
结合第二方面,在第二方面的某些实现方式中,所述根据所述验证信息对所述第一数据进行解安全处理包括以下处理中的至少一种:利用所述验证信息对所述第一数据进行解校验处理;或根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行解密。With reference to the second aspect, in some implementations of the second aspect, the performing the de-secure processing on the first data according to the verification information includes at least one of: using the verification information to Decoding the first data; or determining a first key according to the verification information, and decrypting the first data by using the first key.
结合第二方面和上述实现方式,在第二方面的某些实现方式中,所述安全元件用于在从第二存储器获取验证信息之前,根据第二密钥对所述验证信息进行解密,所述第二密钥不同于所述第一密钥。With reference to the second aspect and the foregoing implementation manner, in some implementations of the second aspect, the secure element is configured to decrypt the verification information according to the second key before acquiring the verification information from the second memory, where The second key is different from the first key.
结合第二方面和上述实现方式,在第二方面的某些实现方式中,所述根据所述验证信息确定第一密钥,包括:根据所述验证信息和第一预设序列,确定所述第一密钥;以及所述安全元件还用于:根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。With reference to the second aspect and the foregoing implementation manner, in some implementation manners of the second aspect, the determining, according to the verification information, the first key comprises: determining, according to the verification information and a first preset sequence, The first key; and the secure element is further configured to: determine the second key according to the second preset sequence, where the second preset sequence is different from the first preset sequence.
结合第二方面和上述实现方式,在第二方面的某些实现方式中,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及所述从第一存储器获取第一数据,包括:从所述第一存储器的N个区域中的第一区域获取所述第一数据;以及所述从第二存储器获取验证信息,包括:从所述第二存储器的N个区域中的第二区域获取验证信息,其中,所述第一区域与所述第二区域对应。With reference to the second aspect and the foregoing implementation manner, in some implementations of the second aspect, the first memory includes N regions, the second memory includes N regions, and the N regions of the first memory are The N areas of the second memory are in one-to-one correspondence, N is a positive integer, and the acquiring the first data from the first memory includes: acquiring the first area from the N areas of the first memory The first data; and the obtaining the verification information from the second memory, comprising: obtaining verification information from a second one of the N regions of the second memory, wherein the first region corresponds to the second region .
结合第二方面和上述实现方式,在第二方面的某些实现方式中,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述根据所述验证信息对所述第一数据进行解安全处理,包括:将所述第二区域的 第一子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理;将所述第二区域的第二子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理。With reference to the second aspect and the foregoing implementation manner, in some implementations of the second aspect, each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to The size of the verification information, the de-securing the first data according to the verification information, comprising: using information stored in a first sub-area of the second area as the verification information, and The first data is subjected to de-secure processing; the information stored in the second sub-area of the second area is used as the verification information, and the first data is de-secured.
结合第二方面和上述实现方式,在第二方面的某些实现方式中,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件对应的专用存储器。In conjunction with the second aspect and the implementation described above, in some implementations of the second aspect, the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Corresponding dedicated memory.
第三方面,提供了一种处理数据的方法,其特征在于,应用于包括安全元件和中央处理器的系统芯片,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件执行所述方法,所述方法包括:确定验证信息,所述验证信息用于验证待存储数据的合法性;根据所述验证信息对所述待存储数据进行安全处理得到第一数据;将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,其中,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器。In a third aspect, a method of processing data is provided, which is applied to a system chip including a secure element and a central processor, the secure element being coupled to the central processor, the central processor for controlling The security element, the security element performing the method, the method comprising: determining verification information, the verification information is used to verify validity of data to be stored; and the data to be stored is secured according to the verification information Processing the first data; storing the first data to the first memory, and storing the verification information to the second memory, wherein the first memory and the second memory are outside the system chip Different memory.
结合第三方面,在第三方面的某些实现方式中,所述验证信息包括以下信息中的至少一种信息:对所述待存储数据进行校验处理生成的校验序列;由计数器记录的计数值;或由随机数生成的随机序列。With reference to the third aspect, in some implementations of the third aspect, the verification information includes at least one of the following information: a check sequence generated by performing verification processing on the data to be stored; and recorded by a counter Count value; or a random sequence generated by a random number.
结合第三方面和上述实现方式,在第三方面的某些实现方式中,所述根据所述验证信息对所述待存储数据进行安全处理包括以下处理中的至少一种:利用所述验证信息对所述待存储数据进行校验处理;或根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行加密。With reference to the third aspect and the foregoing implementation manner, in some implementation manners of the third aspect, the performing security processing on the to-be-stored data according to the verification information includes at least one of: using the verification information Performing a verification process on the data to be stored; or determining a first key according to the verification information, and encrypting the first data by using the first key.
结合第三方面和上述实现方式,在第三方面的某些实现方式中,所述方法还包括:在将所述验证信息存储到第二存储器之前,根据第二密钥对所述验证信息进行加密,所述第二密钥不同于所述第一密钥。With reference to the third aspect and the foregoing implementation manner, in some implementation manners of the third aspect, the method further includes: performing the verification information according to the second key before storing the verification information to the second memory Encrypted, the second key being different from the first key.
结合第三方面和上述实现方式,在第三方面的某些实现方式中,所述根据所述验证信息确定第一密钥包括:根据所述验证信息和第一预设序列,确定所述第一密钥;以及所述方法还包括:根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。With reference to the third aspect and the foregoing implementation manner, in some implementation manners of the third aspect, the determining, according to the verification information, the first key comprises: determining, according to the verification information and the first preset sequence, a key; and the method further comprises: determining the second key according to a second preset sequence, the second preset sequence being different from the first preset sequence.
结合第三方面和上述实现方式,在第三方面的某些实现方式中,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,包括:将所述第一数据存储到所述第一存储器的N个区域中的第一区域,并将所述验证信息存储到所述第二存储器的N个区域中的第二区域,其中,所述第一区域与所述第二区域对应。In conjunction with the third aspect and the foregoing implementation manner, in some implementations of the third aspect, the first memory includes N regions, the second memory includes N regions, and the N regions of the first memory are The N areas of the second memory are in one-to-one correspondence, N is a positive integer, and the storing the first data to the first memory and storing the verification information to the second memory includes: The first data is stored to a first one of the N regions of the first memory, and the verification information is stored to a second region of the N regions of the second memory, wherein the first region Corresponding to the second region.
结合第三方面和上述实现方式,在第三方面的某些实现方式中,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述方法还包括按照如下顺序执行所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器的操作:将所述验证信息存储到所述第二区域中未被占用的子区域;将所述第一数据存储到所述第一区域;删除所述第二区域中已被占用的子区域中存储的历史验证信息。With reference to the third aspect and the foregoing implementation manner, in some implementations of the third aspect, each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to Verifying the size of the information, the method further comprising performing the storing the first data to the first memory and storing the verification information to the second memory in an order of: storing the verification information to the Determining the unoccupied sub-area in the second area; storing the first data to the first area; deleting historical verification information stored in the occupied sub-area in the second area.
结合第三方面和上述实现方式,在第三方面的某些实现方式中,所述第一存储器是所 述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件的专用存储器。In conjunction with the third aspect and the implementation described above, in some implementations of the third aspect, the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Dedicated memory.
第四方面,提供了一种处理数据的方法,其特征在于,应用于包括安全元件和中央处理器的系统芯片,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件执行所述方法,所述方法包括:从第一存储器获取第一数据;从第二存储器获取验证信息,所述验证信息用于验证所述第一数据的合法性,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器;根据所述验证信息对所述第一数据进行解安全处理得到处理后的数据。In a fourth aspect, a method of processing data is provided, which is applied to a system chip including a secure element and a central processor, the secure element being coupled to the central processor, the central processor for controlling The secure element, the secure element performing the method, the method comprising: acquiring first data from a first memory; obtaining verification information from a second memory, the verification information being used to verify validity of the first data And the first memory and the second memory are different memories except the system chip; and the first data is de-secured according to the verification information to obtain processed data.
结合第四方面,在第四方面的某些实现方式中,所述验证信息包括以下信息中的至少一种信息:对所述待存储数据进行校验处理生成的校验序列;由计数器记录的计数值;或由随机数生成的随机序列。With reference to the fourth aspect, in some implementations of the fourth aspect, the verification information includes at least one of the following information: a verification sequence generated by performing verification processing on the to-be-stored data; recorded by a counter Count value; or a random sequence generated by a random number.
结合第四方面和上述实现方式,在第四方面的某些实现方式中,所述根据所述验证信息对所述第一数据进行解安全处理包括以下处理中的至少一种:利用所述验证信息对所述第一数据进行解校验处理;或根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行解密。With reference to the fourth aspect and the foregoing implementation manner, in some implementation manners of the fourth aspect, the performing the de-secure processing on the first data according to the verification information includes at least one of: using the verification Decoding the first data by the information; or determining the first key according to the verification information, and decrypting the first data by using the first key.
结合第四方面和上述实现方式,在第四方面的某些实现方式中,所述在从第二存储器获取验证信息之前,所属方法还包括:根据第二密钥对所述验证信息进行解密,所述第二密钥不同于所述第一密钥。With reference to the fourth aspect and the foregoing implementation manner, in some implementation manners of the fourth aspect, before the obtaining the verification information from the second memory, the method further includes: decrypting the verification information according to the second key, The second key is different from the first key.
结合第四方面和上述实现方式,在第四方面的某些实现方式中,所述根据所述验证信息确定第一密钥,包括:根据所述验证信息和第一预设序列,确定所述第一密钥;以及所述方法还包括:根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。With reference to the fourth aspect and the foregoing implementation manner, in some implementation manners of the fourth aspect, the determining, according to the verification information, the first key includes: determining, according to the verification information and a first preset sequence, a first key; and the method further comprises: determining the second key according to a second preset sequence, the second preset sequence being different from the first preset sequence.
结合第四方面和上述实现方式,在第四方面的某些实现方式中,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及所述从第一存储器获取第一数据,包括:从所述第一存储器的N个区域中的第一区域获取所述第一数据;以及所述从第二存储器获取验证信息,包括:从所述第二存储器的N个区域中的第二区域获取验证信息,其中,所述第一区域与所述第二区域对应。In conjunction with the fourth aspect and the foregoing implementation manner, in some implementations of the fourth aspect, the first memory includes N regions, the second memory includes N regions, and the N regions of the first memory are The N areas of the second memory are in one-to-one correspondence, N is a positive integer, and the acquiring the first data from the first memory includes: acquiring the first area from the N areas of the first memory The first data; and the obtaining the verification information from the second memory, comprising: obtaining verification information from a second one of the N regions of the second memory, wherein the first region corresponds to the second region .
结合第四方面和上述实现方式,在第四方面的某些实现方式中,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述根据所述验证信息对所述第一数据进行解安全处理,包括:将所述第二区域的第一子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理;将所述第二区域的第二子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理。With reference to the fourth aspect and the foregoing implementation manner, in some implementations of the fourth aspect, each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to The size of the verification information, the de-securing the first data according to the verification information, comprising: using information stored in a first sub-area of the second area as the verification information, and The first data is subjected to de-secure processing; the information stored in the second sub-area of the second area is used as the verification information, and the first data is de-secured.
结合第四方面和上述实现方式,在第四方面的某些实现方式中,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件对应的专用存储器。In conjunction with the fourth aspect and the implementation described above, in some implementations of the fourth aspect, the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Corresponding dedicated memory.
第五方面,提供了一种通信装置,其特征在于,包括:第一方面、第一方面任一种可能的实现方式以及第二方面、第一方面任一种可能的实现方式中所述的系统芯片,第一存 储器和第二存储器。In a fifth aspect, a communication device is provided, comprising: the first aspect, any possible implementation manner of the first aspect, and the second aspect, any one of the possible implementation manners of the first aspect A system chip, a first memory and a second memory.
第六方面,提供了一种通信装置,该通信装置可以为终端设备,或者为设置在终端设备中的芯片。该通信装置包括:处理器,与存储器耦合,可用于执行存储器中的指令,以实现上述第三方面以及第三方面中的任意一种可能的实现方式和第四方面以及第四方面中的任意一种可能的实现方式中所执行的步骤。可选地,该通信装置还包括存储器。可选地,该通信装置还包括通信接口,处理器与通信接口耦合。In a sixth aspect, a communication device is provided, which may be a terminal device or a chip disposed in the terminal device. The communication device includes a processor coupled to the memory and operative to execute instructions in the memory to implement any of the possible implementations of the third and third aspects above, and any of the fourth and fourth aspects. A step performed in one possible implementation. Optionally, the communication device further comprises a memory. Optionally, the communication device further includes a communication interface, the processor being coupled to the communication interface.
第七方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码在计算设备或安全元件上运行时,使得计算设备或安全元件执行上述第三方面以及第三方面中的任意一种可能的实现方式和第四方面以及第四方面中的任意一种可能的实现方式中的方法。In a seventh aspect, a computer program product is provided, the computer program product comprising: computer program code, when the computer program code is run on a computing device or a secure element, causing the computing device or the secure element to perform the third aspect described above And any one of the possible implementations of the third aspect and the method of any one of the fourth aspect and the fourth aspect.
第八方面,提供了一种计算机可读介质,所述计算机可读介质存储有程序代码,当所述计算机程序代码在计算设备或安全元件上运行时,使得计算设备或安全元件执行上述第三方面以及第三方面中的任意一种可能的实现方式和第四方面以及第四方面中的任意一种可能的实现方式中的方法。In an eighth aspect, a computer readable medium storing program code for causing a computing device or a secure element to perform the third step when the computer program code is run on a computing device or a secure element Aspects and any one of the possible implementations of the third aspect and the method of any one of the fourth aspect and the fourth aspect.
第九方面,提供了一种系统芯片,该系统芯片包括处理器,用于支持终端设备实现上述方面中所涉及的功能,例如,写入数据,加密,解密,读取数据,或其他处理上述方法中所涉及的数据和/或信息。在一种可能的设计中,所述系统芯片还包括存储器,所述存储器,用于保存终端设备必要的程序指令和数据。该系统芯片可以由芯片构成,也可以包括芯片和其他分立器件。In a ninth aspect, a system chip is provided, the system chip comprising a processor for supporting a terminal device to implement the functions involved in the foregoing aspects, such as writing data, encrypting, decrypting, reading data, or other processing Data and/or information involved in the method. In a possible design, the system chip further includes a memory for storing necessary program instructions and data of the terminal device. The system chip can be composed of chips, and can also include chips and other discrete devices.
附图说明DRAWINGS
图1是一种可能的芯片设计架构示意图。Figure 1 is a schematic diagram of a possible chip design architecture.
图2是本申请实施例提供的一例系统芯片架构示意图。FIG. 2 is a schematic diagram of a system chip architecture provided by an embodiment of the present application.
图3是本申请实施例提供的又一例存储器保存内容的示意图。FIG. 3 is a schematic diagram of still another example of memory storage content provided by an embodiment of the present application.
图4是本申请实施例提供的一例处理数据的方法示意图。FIG. 4 is a schematic diagram of an example of processing data according to an embodiment of the present application.
图5是本申请实施例提供的又一例数据处理示例的示意图。FIG. 5 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
图6是本申请实施例提供的又一例数据处理示例的示意图。FIG. 6 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
图7是本申请实施例提供的又一例数据处理示例的示意图。FIG. 7 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
图8是本申请实施例提供的又一例数据处理示例的示意图。FIG. 8 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
图9是本申请实施例提供的又一例数据处理示例的示意图。FIG. 9 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
图10是本申请实施例提供的又一例数据处理示例的示意图。FIG. 10 is a schematic diagram of still another example of data processing provided by an embodiment of the present application.
图11是本申请实施例提供的又一例存储器的存储子区域示意图。FIG. 11 is a schematic diagram of a storage sub-area of another memory provided by an embodiment of the present application.
图12是本申请实施例提供的又一例处理数据的方法示意图。FIG. 12 is a schematic diagram of another method for processing data according to an embodiment of the present application.
具体实施方式detailed description
下面将结合附图,对本申请中的技术方案进行描述。The technical solutions in the present application will be described below with reference to the accompanying drawings.
在本说明书中使用的术语“部件”、“模块”、“系统”等用于表示终端设备相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。应理解,本申请实施例中的方式、情况、类别以及实施例的划分仅是为了描述的方便,不应构成特别的限定,各种方式、 类别、情况以及实施例中的特征在不矛盾的情况下可以相结合。The terms "component," "module," "system," and the like, as used in this specification, are used to mean a terminal device-related entity, hardware, firmware, a combination of hardware and software, software, or software in execution. It should be understood that the manners, the conditions, the categories, and the divisions of the embodiments in the embodiments of the present application are only for convenience of description, and should not be specifically limited. The various modes, categories, situations, and features in the embodiments are not contradictory. In case you can combine them.
还应理解,申请实施例中的“第一”、“第二”以及“第三”仅为了区分,不应对本申请构成任何限定。It should also be understood that the terms "first", "second", and "third" in the application examples are merely a distinction and should not be construed as limiting.
还应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should also be understood that, in various embodiments of the present application, the size of the sequence number of each process does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiment of the present application. The implementation process constitutes any limitation.
还应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should also be understood that, in various embodiments of the present application, the size of the sequence number of each process does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not be taken to the embodiment of the present application. The implementation process constitutes any limitation.
还需要说明的是,本申请实施例中,“预先定义”可以通过在设备(例如,包括终端设备)中预先保存相应的代码、表格或其他可用于指示相关信息的方式来实现,本申请对于其具体的实现方式不做限定。比如预先定义可以是指协议中定义的。It should be noted that, in the embodiment of the present application, “pre-definition” may be implemented by pre-storing corresponding codes, tables or other manners in the device (for example, including the terminal device), which may be used to indicate related information. The specific implementation manner is not limited. For example, pre-definition can be defined in the protocol.
还需要说明的是,本申请实施例中,“的(of)”,“相应的(corresponding,relevant)”和“对应的(corresponding)”有时可以混用,应当指出的是,在不强调其区别时,其所要表达的含义是一致的。It should be noted that, in the embodiment of the present application, “of”, “corresponding, relevant” and “corresponding” may sometimes be mixed, and it should be noted that the difference is not emphasized. At the time, the meaning to be expressed is the same.
还需要说明的是,“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。“至少一个”是指一个或一个以上;“A和B中的至少一个”,类似于“A和/或B”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和B中的至少一个,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。下面将结合附图详细说明本申请提供的技术方案。It should also be noted that “and/or” describes the association relationship of the associated objects, indicating that there may be three relationships, for example, A and/or B, which may indicate that A exists separately, A and B exist simultaneously, and B exists separately. These three situations. The character "/" generally indicates that the contextual object is an "or" relationship. "At least one" means one or more; "at least one of A and B", similar to "A and/or B", describing the association of associated objects, indicating that there may be three relationships, for example, A and B. At least one of them may indicate that A exists separately, and A and B exist simultaneously, and B cases exist separately. The technical solutions provided by the present application will be described in detail below with reference to the accompanying drawings.
本申请实施例提供的存储数据的方法和装置,可以应用于终端设备上。终端设备也可以称为用户设备(user equipment,UE)、接入终端、用户单元、用户站、移动站、移动台、远方站、远程终端、移动设备、用户终端、终端、无线通信设备、用户代理或用户装置。本申请的实施例中的终端设备可以是手机(mobile phone)、平板电脑(Pad)、带无线收发功能的电脑、虚拟现实(Virtual Reality,VR)终端设备、增强现实(Augmented Reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等等。本申请的实施例对应用场景不做限定。本申请中将前述终端设备及可设置于前述终端设备的芯片统称为终端设备。The method and apparatus for storing data provided by the embodiments of the present application can be applied to a terminal device. A terminal device may also be called a user equipment (UE), an access terminal, a subscriber unit, a subscriber station, a mobile station, a mobile station, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, and a user. Agent or user device. The terminal device in the embodiment of the present application may be a mobile phone, a tablet, a computer with a wireless transceiver function, a virtual reality (VR) terminal device, and an augmented reality (AR) terminal. Equipment, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, transportation security ( A wireless terminal in a transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, and the like. The embodiment of the present application does not limit the application scenario. In the present application, the foregoing terminal device and a chip that can be disposed in the foregoing terminal device are collectively referred to as a terminal device.
此外,在本申请实施例中,终端设备还可以是物联网(Internet of Things,IoT)系统中的终端设备,IoT是未来信息技术发展的重要组成部分,其主要技术特点是将物品通过通信技术与网络连接,从而实现人机互连,物物互连的智能化网络。In addition, in the embodiment of the present application, the terminal device may also be a terminal device in an Internet of Things (IoT) system, and the IoT is an important component of future information technology development, and its main technical feature is to pass the article through the communication technology. Connected to the network to realize an intelligent network of human-machine interconnection and physical interconnection.
本申请实施例将以生活中最广泛使用的智能手机为例进行详细的说明。The embodiment of the present application will be described in detail by taking the most widely used smartphone in life as an example.
用户使用智能手机除了对相机、音频、视频以及智能手机性能的不断提升的需求外,对智能手机涉及移动支付,移动金融等手机安全的需求也越来越高。除此之外,智能手机作为汽车钥匙、银行卡等承载财产的安全应用也逐步有了需求。手机未来可能会收编所有的银行卡、公交卡、钥匙和身份证等,要实现这些功能,除了需要各类相应的软件开发的 支持,更需要手机芯片提供硬件级安全。In addition to the ever-increasing demand for the performance of cameras, audio, video and smartphones, the demand for smartphones involving mobile payments, mobile finance and other mobile phones is increasing. In addition, smart phones have gradually become a demand for security applications such as car keys and bank cards. In the future, mobile phones may include all bank cards, bus cards, keys and ID cards. To achieve these functions, in addition to the support of various software developments, mobile phone chips are required to provide hardware-level security.
图1是一种可能的芯片设计架构示意图。如图1所示的芯片架构100,该芯片架构100将安全元件SE 104内置于系统芯片SOC 103中,芯片架构100可以包括以下的部件。Figure 1 is a schematic diagram of a possible chip design architecture. As shown in the chip architecture 100 of FIG. 1, the chip architecture 100 incorporates the secure element SE 104 in the system chip SOC 103, which may include the following components.
A、电源管理单元(Power Management Unit,PMU)101A, Power Management Unit (PMU) 101
芯片架构100中的电源管理单元101集成芯片架构100所有的电源管理功能,主要功能有系统复位、锁相环和分频器、引脚信号识别和解码、睡眠模式和模块电源管理等功能。电源管理系统可以与处理器逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗等功能。The power management unit 101 in the chip architecture 100 integrates all power management functions of the chip architecture 100. The main functions include system reset, phase-locked loop and frequency divider, pin signal recognition and decoding, sleep mode, and module power management. The power management system can be connected to the processor logic to manage functions such as charging, discharging, and power consumption through a power management system.
B、RF电路102B, RF circuit 102
RF电路102可用于收发信息或通话过程中,信号的接收和发送。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、LNA(Low Noise Amplifier,低噪声放大器)、双工器等。此外,RF电路102还可以通过无线通信与网络设备等其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于无线局域网(Wireless Local Area Networks,WLAN)、全球移动通讯(Global System of Mobile communication,GSM)系统、码分多址(Code Division Multiple Access,CDMA)系统、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)系统、通用分组无线业务(General Packet Radio Service,GPRS)、长期演进(Long Term Evolution,LTE)系统、LTE频分双工(Frequency Division Duplex,FDD)系统、LTE时分双工(Time Division Duplex,TDD)、通用移动通信系统(Universal Mobile Telecommunication System,UMTS)、全球互联微波接入(Worldwide Interoperability for Microwave Access,WiMAX)通信系统、未来的第五代(5th Generation,5G)系统或新无线(New Radio,NR)等。The RF circuit 102 can be used to transmit and receive information and receive and transmit signals during a call. Generally, RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuit 102 can also communicate with other devices such as network devices through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Wireless Local Area Networks (WLAN), Global System of Mobile communication (GSM) systems, Code Division Multiple Access (Code Division Multiple) Access, CDMA) system, Wideband Code Division Multiple Access (WCDMA) system, General Packet Radio Service (GPRS), Long Term Evolution (LTE) system, LTE frequency division dual (Frequency Division Duplex (FDD) system, LTE Time Division Duplex (TDD), Universal Mobile Telecommunication System (UMTS), Worldwide Interoperability for Microwave Access (WiMAX) communication System, future 5th Generation (5G) system or New Radio (NR).
C、AP主芯片103C, AP main chip 103
主芯片103即上述的系统芯片SOC,是一种集成电路的芯片,逻辑核包括中央处理器(Central Processing Unit,CPU)105、时钟电路、定时器、中断控制器、串并行接口、其它外围设备、输入/输出子系统(input/output,I/O)端口以及用于各种IP核之间的粘合逻辑等等;存储器核包括各种易失存储器、非易失存储器(Non-Volatile Memory,NVM)以及Cache等存储器;模拟核包括模拟数字转换器(Analog to Digital Converter,ADC)、数字模拟转换器(Digital to Analog Converter,DAC)、锁相环电路(Phase Locked Loop,PLL)以及一些高速电路中所用的模拟电路。The main chip 103, that is, the system chip SOC described above, is an integrated circuit chip, and the logic core includes a central processing unit (CPU) 105, a clock circuit, a timer, an interrupt controller, a serial parallel interface, and other peripheral devices. Input/output (I/O) ports and glue logic for various IP cores, etc.; memory cores include various volatile memory, non-volatile memory (Non-Volatile Memory) , NVM) and Cache and other memory; analog cores include Analog to Digital Converter (ADC), Digital to Analog Converter (DAC), Phase Locked Loop (PLL) and some Analog circuits used in high speed circuits.
D、中央处理器105D, the central processing unit 105
CPU 105是SOC 103的控制中心,即终端设备的控制中心,利用各种接口和线路连接整个终端设备的各个部分,通过运行或执行存储在存储器内的软件程序和/或模块,以及调用存储在存储器内的数据,执行终端设备的各种功能和处理数据,从而对终端设备进行整体监控。可选的,处理器可包括一个或多个处理单元;优选的,处理器可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器中。The CPU 105 is the control center of the SOC 103, that is, the control center of the terminal device, which connects various parts of the entire terminal device by various interfaces and lines, by running or executing software programs and/or modules stored in the memory, and calling the storage in The data in the memory performs various functions and processing data of the terminal device, thereby performing overall monitoring on the terminal device. Optionally, the processor may include one or more processing units; preferably, the processor may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, etc., and modulates The demodulation processor primarily handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor.
CPU 105可以选择性包括运算器和控制器,是系统芯片的核心部件,用于获取指令并处理数据。具体地可以用于进行指令执行顺序的控制、操作控制、时间控制以及对数据进 行算术运算和逻辑运算,或进行其他信息的处理等。The CPU 105 can optionally include an operator and a controller, which are core components of the system chip for acquiring instructions and processing data. Specifically, it can be used to perform control of an instruction execution sequence, operation control, time control, and arithmetic and logical operations on data, or processing of other information.
E、存储器件107E, storage device 107
具体的包括嵌入式多媒体存储(embedded Multi Media Card,eMMC)、通用闪存存储(Universal Flash Storage,UFS)、双倍速率(Double Data Rate,DDR)同步动态随机存储器等。具体地,如存储器阵列Memory Array、芯片级独立存储区域(Replay Protected Memory Block,RPMB),其中RPMB是eMMC一个比较特别的分区,主要的作用是存放一些核心敏感数据。Specifically, it includes an embedded multimedia media (eMMC), a universal flash storage (UFS), a double rate (Double Data Rate, DDR) synchronous dynamic random access memory, and the like. Specifically, such as a memory array Array, a Replay Protected Memory Block (RPMB), where RPMB is a relatively special partition of eMMC, the main function is to store some core sensitive data.
存储器件还包括可用于存储软件程序以及模块,处理器通过运行存储在存储器件的软件程序以及模块,从而执行终端设备的各种功能应用以及数据处理。存储器件还包括存储程序区和存储数据区,例如芯片架构100中的只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)等。其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据终端设备的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器件还可以包括高速随机存取存储器,还可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory device also includes a program and a module that can be used to store software programs and modules that execute various functional applications and data processing of the terminal device by running software programs and modules stored in the memory device. The storage device further includes a storage program area and a storage data area, such as a read-only memory (ROM), a random access memory (RAM), and the like in the chip architecture 100. The storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the storage data area may store data created according to the use of the terminal device (such as audio data, Phone book, etc.). In addition, the memory device may also include a high speed random access memory, and may also include a non-volatile memory (NVM), such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
F、近距离无线通信控制器108F, short-range wireless communication controller 108
近距离无线通信(Near Filed Communication,NFC)控制器108可以是一种芯片,在单一芯片基础上结合感应式读卡器、感应式卡片和点对点的功能,能在短距离内与兼容设备进行识别和数据交换。NFC芯片具有相互通信能力,并具有计算能力,可以还包括加密逻辑电路、加密/解密模块等。The Near Filed Communication (NFC) controller 108 can be a chip that combines an inductive card reader, an inductive card, and a peer-to-peer function on a single chip to identify compatible devices in a short distance. And data exchange. The NFC chip has mutual communication capability and computing power, and may further include an encryption logic circuit, an encryption/decryption module, and the like.
G、其他输入设备G, other input devices
其他输入设备可用于接收输入的数字或字符信息,以及产生与终端设备的用户设置以及功能控制有关的键信号输入。Other input devices can be used to receive input numeric or character information, as well as to generate key signal inputs related to user settings and function control of the terminal device.
除上述列举的各个模块之外,系统芯片还包括其他未示出的单元或模块,例如将存储单元和控制器一同做到系统芯片上的多媒体存储(Multi Media Card,MMC)控制器、双倍速率控制器(Double Data Rate Controler,DDRC)等,在此不再赘述。In addition to the various modules listed above, the system chip also includes other units or modules not shown, such as the storage unit and the controller together to implement a multimedia storage (Multi Media Card, MMC) controller on the system chip, double The rate controller (Double Data Rate Controler, DDRC), etc., will not be described here.
下面将重点介绍SOC 103内部的SE 104。在上述这种将SE 104内置于终端设备的SOC103的系统芯片,我们可以称为inSE系统,该系统能够加强手机的安全等级。应理解,在inSE系统架构中,由SOC 103的中央处理器CPU 105来控制SE 104,具体包括控制SE 104的打开、关闭、控制功耗或工作状态等。此外,CPU 105作为系统芯片的核心可以控制系统芯片的其他部分器件,本实施例不做限定。The SE 104 inside the SOC 103 will be highlighted below. In the above-described system chip of the SOC 103 in which the SE 104 is built in the terminal device, we can call it the inSE system, which can enhance the security level of the mobile phone. It should be understood that in the inSE system architecture, the SE 104 is controlled by the central processing unit CPU 105 of the SOC 103, specifically including controlling the opening, closing, controlling power consumption or operating state of the SE 104, and the like. In addition, the CPU 105 can control other parts of the system chip as the core of the system chip, which is not limited in this embodiment.
安全元件SE 104通常以嵌入SOC 103内部形式提供,可以运行智能卡应用程序,能够防止外部恶意解析攻击,保护数据安全。另外在系统芯片中具有加密/解密逻辑电路。传统的安全元件SE可以用于智能卡(Smart Card)中的IC芯片中,但现在在携带电话中的SIM卡,SD等芯片也实现了同样的功能。The secure element SE 104 is typically provided in the form of an embedded SOC 103 that can run a smart card application, preventing external malicious resolution attacks and protecting data security. In addition, there is an encryption/decryption logic circuit in the system chip. The conventional secure element SE can be used in an IC chip in a smart card, but now the SIM card, SD and other chips in the mobile phone also perform the same function.
如图1中的黑色粗实线部分所示,SE 104具有完备的CPU,ROM,RAM等。下面简要介绍SE的内部结构。如图1中104所示,SE作为一种元件,也包括上述类似于SOC103中的大部分元件或结构,具体的列举括以下的部件。As shown by the black thick solid line portion in Fig. 1, the SE 104 has a complete CPU, ROM, RAM, and the like. The following is a brief introduction to the internal structure of the SE. As shown by 104 in Fig. 1, SE as an element also includes most of the elements or structures similar to those described above in SOC 103, and specifically includes the following components.
A、中央处理器CPU 106A, central processing unit CPU 106
利用各种接口和线路连接系统芯片内或芯片外各个部分,通过运行或执行存储在存储器内的软件程序和/或模块,以及调用存储在存储器内的数据,执行各种功能和处理数据的操作。可选的,处理器可包括一个或多个处理单元。Using various interfaces and lines to connect various parts within or outside the system chip, perform various functions and process data operations by running or executing software programs and/or modules stored in the memory, and calling data stored in the memory. . Optionally, the processor can include one or more processing units.
CPU 106可选择性包括运算器和控制器,是SE104的核心部件,用于获取指令并处理数据。具体地可以用于进行指令执行顺序的控制、操作控制、时间控制以及对数据进行算熟运算和逻辑运算,或进行其他信息的处理等。The CPU 106 can optionally include an operator and a controller, which are core components of the SE 104 for fetching instructions and processing data. Specifically, it can be used to perform control of an instruction execution sequence, operation control, time control, and arithmetic and logical operations on data, or processing of other information.
在芯片架构100中,安全元件SE的CPU 106可以和系统芯片SOC的CPU 105之间进行通信连接,由系统芯片SOC的中央处理器CPU 105来控制安全元件SE,包括控制SE的打开、关闭、控制功耗或工作状态等。In the chip architecture 100, the CPU 106 of the secure element SE can be in communication connection with the CPU 105 of the system chip SOC, and the central processing unit SE of the system chip SOC controls the secure element SE, including controlling the opening and closing of the SE. Control power consumption or working status, etc.
B、存储器件B, storage device
存储器件可用于存储数据、软件程序以及模块,处理器通过运行存储在存储器件的软件程序以及模块,从而各种功能应用以及进行数据处理。存储器件还包括存储程序区和存储数据区,例如芯片架构100中示出的ROM、RAM等。此外,SE中还包括一次性编程(One Time Programmable,OTP)存储器。The storage device can be used to store data, software programs, and modules, and the processor can perform various functional applications and perform data processing by running software programs and modules stored in the storage device. The memory device also includes a memory program area and a memory data area, such as ROM, RAM, etc., shown in chip architecture 100. In addition, the SE also includes One Time Programmable (OTP) memory.
C、异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)C, asynchronous transceiver (Universal Asynchronous Receiver/Transmitter, UART)
UART是硬件的组成部分,是一种通用串行数据总线,用于异步通信。该总线双向通信,可以实现全双工传输和接收。它将要传输数据或程序在串行通信与并行通信之间加以转换,作为把并行输入信号转成串行输出信号的芯片,UART通常被集成于其他通讯接口的连结上。UART可以作为独立的模块化芯片,或作为集成于微处理器中的周边设备,作为连接外部设备的接口。The UART is part of the hardware and is a general-purpose serial data bus for asynchronous communication. The bus bidirectional communication enables full duplex transmission and reception. It converts data or programs between serial communication and parallel communication. As a chip that converts parallel input signals into serial output signals, the UART is usually integrated into the links of other communication interfaces. The UART can be used as a stand-alone modular chip or as a peripheral device integrated in the microprocessor as an interface to external devices.
D、单线连接协议接口(Single wire connection protocol,SWP)D, single wire connection protocol (SWP)
单线连接协议主要是基于NFC技术的一种移动支付解决方案,应用于手机SIM卡或者SD卡到非接前端(Contactless Frontend,CLF)之间的通讯。The single-line connection protocol is mainly a mobile payment solution based on NFC technology, which is applied to communication between a mobile phone SIM card or an SD card to a contactless front end (CLF).
inSE系统可以通过NFC和SWP接口与NFC控制器连接,具有三种操作模式:关闭,连线和虚拟。一般可以通过外部读写器与SE通讯,或者通过内部连线接口访问。The inSE system can be connected to the NFC controller via NFC and SWP interfaces and has three modes of operation: off, wired and virtual. It can usually be communicated to the SE via an external reader or via an internal connection interface.
E、加密IP封装(Crypto IP Encapsulation,CIPE)E. Crypto IP Encapsulation (CIPE)
CIPE使用加密的IP分组,CIPE分组被给以目标头信息,并使用默认的CIPE加密机制来加密。CIPE uses encrypted IP packets, which are given header information and encrypted using the default CIPE encryption mechanism.
F、随机数生成器(True Random Number Generator,TRNG)F, Random Number Generator (TRNG)
随机数生成器是一种通过物理过程而非计算机程序来生成随机数字的设备。A random number generator is a device that generates random numbers through physical processes rather than computer programs.
以上简单介绍了该inSE系统的组成以及各部分之间的通信,该inSE系统安全解决方案,能够将安全元件集成到处理器当中,更能防备来自物理层面的攻击,具有更高的安全性。在该方案中,集成到主芯片SOC的SE模块内部无非易失性存储器NVM,原因是目前SOC主芯片工艺非常先进,主流已经到7nm,而在这种工艺下NVM的介质Flash无法集成到主芯片的裸片Die中。The above briefly introduces the composition of the inSE system and the communication between the various parts. The inSE system security solution integrates the security components into the processor, and is more resistant to attacks from the physical level and has higher security. In this scheme, the SE module integrated into the main chip SOC has no non-volatile memory NVM, because the current SOC main chip process is very advanced, the mainstream has reached 7nm, and in this process, the NVM media flash cannot be integrated into the main The chip's die Die.
SE的安全级别是非常高的,非易失存储NVM存储数据,能够达到以下要求:The security level of the SE is very high. The non-volatile storage NVM stores data and can meet the following requirements:
(1)具有抵抗非易失存储的数据泄露的保护能力(Confidentiality);(1) Protection against data leakage against non-volatile storage (Confidentiality);
(2)具有抵抗非易失存储的抗干扰的保护能力(integrity);(2) having an anti-interference protection capability against non-volatile storage;
(3)具有抵抗非易失存储的抗修改和防回退的能力(integrity&anti-rollback)。(3) It has the ability to resist the modification and anti-rollback of nonvolatile storage (integrity & anti-rollback).
NVM存储能够保证数据的机密性、完整性和防回退能力,在该inSE系统中,没有NVM,目前现有技术已经实现了保证数据机密性和完整性的要求,对于数据的防回退(anti-rollback)的能力,主要使用片内一次性编程芯片(One Time Programmable,OTP)来实现。具体地,使用OTP内部的bit计数器进行数据防回滚,安全性也能够满足CC EAL4+的认证要求。NVM storage can guarantee the confidentiality, integrity and anti-return capability of data. In the inSE system, there is no NVM. At present, the prior art has realized the requirement of ensuring data confidentiality and integrity, and anti-backup for data ( The ability to anti-rollback is mainly achieved using an on-chip One Time Programmable (OTP). Specifically, the data counter rollback is performed using the bit counter inside the OTP, and the security can also meet the certification requirements of the CC EAL4+.
但是,目前OTP内部的bit计数器当前可以到几十K bits。几十K bits意味着最大安全的写入次数也是几万次,故存在写入次数的限制。几万次的写入限制虽然可以满足当前消费者的刷卡,车钥匙,身份证等业务的需求,但是对于有些安全场景下这些次数还是不够的。例如手机做Pos机使用的场景,系统安全防暴力破解计数等,这些频繁需要记录到安全元件SE的安全应用场景时,几万次的写入限制不能满足用户需求。However, the current bit counter inside the OTP can currently reach tens of K bits. A few tens of K bits means that the maximum number of secure writes is tens of thousands of times, so there is a limit on the number of writes. Although the tens of thousands of write restrictions can meet the needs of current consumers' cards, car keys, ID cards, etc., these times are not enough for some security scenarios. For example, the scenario in which the mobile phone is used as a Pos machine, the system security against brute force cracking, etc., which frequently need to be recorded in the security application scenario of the secure element SE, tens of thousands of write restrictions cannot meet the user's needs.
为了在各种安全的场景下满足用户的需求,一种可能的解决方案是设置外部专用安全存储Secure Flash。经过验证,这样的方案能够实现安全认证标准达到CC EAL5+,能够做到保证数据的机密性和完整性,从而保证用户的使用安全。In order to meet the needs of users in various security scenarios, one possible solution is to set up external dedicated secure storage Secure Flash. It has been verified that such a solution can achieve the safety certification standard up to CC EAL5+, which can ensure the confidentiality and integrity of the data, thus ensuring the safety of the user.
一种可能的安全存储系统,除了上述介绍的系统芯片SOC 103、安全元件SE 104以外,通过在SOC外部设置专用的安全存储芯片Secure Flash 201,将需要存储的数据和程序等都存储在Secure Flash 201内,安全性满足要求。同时,程序甚至可以片内执行,无需全部搬运到内部RAM中,数据写入要求都可以满足各种安全应用场景存储采用专用的Secure Flash,一般需要4MB左右才能满足手机的安全需求,例如完成智能手机的移动支付,公交卡,安全盾等。但是,4MB Flash的成本很高,基本不会被采用。而且,后续对手机安全空间需求越来越多的话,成本还会继续上升。A possible secure storage system, in addition to the system chip SOC 103 and the secure element SE 104 described above, stores a data and a program to be stored in Secure Flash by setting a dedicated secure memory chip Secure Flash 201 outside the SOC. In 201, the security meets the requirements. At the same time, the program can even be executed on-chip, without all being transferred to the internal RAM. The data writing requirements can satisfy various security application scenarios. The storage uses dedicated Secure Flash, which generally takes about 4MB to meet the security requirements of the mobile phone, such as completing the smart. Mobile payment for mobile phones, bus cards, security shields, etc. However, the cost of 4MB Flash is very high and will not be adopted. Moreover, if there is more and more demand for mobile phone security space, the cost will continue to rise.
因此,亟需一种安全存储的实现流程,能够在保证成本的情况下,满足所有安全业务场景的需求。本申请实施例将基于当前的inSE的芯片架构,提供一种实现安全存储的流程,通过充分复用终端设备自己的固有存储空间支持安全应用数据空间,利用外置安全Flash存储芯片只做数据防回退和密钥存储管理,不做实际数据存储,从而使得安全Flash存储容量需求较小。Therefore, an implementation process of secure storage is needed, which can meet the requirements of all security business scenarios while ensuring cost. The embodiment of the present application provides a process for implementing secure storage based on the current inSE chip architecture, and supports the secure application data space by fully multiplexing the inherent storage space of the terminal device, and uses the external secure Flash memory chip to perform data defense only. Rollback and key storage management, without actual data storage, resulting in less demand for secure Flash storage capacity.
图2是本申请实施例提供的一例系统芯片架构示意图。如图2所示的系统架构200,包括安全元件SE 104内置于系统芯片SOC 103,该安全元件和SOC 103的中央处理器CPU105相耦合,该CPU 105用于控制该安全元件SE 104。另外,系统架构200还包括第一存储器202和第二存储器201,该第一存储器202和该第二存储器201是该系统芯片SOC 103之外的不同的存储器。其中,该第一存储器202用于存储数据和程序,第二存储器201用于存储验证信息,用来验证待存储数据的合法性。FIG. 2 is a schematic diagram of a system chip architecture provided by an embodiment of the present application. The system architecture 200, as shown in FIG. 2, includes a secure element SE 104 built into the system chip SOC 103, which is coupled to a central processing unit CPU 105 of the SOC 103 for controlling the secure element SE 104. In addition, system architecture 200 also includes a first memory 202 and a second memory 201, which are different memories than the system chip SOC 103. The first memory 202 is used to store data and programs, and the second memory 201 is used to store verification information for verifying the legality of the data to be stored.
此外,图2中示出了第二存储器201和SE 104之间通过高速串行接口(SerDes Framer Interface,SFI)进行通信。应理解,Secure Flash和SE 104之间的通信是需要建立安全通道来进行数据传输的,这里通过SFI接口和安全逻辑之间的连接来实现。从而Secure Flash和SE之间可以传输经过加密的数据,这样的安全通道能够防止数据被篡改或者回滚等。安全通道的建立属于现有技术,本实施例不做过多介绍。Further, communication between the second memory 201 and the SE 104 via a high speed serial interface (SerDes Framer Interface, SFI) is shown in FIG. It should be understood that the communication between Secure Flash and SE 104 needs to establish a secure channel for data transmission, which is realized by the connection between the SFI interface and the security logic. Thus, encrypted data can be transmitted between Secure Flash and SE, and such a secure channel can prevent data from being tampered or rolled back. The establishment of the secure channel belongs to the prior art, and the present embodiment does not introduce too much.
可选地,该第一存储器202是SE 104和中央处理器CPU的共享存储器,该第二存储器201是该安全元件SE 104的专用安全存储器(Secure Flash)。Optionally, the first memory 202 is a shared memory of the SE 104 and the central processing unit CPU, and the second memory 201 is a dedicated secure memory (Secure Flash) of the secure element SE 104.
本申请实施例设置第一存储器202和第二存储器201,应理解,该第一存储器202是 通用存储器,没有安全要求,容量大;第二存储器201是专用安全存储器。具体地,第一存储器可以是手机本身具有的存储器。例如,我们当前手机存储器的大小一般为64GB、132GB等,有比较大的存储空间,本申请实施例涉及的第一存储器202是64GB或132GB中的4MB或者16MB。这样的第一存储器的容量对于目前比较大的手机固有存储来说基本没有任何成本影响,即使未来随着用户需求的增长,要增大该第一存储器的容量,也不会对手机成本造成影响。The first embodiment of the present application sets the first memory 202 and the second memory 201. It should be understood that the first memory 202 is a general-purpose memory and has no security requirements and has a large capacity; the second memory 201 is a dedicated secure memory. Specifically, the first memory may be a memory that the mobile phone itself has. For example, the size of the current mobile phone memory is generally 64 GB, 132 GB, etc., and has a relatively large storage space. The first memory 202 involved in the embodiment of the present application is 4 MB or 16 MB of 64 GB or 132 GB. The capacity of such a first memory has substantially no cost impact on the currently large mobile phone inherent storage, and even if the user's demand grows in the future, the capacity of the first memory is increased, and the cost of the mobile phone is not affected. .
第二存储器201是专用安全存储器,具体地,可以是外部认证过的专用安全存储Secure Flash。一种可能的情况,该Secure Flash是放在SE 104的内部,属于安全认证范围,或者该Secure Flash属于安全元件外部的设备。本申请实施例以SE 104为例详细进行说明。应理解,本申请包括但不限于此。The second memory 201 is a dedicated secure memory, and specifically may be an externally authenticated dedicated secure storage Secure Flash. In a possible case, the Secure Flash is placed inside the SE 104 and belongs to the scope of security certification, or the Secure Flash is a device external to the secure element. The embodiment of the present application is described in detail by taking the SE 104 as an example. It should be understood that the application includes but is not limited thereto.
作为SE 104和中央处理器CPU 105的共享存储器,该第一存储器202可以包括不同的彼此隔离的存储区,分别存放SE 104和CPU 105的数据或程序等信息。As a shared memory of the SE 104 and the central processing unit CPU 105, the first memory 202 may include different storage areas that are isolated from each other, and store information such as data or programs of the SE 104 and the CPU 105, respectively.
应理解,本申请实施例设置了用于存储数据或程序的第一存储器,第二存储器用于存储待存储数据对应的验证信息。假设待存储数据的大小为4KB,而验证信息的大小远远小于该待存储数据的大小,例如验证信息的校验段只有32byte,那么第二存储器大小如果是128KB,就可以支持16MB的第一存储器的安全。即,通过本申请实施例提供的系统架构和方法就能够降低成本,保证了数据应用的安全。同时,因为又能充分利用终端设备的大容量的固有存储空间作为第一存储器,容量加大的同时降低了成本。It should be understood that the embodiment of the present application sets a first memory for storing data or a program, and the second memory is used for storing verification information corresponding to the data to be stored. Assuming that the size of the data to be stored is 4 KB, and the size of the verification information is much smaller than the size of the data to be stored, for example, the verification segment of the verification information is only 32 bytes, if the second memory size is 128 KB, the first 16 MB can be supported. Memory security. That is, the system architecture and method provided by the embodiments of the present application can reduce the cost and ensure the security of the data application. At the same time, since the large-capacity inherent storage space of the terminal device can be fully utilized as the first memory, the capacity is increased while the cost is reduced.
可选地,本申请实施例还设置第三存储器,第三存储器可以是SE内部的一次性编程OTP存储器,如图2中所示的OTP 203。该OTP 203集成在SOC芯片里的数字逻辑部分,可以实现一次性编程的非易失性存储(Non-volatile storage,NVS)。该第三存储器用于存储SE 104的ID、HUK1和HUK2。这里解释一下HUK1和HUK2,HUK1是SE和外部的第一存储器之间进行存储数据或读取数据的密钥,HUK2是SE和外部的第二存储器之间进行储验证信息或读取验证信息的密钥。应理解,在安全应用场景中,存储在SE之外的数据和程序都是需要加密储存,从而确保数据和程序的安全性。Optionally, the embodiment of the present application further sets a third memory, which may be a one-time programmable OTP memory inside the SE, such as the OTP 203 shown in FIG. 2 . The OTP 203 is integrated into the digital logic portion of the SOC chip to enable one-time programming of non-volatile storage (NVS). This third memory is used to store the IDs of the SE 104, HUK1 and HUK2. Here, HUK1 and HUK2 are explained. HUK1 is a key for storing data or reading data between the SE and the external first memory, and HUK2 is for storing verification information or reading verification information between the SE and the external second memory. Key. It should be understood that in a secure application scenario, data and programs stored outside of the SE need to be encrypted for storage to ensure data and program security.
其中,HUK1是每个SE独立唯一的key,用于第一存储的数据存储加密解密的根密钥(root key)。HUK1主要为了第一存储器的加密,所有程序以及应用数据放在第一存储器,由于第一存储器是外部存储器,故需要加密存储,密钥可以采用HUK1作为根密钥进行派生,使得每个存储的小单元作为加密块单位,其加密密钥各不相同。具体地,用于待存储数据加密的密钥可以根据该根密钥HUK1进行派生,例如,根据该根密钥HUK1、待存储数据在第一存储器的存储地址以及其他序列等派生出的密钥,对待存储数据进行加密,从而存储到第一存储器202。本申请中将用于对存储到第一存储器的待存储数据进行加密的密钥称为第一密钥。Among them, HUK1 is an independent and unique key for each SE, and is used for the first stored data storage to encrypt and decrypt the root key. HUK1 is mainly used for the encryption of the first memory. All programs and application data are placed in the first memory. Since the first memory is an external memory, encrypted storage is required, and the key can be derived using HUK1 as a root key, so that each storage is The small unit is used as an encryption block unit, and its encryption keys are different. Specifically, the key used for data encryption to be stored may be derived according to the root key HUK1, for example, a key derived from the root key HUK1, a storage address of the data to be stored in the first memory, and other sequences. The stored data is encrypted and stored in the first memory 202. The key used to encrypt the data to be stored stored in the first memory in the present application is referred to as a first key.
HUK2也是每个SE独立唯一的密钥key,是用于和第二存储器进行配对的共享密钥(Share key)。Secure Flash作为SE的专用安全存储器,在与SE绑定时,绑定过程视产品不同,可以在整机生产线,也可以在芯片封装生产线,会将HUK2也会写入到Secure flash中;从而使得Secure Flash和SE这两个器件可以采用同一个共享密钥HUK2建立安全通道,从而进行安全通信,确保Secure Flash的内容加密并有校验的读取或写入。即第二存储器201和SE之间采用同一个共享密钥进行安全通信,本申请中将用于对存储到第二存 储器的验证信息进行加密的密钥称为第二密钥。相应地,第二存储器201内部也存储有HUK2,可以在整机生产时写入HUK2。HUK2 is also a unique key key for each SE, and is a shared key for pairing with the second memory. Secure Flash is a dedicated secure memory for SE. When binding with SE, the binding process depends on the product. It can be written to the Secure flash in the whole machine production line or in the chip packaging production line. The Secure Flash and SE devices can use the same shared key HUK2 to establish a secure channel for secure communication, ensuring that Secure Flash content is encrypted and has a verified read or write. That is, the same shared key is used for secure communication between the second memory 201 and the SE. The key used to encrypt the authentication information stored in the second memory in the present application is referred to as a second key. Correspondingly, the second memory 201 also stores the HUK 2 inside, which can be written to the HUK 2 during the production of the whole machine.
此外,第三存储器除了存储有SE 104的ID、HUK1和HUK2,也可以存储其他系统所需的密钥。这些密钥都是芯片生产时写入OTP的,例如对于HUK1和HUK2,SOC内部在生产时可以通过随机数发生器产生随机数写入第三存储OTP中,写入后不可再被更改。应理解,本申请包括但不限于此。Further, the third memory can store keys required by other systems in addition to the IDs of the SE 104, HUK1, and HUK2. These keys are written to the OTP when the chip is produced. For example, for HUK1 and HUK2, the SOC can be internally written into the third storage OTP by a random number generator during production, and cannot be changed after being written. It should be understood that the application includes but is not limited thereto.
可选地,该第一存储器包括N个区域,该第二存储器包括N个区域,该第一存储器的N个区域与该第二存储器的N个区域一一对应,N为正整数。Optionally, the first memory includes N regions, and the second memory includes N regions, and the N regions of the first memory are in one-to-one correspondence with the N regions of the second memory, where N is a positive integer.
图3示出了本申请实施例提供的一例存储器保存内容的示意图,即可以按照一定的大小划分该第一存储器或第二存储器。具体地,将第一存储器按照4KB的大小划分为N个存储块,例如图3中所示的Page 1、Page 2…Page N;将第二存储器按照32byte的大小划分为N个验证块,例如图3中所示的验证块1、验证块2…验证块N。其中,每个Page都有对应的安全认证的存储Secure Flash(第二存储器)的验证块,即第二存储器保留对应Page的验证信息,确保第一存储器存储的数据不会被篡改或者回退。FIG. 3 is a schematic diagram showing an example of memory storage contents provided by an embodiment of the present application, that is, the first memory or the second memory may be divided according to a certain size. Specifically, the first memory is divided into N storage blocks according to the size of 4 KB, such as Page 1 , Page 2...Page N shown in FIG. 3; the second memory is divided into N verification blocks according to the size of 32 bytes, for example The verification block 1, the verification block 2, ... the verification block N shown in FIG. Each page has a corresponding secure authentication storage block of the Secure Flash (second memory), that is, the second memory retains the verification information corresponding to the page, and ensures that the data stored in the first memory is not tampered or rolled back.
此外,在这种实现方式中,第一密钥可以是根据HUK1和不同的Page的ID派生出的Kenc_page 1,Kenc_page 2…Kenc_page N,然后分别对待存储到不同Page的待存储数据进行加密,再写入对应的Page。应理解,本申请包括但并不限于此。In addition, in this implementation manner, the first key may be Kenc_page 1, Kenc_page 2...Kenc_page N derived from the ID of HUK1 and different Pages, and then the data to be stored stored in different pages is respectively encrypted, and then Write the corresponding Page. It should be understood that this application includes, but is not limited to, this.
以上结合图2和图3介绍了本申请实施例的系统架构以及第一存储器和第二存储器的功能的存储内容,应理解,本申请实施例提供的方法应用于所有包括上述系统架构的通信装置,如所列举的智能手机等终端设备,即包括本系统架构的所有装置均落入本申请保护的范围。下面结合图4至图11对本申请实施例提供的处理数据的方法进行详细的说明。The system architecture of the embodiment of the present application and the storage contents of the functions of the first memory and the second memory are described above with reference to FIG. 2 and FIG. 3. It should be understood that the method provided by the embodiment of the present application is applied to all communication devices including the foregoing system architecture. Terminal devices such as the listed smart phones, that is, all devices including the architecture of the system, fall within the scope of protection of the present application. The method for processing data provided by the embodiment of the present application is described in detail below with reference to FIG. 4 to FIG.
图4是本申请实施例提供的一例处理数据的方法示意图。该方法400示出了数据写入的具体过程,应用于上述的架构200,包括安全元件SE和中央处理器的系统芯片,该安全元件SE和该中央处理器相耦合,该中央处理器用于控制该安全元件SE,包括控制其打开、关闭、控制功耗或工作状态等。该方法400包括以下内容。FIG. 4 is a schematic diagram of an example of processing data according to an embodiment of the present application. The method 400 illustrates a specific process of data writing applied to the architecture 200 described above, including a secure element SE and a system chip of a central processor coupled to the central processor for controlling The secure element SE includes controlling its opening, closing, controlling power consumption or working state, and the like. The method 400 includes the following.
S410,安全元件SE确定验证信息,该验证信息用于验证待存储数据的合法性。S410. The secure element SE determines verification information, which is used to verify the legality of the data to be stored.
在写入待存储数据的过程中,需要将待存储数据经过加密存储到第一存储器。但是在处理数据的一系列过程中,数据可能在安全元件SE外部处理的任何环节被篡改或被攻击,因此,为了保证数据的合法性,需要一定的验证信息来验证该数据的合法性。然后将该待存储数据写入到第一存储器,将该待存储数据的相应验证信息存储到第二存储器。In the process of writing data to be stored, the data to be stored needs to be encrypted and stored in the first memory. However, in a series of processes of processing data, data may be tampered with or attacked at any point outside the processing of the secure element SE. Therefore, in order to ensure the legitimacy of the data, certain verification information is required to verify the legitimacy of the data. The data to be stored is then written to the first memory, and the corresponding verification information of the data to be stored is stored to the second memory.
可选地,该验证信息包括以下信息中的至少一种信息:对该待存储数据进行校验处理生成的校验序列;或由计数器记录的计数值;或由随机数生成的随机序列。Optionally, the verification information includes at least one of the following information: a check sequence generated by performing check processing on the data to be stored; or a count value recorded by a counter; or a random sequence generated by a random number.
应理解,这里校验处理是为了验证数据是否被篡改,进行完整性校验,例如,通过校验处理得到一个验证信息。相应地,在读取数据的过程中,会进行解校验处理,就是根据校验处理过程得到的该验证信息来验证数据在处理过程中是否被篡改或者恶意攻击,从而保证安全性。It should be understood that the verification process here is to verify whether the data has been tampered with, and to perform an integrity check, for example, to obtain a verification message by the verification process. Correspondingly, in the process of reading data, the de-verification process is performed, that is, the verification information obtained by the verification process is used to verify whether the data is tampered or maliciously attacked during the process, thereby ensuring security.
具体地,验证信息可以是SE根据预设的校验算法对所述待存储数据进行处理后生成校验序列,校验算法可以是安全Hash算法如散列算法SHA-256或者消息认证码安全算法(Message Authentication Code,MAC)(例如高级加密标准AES-CMAC算法)等。这种 情况下,可以该验证信息就包括该生成的校验序列。Specifically, the verification information may be that the SE processes the to-be-stored data according to a preset verification algorithm to generate a check sequence, and the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm. (Message Authentication Code, MAC) (such as the advanced encryption standard AES-CMAC algorithm). In this case, the verification information can include the generated verification sequence.
另一种可能的情况,该验证信息包括计数器记录的计数值。例如,单向计数器记录计数值,从0开始计数,每次写入一次数据到第一存储器(或者第一存储器的Page x),对应的计数值就加1。In another possible case, the verification information includes a count value recorded by the counter. For example, the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
又一种可能的情况,该验证信息包括随机数Random-x-valid生成的随机序列。例如,可以是根据预设的随机函数生成的随机序列。In another possible case, the verification information includes a random sequence generated by a random number Random-x-valid. For example, it may be a random sequence generated according to a preset random function.
S420,安全元件SE根据该验证信息对该待存储数据进行安全处理得到第一数据。S420. The secure element SE performs security processing on the data to be stored according to the verification information to obtain first data.
在S410的步骤中,得到了验证信息,可以根据该验证信息对该待存储数据进行安全处理得到第一数据。其中,该安全处理包括以下处理中的至少一项处理:利用该验证信息对该待存储数据进行MAC处理;或根据该验证信息确定第一密钥,利用该第一密钥对该第一数据进行加密。In the step of S410, the verification information is obtained, and the data to be stored may be securely processed according to the verification information to obtain the first data. The security process includes at least one of the following processes: performing MAC processing on the data to be stored by using the verification information; or determining a first key according to the verification information, using the first key to the first data Encrypt.
S430,安全元件SE将该第一数据存储到第一存储器,并将该验证信息存储到第二存储器,其中,该第一存储器和该第二存储器是该系统芯片之外的不同存储器。S430. The secure element SE stores the first data to the first memory and stores the verification information to the second memory, wherein the first memory and the second memory are different memories outside the system chip.
在执行完S410步骤之后,安全元件SE得到了验证信息,但是要使验证信息和待存储数据构成校验关系,才能够在读取数据的过程中,通过该验证信息来验证该读取的数据的合法性,否则没有意义。即要将验证信息参与到待存储数据处理过程中,否则两者没有关系,构不成校验关系。After the step S410 is performed, the secure element SE obtains the verification information, but the verification information and the data to be stored constitute a verification relationship, and the read data can be verified by the verification information in the process of reading the data. Legitimacy, otherwise it makes no sense. That is, the verification information is to be involved in the data processing process to be stored, otherwise the two have no relationship and cannot be verified.
在S410中介绍了验证信息可以是三种列举的信息中的至少一种信息。具体地,分为以下三种情况进行详细的描述。It is described in S410 that the verification information may be at least one of the three listed information. Specifically, it is divided into the following three cases for detailed description.
情况一:Case 1:
当SE根据预设的校验算法对该待存储数据进行处理后生成校验序列,这是验证信息就是校验序列,则该验证信息和待存储数据已经在校验处理的过程中构成校验关系。在这种情况下,如图5所示的数据处理示意图,该验证信息和待存储的数据可以一起构成第一数据。例如,当校验算法消息认证码安全MAC算法时,该240byte的待存储数据经过该MAC算法处理生成16byte校验序列,该240byte的待存储数据和16byte的校验序列构成第一数据之后,经过第一密钥加密生成256byte的密文存储到第一存储器,将16byte的校验序列作为该第一数据的验证信息经过第二密钥的加密存储到第二存储器。关于第一密钥和第一存储器或者第二秘钥和第二存储器的各种可能性已经在前述有详细的说明,为了简便,此处不再赘述。When the SE processes the data to be stored according to a preset verification algorithm to generate a check sequence, where the verification information is a check sequence, the verification information and the data to be stored have been verified in the process of the check processing. relationship. In this case, as shown in the data processing diagram shown in FIG. 5, the verification information and the data to be stored may together constitute the first data. For example, when the algorithm algorithm authentication code secure MAC algorithm is verified, the 240 bytes of data to be stored are processed by the MAC algorithm to generate a 16-byte check sequence, and the 240-byte data to be stored and the 16-byte check sequence form the first data. The first key is encrypted to generate 256 bytes of ciphertext and stored in the first memory, and the 16-byte check sequence is stored as the verification information of the first data by the second key and stored in the second memory. Various possibilities regarding the first key and the first memory or the second key and the second memory have been described in detail above, and are not described herein again for the sake of brevity.
或者,如图6所示的数据处理示意图,经过校验算法对待存储数据进行处理后生成校验序列,将该校验序列经过第二密钥的加密处理,存储到第二存储器。此时,该校验序列是根据该待存储的数据生成的,因此该校验序列能唯一验证该待存储的数据的合法性。将该待存储数据作为第一数据,根据第一密钥进行加密,存储到第一存储器。例如,结合图3所示的存储器类型,即第一存储器按照4KB的大小划分为N个存储块,第二存储器按照32byte的大小划分为N个验证块。如图6所示的示意图,将4KB的待存储数据经过第一密钥加密处理存储到第一存储器;将32Byte的校验序列经过第二密钥的加密处理存储到第二存储器。应理解,本申请包括但不限于此。Alternatively, as shown in the data processing diagram shown in FIG. 6, after the check algorithm processes the stored data, a check sequence is generated, and the check sequence is encrypted by the second key and stored in the second memory. At this time, the check sequence is generated according to the data to be stored, so the check sequence can uniquely verify the legality of the data to be stored. The data to be stored is used as the first data, encrypted according to the first key, and stored in the first memory. For example, in conjunction with the memory type shown in FIG. 3, the first memory is divided into N memory blocks in a size of 4 KB, and the second memory is divided into N verification blocks in a size of 32 bytes. As shown in the schematic diagram of FIG. 6, 4 KB of data to be stored is stored in the first memory through the first key encryption process; and a 32-byte check sequence is stored in the second memory through the encryption process of the second key. It should be understood that the application includes but is not limited thereto.
情况二:Case 2:
该验证信息包括计数器记录的计数值Count。例如,单向计数器记录计数值,从0开 始计数,每次写入一次数据到第一存储器(或者第一存储器的Page x),对应的计数值就加1。那么,此时要保证验证信息和待存储的数据之间要构成校验关系,即计数值Count要参与到待存储数据的处理过程,否则两者没有关系,就不能构成校验关系。The verification information includes the count value Count recorded by the counter. For example, the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the count value Count is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
图7和图8示出了计数值参与到待存储数据的处理过程方法示意图。在图7中,示出了待存储数据在进行校验处理过程,例如进行消息认证码安全MAC处理,将计数值Count带入到待存储的数据明文一起进行MAC处理,而将该计数值就作为验证信息,经过第二密钥的加密处理后存储到第二存储器;待存储数据和计数值经过MAC处理后生成第一数据,从而将该第一数据经过第一密钥的加密处理后存储到第一存储器。7 and 8 are diagrams showing a process of a process in which a count value participates in data to be stored. In FIG. 7, it is shown that the data to be stored is subjected to a verification process, for example, performing message authentication code secure MAC processing, and the count value Count is brought into the data plaintext to be stored for MAC processing, and the count value is As the verification information, after the encryption process of the second key, the second data is stored in the second memory; the data to be stored and the count value are processed by the MAC to generate the first data, so that the first data is encrypted by the first key and then stored. Go to the first memory.
另一种计数值参与到待存储数据的处理过程方法如图8所示。待存储数据的消息认证码安全MAC处理过程中,并不加入计数值Count,MAC处理完成后,在进行加密时,该计数值Count可以参与到确定第一密钥的过程,SE利用该第一密钥对该第一数据进行加密。Another processing method in which the count value participates in the data to be stored is as shown in FIG. 8. The message authentication code to be stored in the secure MAC address process does not include the count value Count. After the MAC processing is completed, the count value Count can participate in the process of determining the first key when the encryption is performed, and the SE uses the first The key encrypts the first data.
具体的,当待存储数据需要存储到第一存储器中,SE根据HUK1和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器。如何派生出第一密钥属于现有技术,本实施例不做展开介绍。Specifically, when the data to be stored needs to be stored in the first memory, the SE derives the first key according to the HUK1 and the count value, and then stores the first data in the first memory after being encrypted by the first key. How to derive the first key belongs to the prior art, and this embodiment does not introduce the expansion.
或者,当待存储数据需要存储到第一存储器中的Page 2时,SE根据HUK1、该Page 2的ID地址和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器的Page 2的存储区域。Alternatively, when the data to be stored needs to be stored in Page 2 in the first memory, the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
应理解,以上两种将计数值参与到待存储数据的处理过程方法任选一种应用可以实现,两种方法一起应用也是可以实现的。只要保证采用什么样的方式参与,就采用对应的方法校验即可。应理解,本申请包括但不限于此。It should be understood that the above two processing methods for participating in the count value to the data to be stored may be implemented by an application, and the two methods may be implemented together. As long as you are sure to participate in any way, you can use the corresponding method to verify. It should be understood that the application includes but is not limited thereto.
经过上述数据写入过程的相关处理,可以实现验证信息和待存储数据之间的关联性。由于存在关联,下一步在读取数据时,将第一存储器的数据,第二存储器的对应验证信息读进内部RAM后,就可以验证数据的合法性。Through the related processing of the above data writing process, the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
情况三:Case 3:
该验证信息包括随机数Random-x-valid生成的随机序列。例如,可以是根据预设的随机函数生成的随机序列。那么,此时要保证验证信息和待存储的数据之间要构成校验关系,即随机序列要参与到待存储数据的处理过程,否则两者没有关系,就不能构成校验关系。The verification information includes a random sequence generated by a random number Random-x-valid. For example, it may be a random sequence generated according to a preset random function. Then, at this time, it is necessary to ensure that the verification relationship and the data to be stored constitute a verification relationship, that is, the random sequence is to participate in the processing of the data to be stored, otherwise the two do not matter, and the verification relationship cannot be formed.
图9和图10示出了随机序列参与到待存储数据的处理过程方法示意图。在图9中,示出了待存储数据在进行消息认证码安全MAC处理过程中,将随机序列带入到数据明文一起进行MAC处理。将该随机序列就作为验证信息,经过第二密钥的加密处理后存储到第二存储器;待存储数据和随机序列共同经过MAC处理后生成第一数据,从而将该第一数据经过第一密钥的加密处理后存储到第一存储器。9 and 10 are schematic diagrams showing a processing procedure in which a random sequence participates in data to be stored. In FIG. 9, it is shown that in the process of performing secure authentication of the message authentication code in the data to be stored, the random sequence is brought into the data plaintext for MAC processing. The random sequence is used as the verification information, and is stored in the second memory after being encrypted by the second key. The data to be stored and the random sequence are processed by the MAC to generate the first data, so that the first data is first encrypted. The key is encrypted and stored in the first memory.
另一种随机序列参与到待存储数据的处理过程方法如图10所示。待存储数据的消息认证码安全MAC处理过程中,并不加入随机序列,MAC处理完成后,在进行加密时,该随机序列可以参与到确定第一密钥的过程,SE利用该第一密钥对该第一数据进行加密。Another processing method in which a random sequence participates in data to be stored is shown in FIG. During the secure MAC processing of the message authentication code to be stored, the random sequence is not added. After the MAC processing is completed, the random sequence may participate in the process of determining the first key when the encryption is performed, and the SE uses the first key. The first data is encrypted.
具体的,当待存储数据需要存储到第一存储器中,SE根据HUK 1和随机序列派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器。Specifically, when the data to be stored needs to be stored in the first memory, the SE derives the first key according to the HUK 1 and the random sequence, and then stores the first data in the first memory after being encrypted by the first key.
或者,当待存储数据需要存储到第一存储器中的Page 2时,SE根据HUK1、该Page 2 的ID地址和随机序列派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器的Page 2的存储区域。Alternatively, when the data to be stored needs to be stored in Page 2 in the first memory, the SE derives the first key according to the ID address of the HUK1, the Page 2 and the random sequence, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
又或者,随机序列可以不经过派生,直接作为第一存储器中的Page 2中第一数据的第一密钥。Alternatively, the random sequence may be directly derived as the first key of the first data in Page 2 in the first memory without derivation.
应理解,以上三种将随机序列参与到待存储数据的处理过程方法任选一种应用可以实现,三种方法一起应用也是可以实现的。只要保证采用什么样的方式参与,就采用对应的方法校验即可。应理解,本申请包括但不限于此。It should be understood that the above three processing methods for participating in the random sequence to the data to be stored may be implemented by an application, and the three methods may be implemented together. As long as you are sure to participate in any way, you can use the corresponding method to verify. It should be understood that the application includes but is not limited thereto.
经过上述数据写入过程的相关处理,可以实现验证信息和待存储数据之间的关联性。由于存在关联,下一步在读取数据时,将第一存储器的数据,第二存储器的对应的验证信息读进内部RAM后,就可以验证数据的合法性。Through the related processing of the above data writing process, the correlation between the verification information and the data to be stored can be realized. Since there is an association, the next step is to read the data of the first memory and the corresponding verification information of the second memory into the internal RAM, and then verify the validity of the data.
以上对于数据大小的举例,例如240byte、32字节或者4KB等都是实例,实际情况都可以修改,甚至,第一存储器中的存储块Page的大小或者第二存储器中验证块的大小都可以根据存储数据的类型不同而不同。应理解,本申请包括但并不限于此。The above examples of the data size, for example, 240 bytes, 32 bytes, or 4 KB are examples, and the actual situation can be modified. Even the size of the memory block Page in the first memory or the size of the verification block in the second memory can be The type of data stored varies. It should be understood that this application includes, but is not limited to, this.
此外,前面在介绍第一存储器和第二存储器的时候,可以划分该第一存储器和第二存储器。例如该第一存储器包括N个区域,该第二存储器包括N个区域,该第一存储器的N个区域与该第二存储器的N个区域一一对应,N为正整数。Furthermore, the first memory and the second memory may be divided when introducing the first memory and the second memory. For example, the first memory includes N regions, and the second memory includes N regions, and the N regions of the first memory are in one-to-one correspondence with the N regions of the second memory, and N is a positive integer.
另外一种可能的实现情况中,该第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于该验证信息的大小,该安全元件还用于按照如下顺序执行该将该第一数据存储到第一存储器,并将该验证信息存储到第二存储器的操作:该安全元件将该验证信息存储到该第二区域中未被占用的子区域;再将该第一数据存储到该第一区域;最后删除该第二区域中已被占用的子区域中存储的历史验证信息。In another possible implementation, each of the N regions of the second memory includes at least two sub-regions, each sub-region having a size greater than or equal to a size of the verification information, and the security element is further used as follows Performing an operation of storing the first data to the first memory and storing the verification information to the second memory: the secure element stores the verification information to the unoccupied sub-area in the second area; The first data is stored in the first area; and the historical verification information stored in the occupied sub-area in the second area is deleted.
具体地,如图11所示,将第二存储器的验证块2分为两个子区域,分别是有效区和空白区,每个区域都能够存放该待存储数据的验证信息。在利用上述方法得到经过第一密钥加密的第一数据和经过第二密钥加密的验证信息之后,假如将第一数据写入第一存储器的存储块Page 2,在将该验证信息写入第二存储器的验证块2的过程中,将该验证信息写到验证块2的有效区,空白区没有任何数据。当有新数据需要存储到该存储块Page 2时,假设第二数据为新待存储数据,需要按照如下的顺序写入流程:Specifically, as shown in FIG. 11, the verification block 2 of the second memory is divided into two sub-areas, which are an effective area and a blank area, and each area can store verification information of the data to be stored. After obtaining the first data encrypted by the first key and the verification information encrypted by the second key by using the above method, if the first data is written to the storage block Page 2 of the first memory, the verification information is written In the process of verifying block 2 of the second memory, the verification information is written to the valid area of the verification block 2, and the blank area has no data. When there is new data to be stored in the storage block Page 2, assuming that the second data is new to be stored, the flow needs to be written in the following order:
(1)确定该待存储的第二数据对应的第二验证信息,过程参照上述第一数据的方法,此处不再赘述;(1) determining the second verification information corresponding to the second data to be stored, and the process refers to the method of the foregoing first data, and details are not described herein again;
(2)保留第二存储器的验证块2有效区的原第一数据对应的第一验证信息,将经过第二密钥加密后的第二验证信息写入到该验证块2的空白区;(2) retaining the first verification information corresponding to the original first data of the valid area of the verification block 2 of the second memory, and writing the second verification information encrypted by the second key to the blank area of the verification block 2;
(3)将待存储的第二数据经过安全处理后根据第一密钥加密后写入到第一存储器地存储块Page 2;(3) The second data to be stored is subjected to security processing, and then encrypted according to the first key and then written to the storage block Page 2 of the first memory;
(4)删除第二存储器的验证块2有效区的原第一数据对应的第一验证信息,则原有效区变为空白区,新写入的第二验证信息作为有效验证信息。(4) Deleting the first verification information corresponding to the original first data of the valid area of the verification block 2 of the second memory, the original valid area becomes a blank area, and the newly written second verification information is used as valid verification information.
之所以每个验证块要划分两个区域,是因为可以防止数据写入时掉电,进行掉电保护。上述数据写入时,任意环节都有可能系统掉电。有了上述写入的流程后,任何时候掉电,启动时会发现第二存储器的验证块要么1个区域有效,1个区域空白,此时取有效区域包含的字段作为验证信息。The reason why each verification block is divided into two areas is because it can prevent power loss when data is written, and power-down protection is performed. When the above data is written, the system may be powered down at any point. After the above-mentioned writing process, if the power is turned off at any time, it will be found that the verification block of the second memory is valid for one area and one area is blank. At this time, the field included in the valid area is taken as the verification information.
或者,2个区域都有验证信息,则再读取第一存储器的page 2的存储的数据,将两个区域的验证信息都去尝试验证下。Alternatively, if both areas have verification information, the stored data of page 2 of the first memory is read again, and the verification information of both areas is tried to be verified.
又或者,有一个区域的验证信息是正确的,则擦除另一个不正确的验证信息。如果两个验证信息都不正确,则认为是收到安全攻击,存储无效,进行报错。Or, if the verification information of one area is correct, another incorrect verification information is erased. If the two verification information are not correct, it is considered to be a security attack, the storage is invalid, and an error is reported.
通过以上的执行流程,能够对数据进行掉电保护,任何一个环节掉电,并不会影响验证信息和存储数据的对应性,能够时刻保持数据的安全性,提高用户体验。Through the above execution process, the data can be protected from power failure, and any link is powered down, which does not affect the correspondence between the verification information and the stored data, and can maintain the security of the data and improve the user experience.
应理解,当验证信息可以是该待存储数据经过消息认证码MAC处理生成的校验序列;或者由计数器记录的计数值;或由随机数生成的随机序列。当验证信息是计数器记录的计数值时,不需要按照上述划分第二存储器的存储块为两个区域的方法和数据写入流程执行,因为计数器的计数值每写入一次,就会加1。因此,当第二数据写入时,只要在第一验证信息的基础上加1就可以,并不需要再重新确定第二验证信息,就能够保证验证信息的正确性。即,如果第二存储器的不同存储块的验证信息之间有相互关系,就可以简化数据写入的流程,也能够实现正确的根据验证信息判断数据的合法性。本申请包括但并不限于此。It should be understood that the verification information may be a check sequence generated by the message authentication code MAC processing of the data to be stored; or a count value recorded by a counter; or a random sequence generated by a random number. When the verification information is the count value recorded by the counter, it is not necessary to perform the method of dividing the memory block of the second memory into two areas and the data writing flow as described above, because the counter value of the counter is incremented by one every time it is written. Therefore, when the second data is written, it is sufficient to add 1 to the first verification information, and it is not necessary to re-determine the second verification information, so that the correctness of the verification information can be ensured. That is, if there is a correlation between the verification information of different memory blocks of the second memory, the flow of data writing can be simplified, and the validity of the data can be determined based on the verification information. This application includes but is not limited to this.
通过上述本申请提供的数据写入的方法,一方面,相对于当前的已有采用Secure Flash的inSE方案,能够降低成本,又能充分利用第一存储器的大容量空间来支持更多的应用。另一方面,相对不用Secure Flash的inSE方案,本申请安全写入数据的次数没有限制,可以满足所有安全业务场景需求。通过本方案,使inSE这种芯片架构能够满足CC EAL5+认证需求,且不受存储容量、写入次数等限制,降低成本,提高了安全等级和用户体验。The data writing method provided by the above application, on the one hand, can reduce the cost and fully utilize the large capacity space of the first memory to support more applications, compared to the current inSE solution using Secure Flash. On the other hand, the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met. Through this solution, the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
以上完成了数据写入的过程,接下来结合图12详细描述数据读取的过程。图12是本申请实施例提供的又一例处理数据的方法示意图。该方法1200示出了数据读取的具体过程,应用于上述的架构200,包括安全元件SE和中央处理器的系统芯片,该安全元件SE和该中央处理器相耦合,该中央处理器用于控制该安全元件SE,包括控制其打开、关闭、控制功耗或工作状态等。该方法1200包括以下内容。The above process of data writing is completed, and the process of data reading will be described in detail below with reference to FIG. FIG. 12 is a schematic diagram of another method for processing data according to an embodiment of the present application. The method 1200 illustrates a specific process of data reading applied to the architecture 200 described above, including a secure element SE and a system chip of a central processor coupled to the central processor for controlling The secure element SE includes controlling its opening, closing, controlling power consumption or working state, and the like. The method 1200 includes the following.
S1210,安全元件SE从第一存储器获取第一数据。S1210. The secure element SE acquires the first data from the first memory.
S1220,安全元件SE从第二存储器获取验证信息,该验证信息用于验证该第一数据的合法性,该第一存储器和该第二存储器是该系统芯片之外的不同存储器。S1220. The secure element SE obtains verification information from the second memory, where the verification information is used to verify the validity of the first data, and the first memory and the second memory are different memories outside the system chip.
S1230,安全元件SE根据该验证信息对该第一数据进行解安全处理得到处理后的数据。S1230. The secure element SE performs de-secured processing on the first data according to the verification information to obtain processed data.
在本申请实施例提供的方法中,第一存储器用于存储数据和程序,第二存储器用于存储该第一存储器的数据和程序的验证信息。那么在数据读取的过程中,安全元件SE首先要从第二存储器获取经过第二密钥加密的该第一数据对应的验证信息,从第一存储器获取经过第一密钥加密的第一数据。此后,安全元件要对该加密的第一数据进行解安全处理以获取该第一数据。同理,安全元件要对该加密的验证信息进行解安全处理后得到验证信息。最后,根据该验证信息判断该第一数据的合法性。In the method provided by the embodiment of the present application, the first memory is used to store data and a program, and the second memory is used to store data of the first memory and verification information of the program. Then, in the process of data reading, the secure element SE first obtains the verification information corresponding to the first data encrypted by the second key from the second memory, and acquires the first data encrypted by the first key from the first memory. . Thereafter, the secure element performs de-secure processing on the encrypted first data to obtain the first data. Similarly, the secure component needs to perform security processing on the encrypted verification information to obtain verification information. Finally, the validity of the first data is determined according to the verification information.
其中,该验证信息包括以下信息中的至少一种信息:对该待存储数据进行消息认证码MAC处理生成的校验序列;由计数器记录的计数值;或由随机数生成的随机序列。The verification information includes at least one of the following information: a check sequence generated by the message authentication code MAC processing on the to-be-stored data; a count value recorded by the counter; or a random sequence generated by the random number.
具体地,验证信息可以是SE根据预设的校验算法对所述待存储数据进行处理后生成校验序列,校验算法可以是安全Hash算法如散列算法SHA-256或者消息认证码安全算法 (Message Authentication Code,MAC)(例如高级加密标准AES-CMAC算法)等。这种情况下,可以该验证信息就包括该生成的校验序列。Specifically, the verification information may be that the SE processes the to-be-stored data according to a preset verification algorithm to generate a check sequence, and the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm. (Message Authentication Code, MAC) (such as the advanced encryption standard AES-CMAC algorithm). In this case, the verification information can include the generated verification sequence.
另一种可能的情况,该验证信息包括计数器记录的计数值。例如,单向计数器记录计数值,从0开始计数,每次写入一次数据到第一存储器(或者第一存储器的Page x),对应的计数值就加1。In another possible case, the verification information includes a count value recorded by the counter. For example, the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one.
又一种可能的情况,该验证信息包括随机数Random-x-valid生成的随机序列。例如,可以是根据预设的随机函数生成的随机序列。In another possible case, the verification information includes a random sequence generated by a random number Random-x-valid. For example, it may be a random sequence generated according to a preset random function.
可选地,安全元件SE根据该验证信息对该第一数据进行解安全处理包括以下处理中的至少一种:利用该验证信息对该第一数据进行解MAC处理;或根据该验证信息确定第一密钥,利用该第一密钥对该第一数据进行解密。Optionally, the security element SE performs de-secure processing on the first data according to the verification information, including at least one of: performing MAC processing on the first data by using the verification information; or determining, according to the verification information, a key that decrypts the first data using the first key.
在解安全处理过程中,首先安全元件SE需要获取第一密钥。可选地,对应于数据写入的过程中的加密,安全元件SE可以在写入过程,将待存储数据进行加密的第一密钥存储在SE内部,在读取该数据的过程中,可以直接提取存储的该第一密钥进行解密。In the solution security process, first the secure element SE needs to acquire the first key. Optionally, corresponding to the encryption in the process of data writing, the secure element SE may store the first key for encrypting the data to be stored in the SE during the writing process, and in the process of reading the data, The stored first key is directly extracted for decryption.
或者,安全元件SE先根据第二密钥对获取的验证信息进行解密。例如,根据HUK2对获取的验证信息进行解密得到该验证信息。Alternatively, the secure element SE first decrypts the verification information acquired according to the second key pair. For example, the obtained verification information is obtained by decrypting the acquired verification information according to HUK2.
获得了该验证信息,就可以利用该验证信息对该第一数据进行解MAC处理。具体地,分为以下三种情况进行详细的描述,应理解,SE可以根据写入数据时的对应处理过程选择读取数据时相应的处理过程。After the verification information is obtained, the first data can be de-MAC processed by using the verification information. Specifically, it is divided into the following three cases for detailed description. It should be understood that the SE can select a corresponding processing procedure when reading data according to a corresponding processing procedure when writing data.
情况一:Case 1:
当验证信息是SE根据预设的校验算法对待存储数据进行处理后生成校验序列时,相应地,SE选择对应的安全处理过程进行解安全处理。When the verification information is that the SE processes the data to be stored according to the preset verification algorithm, the SE selects a corresponding security process to perform security processing.
可选地,校验算法可以是安全Hash算法如散列算法SHA-256或者消息认证码安全算法MAC等。SE根据该校验算法的逆过程来得到处理后的数据。Optionally, the verification algorithm may be a secure hash algorithm such as a hash algorithm SHA-256 or a message authentication code security algorithm MAC. The SE obtains the processed data according to the inverse process of the verification algorithm.
前述列举了校验处理过程的可能情况,当校验处理是如图5所示的处理过程,即待存储数据和校验序列包括在第一数据中,第一数据经过第一密钥加密后存储到第一存储器;该校验序列经过第二密钥加密后存储到第二存储器。在这种情况下,在解安全处理过程中,SE解密获取第一存储器中存储的数据,并获取该存储的数据中的第一校验序列,同时根据第二密钥对第二存储器中相应的验证信息进行解密处理,获取第二校验序列。通过第一校验序列和第二校验序列来验证数据的合法性。当第一校验序列和第二校验序列相同,则判定为数据是合法的。应理解,本申请包括但并不限于此。The foregoing enumerates the possible cases of the verification process. When the verification process is the process shown in FIG. 5, that is, the data to be stored and the check sequence are included in the first data, the first data is encrypted by the first key. Stored in the first memory; the check sequence is encrypted by the second key and stored in the second memory. In this case, during the decryption security process, the SE decrypts the data stored in the first memory, and acquires the first check sequence in the stored data, and simultaneously corresponds to the second memory according to the second key pair. The verification information is decrypted to obtain a second verification sequence. The validity of the data is verified by the first check sequence and the second check sequence. When the first check sequence and the second check sequence are the same, it is determined that the data is legal. It should be understood that this application includes, but is not limited to, this.
相应地,当校验处理是如图6所示的处理过程,即待存储数据经过第一密钥加密后存储到第一存储器;该校验序列经过第二密钥加密后存储到第二存储器。在这种情况下,在解安全处理过程中,SE解密获取该存储的数据,并根据校验算法得到该存储的数据中的第一校验序列,同时根据第二密钥对第二存储器中相应的验证信息进行解密处理,获取第二校验序列。通过第一校验序列和第二校验序列来验证数据的合法性。当第一校验序列和第二校验序列相同,则判定为数据是合法的。应理解,本申请包括但并不限于此。情况二:Correspondingly, when the verification process is a process as shown in FIG. 6, the data to be stored is stored in the first memory after being encrypted by the first key; the check sequence is encrypted by the second key and stored in the second memory. . In this case, in the solution security process, the SE decrypts the stored data, and obtains the first check sequence in the stored data according to the check algorithm, and simultaneously pairs the second memory according to the second key. The corresponding verification information is decrypted to obtain a second check sequence. The validity of the data is verified by the first check sequence and the second check sequence. When the first check sequence and the second check sequence are the same, it is determined that the data is legal. It should be understood that this application includes, but is not limited to, this. Case 2:
当该验证信息包括计数器记录的计数值Count。例如,单向计数器记录计数值,从0开始计数,每次写入一次数据到第一存储器(或者第一存储器的Page x),对应的计数值就加1。SE根据计数值参与到待存储数据的处理过程,选择相应的解安全处理方法。When the verification information includes the count value Count recorded by the counter. For example, the one-way counter records the count value, counting from 0, and writing data to the first memory (or Page x of the first memory) each time, and the corresponding count value is incremented by one. The SE participates in the processing of the data to be stored according to the count value, and selects a corresponding solution security processing method.
可选地,如果在进行MAC处理之前,SE将计数值Count带入到数据明文一起,再参与MAC处理,相应地,在解安全处理的过程中,就可以先通过MAC处理的逆过程,再获取数据中的计数值Count。再将该第一存储器中获取的计数值Count和第二存储器中获取的验证信息计数值Count进行对比,如果两个值保持一致,就判断该获取的数据是合法数据;如果两个值不一致,就判断该获取的数据不合法,判定为受到安全攻击,获取无效,报错。Optionally, if the SE sends the count value Count to the data plaintext before the MAC processing, and then participates in the MAC processing, correspondingly, in the process of the security processing, the reverse process of the MAC processing may be performed first. Get the count value Count in the data. And comparing the count value Count obtained in the first memory with the verification information count value Count obtained in the second memory. If the two values are consistent, it is determined that the acquired data is legal data; if the two values are inconsistent, If it is judged that the acquired data is illegal, it is determined that it is subjected to a security attack, the acquisition is invalid, and an error is reported.
可选地,如果在MAC处理过程中,并不加入计数值Count,MAC处理完成后,在进行加密时,该计数值Count可以参与到确定第一密钥的过程,SE利用该第一密钥对该第一数据进行加密。此时,SE根据HUK1和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器。或者,当待存储数据需要存储到第一存储器中的Page 2时,SE根据HUK1、该Page 2的ID地址和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器的Page 2的存储区域。Optionally, if the count value Count is not added during the MAC processing, after the MAC processing is completed, when the encryption is performed, the count value Count may participate in the process of determining the first key, and the SE uses the first key. The first data is encrypted. At this time, the SE derives the first key according to the HUK1 and the count value, and then stores the first data through the encryption process of the first key and stores it in the first memory. Alternatively, when the data to be stored needs to be stored in Page 2 in the first memory, the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then passes the first data through the first key. After the encryption process, it is stored in the storage area of Page 2 of the first memory.
相应地,在解安全处理的过程中,SE就根据该第一密钥对获取的数据进行解密,获取计数值Count,再将该第一存储器中获取的计数值Count和第二存储器中获取的验证信息计数值Count进行对比。如果两个值保持一致,就判断该获取的数据是合法数据;如果两个值不一致,就判断该获取的数据不合法,判定为受到安全攻击,获取无效,报错。Correspondingly, in the process of the security processing, the SE decrypts the data acquired according to the first key pair, obtains the count value Count, and then obtains the count value Count obtained in the first memory and the second memory. Verify the information count value Count for comparison. If the two values are consistent, it is judged that the acquired data is legal data; if the two values are inconsistent, it is judged that the acquired data is illegal, and it is determined that the security is attacked, the acquisition is invalid, and an error is reported.
应理解,以上两种解安全处理过程方法任选一种应用可以实现,两种方法一起应用也是可以实现的。只要保证在写入数据的过程采用什么样的方式进行安全处理,在读取数据的过程就采用对应的方法来进行解安全处理即可。应理解,本申请包括但不限于此。It should be understood that the above two solutions for the secure processing process may be implemented by an application, and the two methods may be implemented together. As long as the method of writing data is guaranteed to be safely processed, the corresponding method is used to perform the security processing in the process of reading the data. It should be understood that the application includes but is not limited thereto.
情况三:Case 3:
当验证信息包括随机数Random-x-valid生成的随机序列。例如,可以是根据预设的随机函数生成的随机序列。When the verification information includes a random sequence generated by a random number Random-x-valid. For example, it may be a random sequence generated according to a preset random function.
可选地,如果在进行MAC处理之前,SE将随机序列带入到数据明文一起,再参与MAC处理,相应地,在解安全处理的过程中,就可以先通过MAC处理的逆过程,再获取数据中的随机序列。再将该第一存储器中获取的随机序列和第二存储器中获取的验证信息随机序列进行对比,如果两个值保持一致,就判断该获取的数据是合法数据;如果两个值不一致,就判断该获取的数据不合法,判定为受到安全攻击,获取无效,报错。Optionally, if the SE sends the random sequence to the data plaintext before performing the MAC processing, and then participates in the MAC processing, correspondingly, in the process of the security processing, the reverse processing of the MAC processing may be performed first. A random sequence in the data. And comparing the random sequence obtained in the first memory with the random sequence of the verification information acquired in the second memory, if the two values are consistent, determining that the acquired data is legal data; if the two values are inconsistent, determining The acquired data is illegal, and it is determined that it is subjected to a security attack, the acquisition is invalid, and an error is reported.
可选地,如果在MAC处理过程中,并不加入随机序列,MAC处理完成后,在进行加密时,该随机序列可以参与到确定第一密钥的过程,SE利用该第一密钥对该第一数据进行加密。此时,SE根据HUK1和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器。或者,当待存储数据需要存储到第一存储器中的Page2时,SE根据HUK1、该Page 2的ID地址和计数值派生出第一密钥,再将该第一数据经过第一密钥的加密处理后存储到第一存储器的Page 2的存储区域。Optionally, if the random sequence is not added in the MAC processing process, after the MAC processing is completed, when the encryption is performed, the random sequence may participate in the process of determining the first key, and the SE uses the first key to The first data is encrypted. At this time, the SE derives the first key according to the HUK1 and the count value, and then stores the first data through the encryption process of the first key and stores it in the first memory. Alternatively, when the data to be stored needs to be stored in Page 2 in the first memory, the SE derives the first key according to the ID address and the count value of the HUK1, the Page 2, and then encrypts the first data by the first key. After processing, it is stored in the storage area of Page 2 of the first memory.
相应地,在解安全处理的过程中,SE就根据该第一密钥对获取的数据进行解密,获取随机序列,再将该第一存储器中获取的随机序列和第二存储器中获取的验证信息随机序列进行对比。如果两个值保持一致,就判断该获取的数据是合法数据;如果两个值不一致,就判断该获取的数据不合法,判定为受到安全攻击,获取无效,报错。Correspondingly, in the process of performing the security process, the SE decrypts the data acquired according to the first key, acquires a random sequence, and then obtains the random sequence acquired in the first memory and the verification information acquired in the second memory. Random sequences were compared. If the two values are consistent, it is judged that the acquired data is legal data; if the two values are inconsistent, it is judged that the acquired data is illegal, and it is determined that the security is attacked, the acquisition is invalid, and an error is reported.
又或者,随机序列可以不经过派生,直接作为第一存储器中的Page 2中第一数据的第一密钥。则相应地,SE可以利用该随机序列作为第一密钥对获取的数据进行解密。Alternatively, the random sequence may be directly derived as the first key of the first data in Page 2 in the first memory without derivation. Correspondingly, the SE can use the random sequence as the first key to decrypt the acquired data.
应理解,以上三种解安全处理过程方法任选一种应用可以实现,三种方法一起应用也是可以实现的。只要保证在写入数据的过程采用什么样的方式进行安全处理,在读取数据的过程就采用对应的方法来进行解安全处理即可。应理解,本申请包括但不限于此。It should be understood that the above three solutions for the secure processing process may be implemented by one application, and the three methods may be implemented together. As long as the method of writing data is guaranteed to be safely processed, the corresponding method is used to perform the security processing in the process of reading the data. It should be understood that the application includes but is not limited thereto.
作为一种可能的情况,该第一存储器包括N个区域,该第二存储器包括N个区域,该第一存储器的N个区域与该第二存储器的N个区域一一对应,N为正整数。SE可以从该第一存储器的N个区域中的第一区域获取该第一数据;以及SE从该第二存储器的N个区域中的第二区域获取验证信息,其中,该第一区域与该第二区域对应。As a possible case, the first memory includes N regions, the second memory includes N regions, and the N regions of the first memory are in one-to-one correspondence with the N regions of the second memory, where N is a positive integer . The SE may acquire the first data from a first one of the N regions of the first memory; and the SE acquires verification information from a second region of the N regions of the second memory, wherein the first region and the first region The second area corresponds.
可选地,该第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于该验证信息的大小,则SE可以将该第二区域的第一子区域中存储的信息作为该验证信息,并对该第一数据进行解安全处理;以及进一步将该第二区域的第二子区域中存储的信息作为该验证信息,并对该第一数据进行解安全处理。两个子区域中的任一个验证信息解安全处理通过均可以验证通过。Optionally, each of the N regions of the second memory includes at least two sub-regions, and the size of each sub-region is greater than or equal to the size of the verification information, and the SE may be the first sub-region of the second region. The stored information is used as the verification information, and the first data is de-secured; and the information stored in the second sub-area of the second area is further used as the verification information, and the first data is de-secured. deal with. Any one of the two sub-areas can be verified by the verification information.
具体地,如图11所示,将第二存储器的验证块2分为两个子区域,分别是有效区和空白区,每个区域都能够存放该待存储数据的验证信息。对应于数据写入的过程,每一个过程都有断电的可能性,所以该第二存储器的验证块2的两个子区域可能有以下三种情况:Specifically, as shown in FIG. 11, the verification block 2 of the second memory is divided into two sub-areas, which are an effective area and a blank area, and each area can store verification information of the data to be stored. Corresponding to the process of data writing, each process has the possibility of power failure, so the two sub-areas of the verification block 2 of the second memory may have the following three cases:
(1)有效区有验证信息,空白区没有验证信息;(1) The valid area has verification information, and the blank area has no verification information;
(2)有效区和空白区都有验证信息,且验证信息不同;(2) Both the valid area and the blank area have verification information, and the verification information is different;
(3)有效区没有验证信息,空白区有验证信息;(3) There is no verification information in the effective area, and there is verification information in the blank area;
不论是上述哪一种可能的情况,可以都获取该验证信息,只要有一个验证信息经过验证获取的数据是合法的,就将该数据判断为合法数据;如果两个验证信息都不正确,则认为是收到安全攻击,存储无效,进行报错。In any of the above possible situations, the verification information may be obtained, and as long as the verification data obtained by the verification information is legal, the data is determined as legal data; if the two verification information are not correct, then It is considered that a security attack is received, the storage is invalid, and an error is reported.
之所以每个验证块要划分两个区域,是因为可以防止数据写入时掉电,进行掉电保护。具体的过程已经在写入数据时进行了详细的说明,为了简便,此处不再赘述。The reason why each verification block is divided into two areas is because it can prevent power loss when data is written, and power-down protection is performed. The specific process has been described in detail when writing data. For the sake of brevity, it will not be described here.
上文结合图2至图11分别从写入数据和读取数据两个方面具体描述了本申请实施例提供的方法。通过上述本申请提供的数据写入和读取数据的方法,一方面,相对于当前的已有采用Secure Flash的inSE方案,能够降低成本,又能充分利用第一存储器的大容量空间来支持更多的应用。另一方面,相对不用Secure Flash的inSE方案,本申请安全写入数据的次数没有限制,可以满足所有安全业务场景需求。通过本方案,使inSE这种芯片架构能够满足CC EAL5+认证需求,且不受存储容量、写入次数等限制,降低成本,提高了安全等级和用户体验。The method provided by the embodiment of the present application is specifically described in terms of two aspects of writing data and reading data, respectively, in conjunction with FIG. 2 to FIG. The method for writing and reading data by the data provided by the above application, on the one hand, can reduce the cost and fully utilize the large capacity of the first memory to support more than the current inSE solution using Secure Flash. More applications. On the other hand, the number of times the data is safely written in this application is not limited, and the requirements for all security service scenarios can be met. Through this solution, the inSE chip architecture can meet the requirements of CC EAL5+ certification, and is not limited by the storage capacity and the number of writes, thereby reducing the cost and improving the security level and user experience.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
以上实施例中所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使 用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备或计算处理器,如之前所述安全元件执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions described in the above embodiments may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device or computing processor, such as the security element previously described, to perform all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The foregoing is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application. It should be covered by the scope of protection of this application. Therefore, the scope of protection of the present application should be determined by the scope of the claims.

Claims (34)

  1. 一种系统芯片,其特征在于,所述系统芯片包括安全元件和中央处理器,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件用于:A system chip, characterized in that the system chip comprises a security element and a central processor, the security element being coupled to the central processor, the central processor for controlling the security element, the security element Used for:
    确定验证信息,所述验证信息用于验证待存储数据的合法性;Determining verification information, the verification information being used to verify the legality of the data to be stored;
    根据所述验证信息对所述待存储数据进行安全处理得到第一数据;Performing security processing on the to-be-stored data according to the verification information to obtain first data;
    将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,其中,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器。The first data is stored to a first memory and the verification information is stored to a second memory, wherein the first memory and the second memory are different memories than the system chip.
  2. 根据权利要求1所述的系统芯片,其特征在于,所述验证信息包括以下信息中的至少一种信息:The system chip according to claim 1, wherein the verification information comprises at least one of the following information:
    对所述待存储数据进行校验处理生成的校验序列;a check sequence generated by performing verification processing on the data to be stored;
    由计数器记录的计数值;或The count value recorded by the counter; or
    由随机数生成的随机序列。A random sequence generated by a random number.
  3. 根据权利要求1或2所述的系统芯片,其特征在于,所述根据所述验证信息对所述待存储数据进行安全处理包括以下处理中的至少一种:The system chip according to claim 1 or 2, wherein the performing security processing on the to-be-stored data according to the verification information comprises at least one of the following processes:
    利用所述验证信息对所述待存储数据进行校验处理;或Performing verification processing on the to-be-stored data by using the verification information; or
    根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行加密。Determining a first key according to the verification information, and encrypting the first data by using the first key.
  4. 根据权利要求3所述的系统芯片,其特征在于,所述安全元件还用于:The system chip of claim 3, wherein the secure element is further configured to:
    在将所述验证信息存储到第二存储器之前,根据第二密钥对所述验证信息进行加密,所述第二密钥不同于所述第一密钥。The verification information is encrypted according to a second key different from the first key before storing the verification information to the second memory.
  5. 根据权利要求4所述的系统芯片,其特征在于,所述根据所述验证信息确定第一密钥包括:The system chip according to claim 4, wherein the determining the first key according to the verification information comprises:
    根据所述验证信息和第一预设序列,确定所述第一密钥;以及Determining the first key according to the verification information and the first preset sequence;
    所述安全元件还用于:The security element is also used to:
    根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。Determining, according to the second preset sequence, the second key, where the second preset sequence is different from the first preset sequence.
  6. 根据权利要求1至5中任一项所述的系统芯片,其特征在于,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及The system chip according to any one of claims 1 to 5, wherein the first memory comprises N areas, the second memory comprises N areas, and N areas of the first memory are N regions of the second memory are in one-to-one correspondence, N is a positive integer, and
    所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,包括:The storing the first data to the first memory and storing the verification information to the second memory includes:
    将所述第一数据存储到所述第一存储器的N个区域中的第一区域,并将所述验证信息存储到所述第二存储器的N个区域中的第二区域,其中,所述第一区域与所述第二区域对应。Storing the first data to a first one of the N regions of the first memory and storing the verification information to a second region of the N regions of the second memory, wherein The first area corresponds to the second area.
  7. 根据权利要求6所述的系统芯片,其特征在于,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述安全元件还用于按照如下顺序执行所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器的操作:The system chip according to claim 6, wherein each of the N regions of the second memory comprises at least two sub-regions, each sub-region having a size greater than or equal to a size of the verification information, The security element is further configured to perform the operations of storing the first data to the first memory and storing the verification information to the second memory in the following order:
    将所述验证信息存储到所述第二区域中未被占用的子区域;Storing the verification information to an unoccupied sub-area in the second area;
    将所述第一数据存储到所述第一区域;Storing the first data to the first area;
    删除所述第二区域中已被占用的子区域中存储的历史验证信息。The history verification information stored in the occupied sub-area in the second area is deleted.
  8. 根据权利要求1至7中任一项所述的系统芯片,其特征在于,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件的专用存储器。The system chip according to any one of claims 1 to 7, wherein the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Dedicated memory.
  9. 一种系统芯片,其特征在于,所述系统芯片包括安全元件和中央处理器,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件用于:A system chip, characterized in that the system chip comprises a security element and a central processor, the security element being coupled to the central processor, the central processor for controlling the security element, the security element Used for:
    从第一存储器获取第一数据;Acquiring first data from the first memory;
    从第二存储空间获取验证信息,所述验证信息用于验证所述第一数据的合法性,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器;Acquiring verification information for verifying validity of the first data from a second storage space, the first memory and the second memory being different memories outside the system chip;
    根据所述验证信息对所述第一数据进行解安全处理得到处理后的数据。Performing de-secured processing on the first data according to the verification information to obtain processed data.
  10. 根据权利要求9所述的系统芯片,其特征在于,所述验证信息包括以下信息中的至少一种信息:The system chip according to claim 9, wherein the verification information comprises at least one of the following information:
    对所述待存储数据进行校验处理生成的校验序列;a check sequence generated by performing verification processing on the data to be stored;
    由计数器记录的计数值;或The count value recorded by the counter; or
    由随机数生成的随机序列。A random sequence generated by a random number.
  11. 根据权利要求9或10所述的系统芯片,其特征在于,所述根据所述验证信息对所述第一数据进行解安全处理包括以下处理中的至少一种:The system chip according to claim 9 or 10, wherein the de-securing the first data according to the verification information comprises at least one of the following:
    利用所述验证信息对所述第一数据进行解校验处理;或Demyuncing the first data by using the verification information; or
    根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行解密。Determining a first key according to the verification information, and decrypting the first data by using the first key.
  12. 根据权利要求11所述的系统芯片,其特征在于,所述安全元件用于在从第二存储器获取验证信息之前,根据第二密钥对所述验证信息进行解密,所述第二密钥不同于所述第一密钥。The system chip according to claim 11, wherein the secure element is configured to decrypt the verification information according to a second key before acquiring the verification information from the second memory, the second key being different The first key.
  13. 根据权利要求12所述的系统芯片,其特征在于,所述根据所述验证信息确定第一密钥,包括:The system chip according to claim 12, wherein the determining the first key according to the verification information comprises:
    根据所述验证信息和第一预设序列,确定所述第一密钥;以及Determining the first key according to the verification information and the first preset sequence;
    所述安全元件还用于:The security element is also used to:
    根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。Determining, according to the second preset sequence, the second key, where the second preset sequence is different from the first preset sequence.
  14. 根据权利要求9至13中任一项所述的系统芯片,其特征在于,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及The system chip according to any one of claims 9 to 13, wherein the first memory comprises N areas, the second memory comprises N areas, and N areas of the first memory N regions of the second memory are in one-to-one correspondence, N is a positive integer, and
    所述从第一存储器获取第一数据,包括:The acquiring the first data from the first memory includes:
    从所述第一存储器的N个区域中的第一区域获取所述第一数据;以及Acquiring the first data from a first one of the N regions of the first memory;
    所述从第二存储器获取验证信息,包括:The obtaining the verification information from the second memory includes:
    从所述第二存储器的N个区域中的第二区域获取验证信息,其中,所述第一区域与所述第二区域对应。Acquiring information is acquired from a second one of the N regions of the second memory, wherein the first region corresponds to the second region.
  15. 根据权利要求14所述的系统芯片,其特征在于,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所 述根据所述验证信息对所述第一数据进行解安全处理,包括:The system chip according to claim 14, wherein each of the N regions of the second memory comprises at least two sub-regions, each sub-region having a size greater than or equal to a size of the verification information, De-securing the first data according to the verification information, including:
    将所述第二区域的第一子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理;And using the information stored in the first sub-area of the second area as the verification information, and performing de-secure processing on the first data;
    将所述第二区域的第二子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理。The information stored in the second sub-area of the second area is used as the verification information, and the first data is de-secured.
  16. 根据权利要求9至15中任一项所述的系统芯片,其特征在于,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件对应的专用存储器。The system chip according to any one of claims 9 to 15, wherein the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Corresponding dedicated memory.
  17. 一种处理数据的方法,其特征在于,应用于包括安全元件和中央处理器的系统芯片,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件执行所述方法,所述方法包括:A method of processing data, characterized by being applied to a system chip including a secure element and a central processor, the secure element being coupled to the central processor, the central processor for controlling the secure element, The security element performs the method, the method comprising:
    确定验证信息,所述验证信息用于验证待存储数据的合法性;Determining verification information, the verification information being used to verify the legality of the data to be stored;
    根据所述验证信息对所述待存储数据进行安全处理得到第一数据;Performing security processing on the to-be-stored data according to the verification information to obtain first data;
    将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,其中,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器。The first data is stored to a first memory and the verification information is stored to a second memory, wherein the first memory and the second memory are different memories than the system chip.
  18. 根据权利要求17所述的方法,其特征在于,所述验证信息包括以下信息中的至少一种信息:The method of claim 17, wherein the verification information comprises at least one of the following information:
    对所述待存储数据进行校验处理生成的校验序列;a check sequence generated by performing verification processing on the data to be stored;
    由计数器记录的计数值;或The count value recorded by the counter; or
    由随机数生成的随机序列。A random sequence generated by a random number.
  19. 根据权利要求17或18所述的方法,其特征在于,所述根据所述验证信息对所述待存储数据进行安全处理包括以下处理中的至少一种:The method according to claim 17 or 18, wherein the performing security processing on the to-be-stored data according to the verification information comprises at least one of the following processes:
    利用所述验证信息对所述待存储数据进行校验处理;或Performing verification processing on the to-be-stored data by using the verification information; or
    根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行加密。Determining a first key according to the verification information, and encrypting the first data by using the first key.
  20. 根据权利要求19所述的方法,其特征在于,所述方法还包括:The method of claim 19, wherein the method further comprises:
    在将所述验证信息存储到第二存储器之前,根据第二密钥对所述验证信息进行加密,所述第二密钥不同于所述第一密钥。The verification information is encrypted according to a second key different from the first key before storing the verification information to the second memory.
  21. 根据权利要求20所述的方法,其特征在于,所述根据所述验证信息确定第一密钥包括:The method according to claim 20, wherein the determining the first key according to the verification information comprises:
    根据所述验证信息和第一预设序列,确定所述第一密钥;以及Determining the first key according to the verification information and the first preset sequence;
    所述方法还包括:The method further includes:
    根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。Determining, according to the second preset sequence, the second key, where the second preset sequence is different from the first preset sequence.
  22. 根据权利要求17至21中任一项所述的方法,其特征在于,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及The method according to any one of claims 17 to 21, wherein the first memory comprises N regions, the second memory comprises N regions, and N regions of the first memory One-to-one correspondence of N regions of the second memory, N being a positive integer, and
    所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器,包括:The storing the first data to the first memory and storing the verification information to the second memory includes:
    将所述第一数据存储到所述第一存储器的N个区域中的第一区域,并将所述验证信息存储到所述第二存储器的N个区域中的第二区域,其中,所述第一区域与所述第二区域对应。Storing the first data to a first one of the N regions of the first memory and storing the verification information to a second region of the N regions of the second memory, wherein The first area corresponds to the second area.
  23. 根据权利要求22所述的方法,其特征在于,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述方法还包括按照如下顺序执行所述将所述第一数据存储到第一存储器,并将所述验证信息存储到第二存储器的操作:The method according to claim 22, wherein each of the N regions of the second memory comprises at least two sub-regions, each sub-region having a size greater than or equal to a size of the verification information, The method also includes performing the operations of storing the first data to the first memory and storing the verification information to the second memory in the following order:
    将所述验证信息存储到所述第二区域中未被占用的子区域;Storing the verification information to an unoccupied sub-area in the second area;
    将所述第一数据存储到所述第一区域;Storing the first data to the first area;
    删除所述第二区域中已被占用的子区域中存储的历史验证信息。The history verification information stored in the occupied sub-area in the second area is deleted.
  24. 根据权利要求17至23中任一项所述的方法,其特征在于,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件的专用存储器。The method according to any one of claims 17 to 23, wherein the first memory is a shared memory of the secure element and the central processor, and the second memory is the secure element Dedicated memory.
  25. 一种处理数据的方法,其特征在于,应用于包括安全元件和中央处理器的系统芯片,所述安全元件和所述中央处理器相耦合,所述中央处理器用于控制所述安全元件,所述安全元件执行所述方法,所述方法包括:A method of processing data, characterized by being applied to a system chip including a secure element and a central processor, the secure element being coupled to the central processor, the central processor for controlling the secure element, The security element performs the method, the method comprising:
    从第一存储器获取第一数据;Acquiring first data from the first memory;
    从第二存储器获取验证信息,所述验证信息用于验证所述第一数据的合法性,所述第一存储器和所述第二存储器是所述系统芯片之外的不同存储器;Acquiring verification information for verifying validity of the first data from a second memory, the first memory and the second memory being different memories outside the system chip;
    根据所述验证信息对所述第一数据进行解安全处理得到处理后的数据。Performing de-secured processing on the first data according to the verification information to obtain processed data.
  26. 根据权利要求25所述的方法,其特征在于,所述验证信息包括以下信息中的至少一种信息:The method of claim 25, wherein the verification information comprises at least one of the following information:
    对所述待存储数据进行校验处理生成的校验序列;a check sequence generated by performing verification processing on the data to be stored;
    由计数器记录的计数值;或The count value recorded by the counter; or
    由随机数生成的随机序列。A random sequence generated by a random number.
  27. 根据权利要求25或26所述的方法,其特征在于,所述根据所述验证信息对所述第一数据进行解安全处理包括以下处理中的至少一种:The method according to claim 25 or 26, wherein the de-securing the first data according to the verification information comprises at least one of the following:
    利用所述验证信息对所述第一数据进行解校验处理;或Demyuncing the first data by using the verification information; or
    根据所述验证信息确定第一密钥,利用所述第一密钥对所述第一数据进行解密。Determining a first key according to the verification information, and decrypting the first data by using the first key.
  28. 根据权利要求27所述的方法,其特征在于,所述在从第二存储器获取验证信息之前,所属方法还包括:The method according to claim 27, wherein the method further comprises: before acquiring the verification information from the second memory, the method further comprises:
    根据第二密钥对所述验证信息进行解密,所述第二密钥不同于所述第一密钥。The verification information is decrypted according to a second key, the second key being different from the first key.
  29. 根据权利要求28所述的方法,其特征在于,所述根据所述验证信息确定第一密钥,包括:The method according to claim 28, wherein the determining the first key according to the verification information comprises:
    根据所述验证信息和第一预设序列,确定所述第一密钥;以及Determining the first key according to the verification information and the first preset sequence;
    所述方法还包括:The method further includes:
    根据第二预设序列,确定所述第二密钥,所述第二预设序列不同于所述第一预设序列。Determining, according to the second preset sequence, the second key, where the second preset sequence is different from the first preset sequence.
  30. 根据权利要求25至29中任一项所述的方法,其特征在于,所述第一存储器包括N个区域,所述第二存储器包括N个区域,所述第一存储器的N个区域与所述第二存储器的N个区域一一对应,N为正整数,以及The method according to any one of claims 25 to 29, wherein the first memory comprises N areas, the second memory comprises N areas, and N areas of the first memory One-to-one correspondence of N regions of the second memory, N being a positive integer, and
    所述从第一存储器获取第一数据,包括:The acquiring the first data from the first memory includes:
    从所述第一存储器的N个区域中的第一区域获取所述第一数据;以及Acquiring the first data from a first one of the N regions of the first memory;
    所述从第二存储器获取验证信息,包括:The obtaining the verification information from the second memory includes:
    从所述第二存储器的N个区域中的第二区域获取验证信息,其中,所述第一区域与所述第二区域对应。Acquiring information is acquired from a second one of the N regions of the second memory, wherein the first region corresponds to the second region.
  31. 根据权利要求30所述的方法,其特征在于,所述第二存储器的N个区域中的每个区域包括至少两个子区域,每个子区域的大小大于或等于所述验证信息的大小,所述根据所述验证信息对所述第一数据进行解安全处理,包括:The method according to claim 30, wherein each of the N regions of the second memory comprises at least two sub-regions, each sub-region having a size greater than or equal to a size of the verification information, De-securing the first data according to the verification information, including:
    将所述第二区域的第一子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理;And using the information stored in the first sub-area of the second area as the verification information, and performing de-secure processing on the first data;
    将所述第二区域的第二子区域中存储的信息作为所述验证信息,并对所述第一数据进行解安全处理。The information stored in the second sub-area of the second area is used as the verification information, and the first data is de-secured.
  32. 根据权利要求25至31中任一项所述的方法,其特征在于,所述第一存储器是所述安全元件和所述中央处理器的共享存储器,所述第二存储器是所述安全元件对应的专用存储器。The method according to any one of claims 25 to 31, wherein the first memory is a shared memory of the secure element and the central processor, and the second memory is a corresponding one of the secure elements Dedicated memory.
  33. 一种通信装置,其特征在于,包括:如权利要求1至16中任一项所述的系统芯片、第一存储器和第二存储器。A communication device, comprising: the system chip according to any one of claims 1 to 16, a first memory, and a second memory.
  34. 一种计算机可读存储介质,其特征在于,用于存储计算机指令,当所述计算机指令被运行时,使得所述计算设备或安全元件执行如权利要求17至32中任一项所述的方法。A computer readable storage medium, for storing computer instructions, when said computer instructions are executed, causing said computing device or security element to perform the method of any one of claims 17 to 32 .
PCT/CN2018/085495 2018-05-03 2018-05-03 Data processing method and apparatus, and system chip WO2019210490A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880076079.2A CN111386513B (en) 2018-05-03 2018-05-03 Data processing method, device and system chip
PCT/CN2018/085495 WO2019210490A1 (en) 2018-05-03 2018-05-03 Data processing method and apparatus, and system chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/085495 WO2019210490A1 (en) 2018-05-03 2018-05-03 Data processing method and apparatus, and system chip

Publications (1)

Publication Number Publication Date
WO2019210490A1 true WO2019210490A1 (en) 2019-11-07

Family

ID=68386944

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/085495 WO2019210490A1 (en) 2018-05-03 2018-05-03 Data processing method and apparatus, and system chip

Country Status (2)

Country Link
CN (1) CN111386513B (en)
WO (1) WO2019210490A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116089967B (en) * 2022-05-12 2024-03-26 荣耀终端有限公司 Data rollback prevention method and electronic equipment
CN115242530B (en) * 2022-07-27 2023-10-13 常州星宇车灯股份有限公司 Vehicle-mounted safety communication system and method based on national cryptographic algorithm and automobile

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120300932A1 (en) * 2011-05-26 2012-11-29 First Data Corporation Systems and Methods for Encrypting Mobile Device Communications
CN104778794A (en) * 2015-04-24 2015-07-15 华为技术有限公司 Mobile payment device and method
CN105912272A (en) * 2016-04-14 2016-08-31 华为技术有限公司 Device and method controlling operation of multiple safety applications

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155940A (en) * 2015-04-17 2016-11-23 扬智科技股份有限公司 The System on Chip/SoC of code and the code protection method of System on Chip/SoC can be protected
CN107194684A (en) * 2016-03-14 2017-09-22 三星电子株式会社 Handle the method for card operation information and support the electronic equipment of methods described
CN106127483A (en) * 2016-06-30 2016-11-16 华为技术有限公司 Method of mobile payment, SOC(system on a chip) and terminal
CN106201766B (en) * 2016-07-25 2018-03-20 深圳市中博科创信息技术有限公司 Data storage control method and data server

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120300932A1 (en) * 2011-05-26 2012-11-29 First Data Corporation Systems and Methods for Encrypting Mobile Device Communications
CN104778794A (en) * 2015-04-24 2015-07-15 华为技术有限公司 Mobile payment device and method
CN105912272A (en) * 2016-04-14 2016-08-31 华为技术有限公司 Device and method controlling operation of multiple safety applications

Also Published As

Publication number Publication date
CN111386513B (en) 2021-09-07
CN111386513A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
EP3274850B1 (en) Protecting a memory
US11395148B2 (en) Method and device for protecting privacy
CN1878055B (en) Separation type mass data encryption/decryption device and implementing method therefor
US10496841B2 (en) Dynamic and efficient protected file layout
KR101349849B1 (en) Universal secure information storage device
TWI609289B (en) A low-overhead cryptographic method,system,and processor for providing memory confidentiality,integrity and replay protection
US11763289B2 (en) Method of operating payment device for selectively enabling payment function according to validity of host
CN108345806A (en) A kind of hardware encryption card and encryption method
WO2014048354A1 (en) Method, terminal and universal integrated circuit card (uicc) for realizing subscriber identity module (sim) card function in terminal
CN102663326B (en) SoC-used data security encryption module
US9563765B2 (en) Baseband secure boot with remote storage
US20100077472A1 (en) Secure Communication Interface for Secure Multi-Processor System
US11455430B2 (en) Secure element and related device
US20190260587A1 (en) Security authentication method and system, and integrated circuit
CN106027261B (en) FPGA-based L UKS authentication chip circuit and password recovery method thereof
CN112612486B (en) Memory burning method and device and chip to be burned
US12003632B2 (en) Secure communication in accessing a network
CN113094718A (en) File encryption method and related device
EP4036775A1 (en) Data processing method and apparatus, and system chip
CN111783078A (en) Android platform security chip control system
WO2019210490A1 (en) Data processing method and apparatus, and system chip
US11698973B2 (en) Platform security mechanism
CN113853588A (en) Bus encryption for non-volatile memory
CN103905192B (en) A kind of encrypted authentication method, apparatus and system
CN202600714U (en) Embedded terminal based on SD (Secure Digital) trusted computing module

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18917391

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18917391

Country of ref document: EP

Kind code of ref document: A1