WO2020063975A1 - 一种非易失性存储器的分区保护方法及装置 - Google Patents

一种非易失性存储器的分区保护方法及装置 Download PDF

Info

Publication number
WO2020063975A1
WO2020063975A1 PCT/CN2019/109134 CN2019109134W WO2020063975A1 WO 2020063975 A1 WO2020063975 A1 WO 2020063975A1 CN 2019109134 W CN2019109134 W CN 2019109134W WO 2020063975 A1 WO2020063975 A1 WO 2020063975A1
Authority
WO
WIPO (PCT)
Prior art keywords
protection
write
partition
storage
storage area
Prior art date
Application number
PCT/CN2019/109134
Other languages
English (en)
French (fr)
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 北京嘉楠捷思信息技术有限公司
Publication of WO2020063975A1 publication Critical patent/WO2020063975A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • the present invention relates to the field of memory, and in particular, to a method and a device for partition protection of a non-volatile memory.
  • the partition management mechanism generally divides the storage space into different blocks according to the storage address and performs data according to requirements Storage, for example, the data stored by the user can be stored in the ordinary user data area or the enhanced user data area, respectively, and access restrictions can be set on the enhanced user data area.
  • this partition protection mechanism usually has the problem that it is difficult to balance flexibility and security. Because the same data may have different security requirements at different stages, it is difficult to meet the security requirements of storage partitions with a single security protection mechanism. The software protection mechanism will lead to the lack of security protection.
  • the embodiments of the present invention provide a method and device for partition protection of non-volatile memory. Multiple protection mechanisms, on the basis of guaranteeing security, flexibly configure security protection mechanisms for multiple partitions of non-volatile memory.
  • a partition protection method for a nonvolatile memory includes at least a plurality of storage partitions and a write-protected bit storage area.
  • the partition is characterized in that: Protection methods include:
  • the first protection information is first write protection information having a plurality of write protection identifiers, and the plurality of write protection identifiers correspond to the plurality of storage partitions in a one-to-one manner for indicating The first write protection status of the corresponding storage partition.
  • performing the first protection on a preset storage partition of the multiple storage partitions based on the first protection information stored in the write-protected bit storage area includes:
  • the first protection is a permanent write protection implemented based on hardware.
  • the second protection information further includes load protection information, where the load protection information is used to indicate a state of load protection of each storage partition and a write protection bit storage area;
  • the performing second protection on the write-protected bit storage area and / or the preset storage partition based on the preset second protection information further includes:
  • the second protection information further includes second write protection information, and the second write protection information is used to indicate a second write protection of each of the storage partition and a write protection bit storage area. status;
  • the performing second protection on the write-protected bit storage area and / or the preset storage partition based on the preset second protection information further includes:
  • the second write protection is a reversible write protection based on software.
  • the plurality of storage partitions include at least a key storage partition for storing a key required for processor startup; wherein,
  • the plurality of storage partitions include at least a configuration information storage partition for storing configuration information required for processor startup; wherein,
  • the method further includes:
  • part or all of the non-volatile memory is a one-time programmable memory.
  • a partition protection device for a non-volatile memory wherein the partition protection device includes:
  • the non-volatile memory includes at least a plurality of storage partitions and a write protection bit storage area,
  • the write protection bit storage area is configured to store first protection information, and perform first protection on a preset storage partition of the plurality of storage partitions based on the first protection information;
  • the controller is configured to perform second protection on the write-protected bit storage area and / or the preset storage partition based on the preset second protection information.
  • the first protection information is first write protection information having a plurality of write protection identifiers, and the plurality of write protection identifiers correspond to the plurality of storage partitions in a one-to-one manner for indicating The first write protection status of the corresponding storage partition.
  • performing the first protection on a preset storage partition of the multiple storage partitions based on the first protection information includes:
  • the first protection is a permanent write protection implemented based on hardware.
  • the second protection information further includes load protection information, where the load protection information is used to indicate a state of load protection of each storage partition and a write protection bit storage area;
  • controller further includes a loading control unit, configured to:
  • the second protection information further includes second write protection information, and the second write protection information is used to indicate a second write protection of each of the storage partition and a write protection bit storage area. status;
  • controller further includes a second write protection control unit, configured to:
  • the second write protection is a reversible write protection based on software.
  • the plurality of storage partitions include at least a key storage partition for storing a key required for processor startup; wherein,
  • the plurality of storage partitions include at least a configuration information storage partition for storing configuration information required for processor startup; wherein,
  • controller is further configured to:
  • part or all of the non-volatile memory is a one-time programmable memory.
  • the first protection performed on the storage partition in the non-volatile memory by partitioning is performed, and
  • a more flexible and more secure security protection mechanism can be set for multiple storage partitions.
  • FIG. 1 shows a schematic diagram of a partition protection device for a non-volatile memory according to an embodiment of the present invention.
  • FIG. 2 shows a flowchart of a partition protection method for a non-volatile memory according to an embodiment of the present invention.
  • FIG. 3 shows a flowchart of another partition protection method for a non-volatile memory according to an embodiment of the present invention.
  • FIG. 4 shows a flowchart of another method for partition protection of a nonvolatile memory according to an embodiment of the present invention.
  • FIG. 5 shows a flowchart of another method for partition protection of a nonvolatile memory according to an embodiment of the present invention.
  • FIG. 6 shows a schematic diagram of another partition protection device for a non-volatile memory according to an embodiment of the present invention.
  • FIG. 7 shows a schematic diagram of another partition protection device for a non-volatile memory according to an embodiment of the present invention.
  • An embodiment of the present invention proposes a method for partition protection of a non-volatile memory.
  • the non-volatile memory 110 includes at least a plurality of storage partitions (for example, a first storage area 111_1, a second storage 111_2, and so on. .., Nth memory 111_N, N is a value of 1 or more) and write-protected bit storage area 112, as shown in FIG. 2, the above-mentioned partition protection method includes:
  • S110 Perform first protection on the preset storage partition based on the first protection information stored in the write-protected bit storage area;
  • S120 Perform second protection on the write-protected bit storage area and / or the preset storage partition based on the preset second protection information.
  • the above-mentioned preset second protection is that one or more central processing units (CPUs) are initialized after power-on and the CPU is started according to a preset protection rule to the write-protected bit storage area and / or preset storage by software. Protection mechanism for partition control.
  • CPUs central processing units
  • non-volatile memory may be: flash memory, MRAM, PRAM, FeRAM, etc.
  • the foregoing second protection may include one or more of read protection, write protection, load protection, and erasure protection.
  • the read protection means that if a certain storage area is subjected to read protection, read operation is prohibited on the area
  • the above write protection means that if a certain storage area is subjected to read protection, the area is prohibited Write operation is performed;
  • the above-mentioned load protection means that if a certain storage area is subjected to load protection, loading operation on the area is prohibited.
  • the non-volatile storage space is used as a whole storage space and has not been effectively divided.
  • the nonvolatile memory is partitioned and a write protection bit storage area is used to provide independent technical solutions for each divided area, so that the nonvolatile memory can be used more flexibly.
  • the first protection information is first write protection information having multiple write protection identifiers, and the multiple write protection identifiers and the multiple storage partitions (for example, the first storage area 111_1, the second storage 111_2, .. .
  • the above write protection identifier is determined by one bit of stored data, or by two or more bits of data, which is not limited herein.
  • performing the first hardware-based protection on a preset storage partition based on the first protection information stored in the write-protected bit storage area includes:
  • S210 Determine the first write protection status of the corresponding storage partition by using the first write protection identifier
  • S220 Enable the first protection by setting the write protection bit of one or more storage partitions corresponding to the first write protection state
  • the first protection is a permanent write protection implemented based on hardware.
  • the first write protection bit is a permanent write protection based on hardware and cannot be modified by software.
  • the state of the write protection bit corresponding to the write protection bit storage area of the second storage partition is written from logic “0” to logic "1" also changes the first write protection prohibition to the first write protection enable.
  • the write-protected bit storage area is an OTP storage area, so logic “0” can be modified to logic “1”, but logic "1" cannot be reset to logic "0", that is, the pair cannot be
  • the first write protection state of the preset storage partition is changed from write protection enabled to write protection disabled.
  • the first write protection identifier when the first write protection identifier is newly written into the write protection bit storage area, the first write protection needs to be performed on the corresponding storage partition at the next power-on initialization or restart.
  • the second protection information further includes load protection information, where the load protection information is used to indicate a state of each load protection of each storage partition and a write protection bit storage area;
  • performing the second protection on the write-protected bit storage area and / or the preset storage partition based on the preset second protection information further includes:
  • S310 Receive a load request for a write-protected bit storage area or a preset storage partition
  • S320 Determine whether the load protection status of the write protection bit storage area or the preset storage partition is enabled or disabled
  • the above storage partition may store configuration information, such as a switch of a jtag interface.
  • configuration information such as a switch of a jtag interface.
  • the jtag interface used for debugging needs to be closed to ensure code security. Otherwise, if jtag is turned on and the correct key is loaded in the hardware, then we can know the program we are executing. Data information is cracked.
  • the switch of the jtag interface may face high-level security threats, such as clock frequency attacks.
  • the memory needs to be read and written in accordance with the correct sequential logic. If the memory is not read and written in accordance with the normal sequential logic, the result of the read and write will have Randomness.
  • the area where the jtag interface switch is stored on the non-volatile memory and the area where the key is stored can not only be loaded into the processor during power-on initialization, but can still be loaded after the CPU starts, then A hacker can give the correct sequential logic to load the correct key during initialization, and then give the wrong sequential logic to attack the jtag function bit after the CPU starts. Since the jtag function bit is only 1 bit, it is easier to crack. You can open the jtag that was originally closed, and at the same time, the correct key has been loaded in the system, and it may further be cracked by using the jtag interface.
  • the embodiment of the present invention performs load protection on a specified storage partition or a write-protected bit storage area, for example, a storage area storing a boot add-on is controlled to be loaded to a processor to perform startup only upon power-on initialization, After the startup, the software-based load protection prohibits data in the storage area from being loaded into the processor.
  • the non-volatile memory is prevented from being subjected to a sequential logic attack, and a better data protection effect is further achieved.
  • the second protection information further includes second write protection information, and the second write protection information is used to indicate a respective second write protection of each of the storage partition and a write protection bit storage area. status;
  • performing the second protection on the write-protected bit storage area and / or the preset storage partition based on the preset second protection information further includes:
  • S410 Receive a write request for a write-protected bit storage area or a preset storage partition
  • S420 Determine whether the state of the second write protection of the write protection bit storage area or the preset storage partition is enabled or disabled;
  • S430 If the state of the second write protection is enabled, modify the state of the second write protection to disabled based on a predetermined condition, and execute a write operation, and after the write operation is performed, execute the write operation. Write-protected status is changed to enabled;
  • the second write protection is a reversible write protection implemented based on software.
  • the above-mentioned second write protection can be applied to multiple types of storage partitions.
  • the embodiments of the present invention generally include data on the storage partition. After the writing is completed, the first write protection is performed on it, that is, the hardware is permanently written protected, but before the data is written, in order to prevent possible misoperations, the second write protection can be performed on it.
  • the embodiment of the present invention can perform a second write protection on it to meet the demand.
  • the above-mentioned second write protection can perform write protection on the write-protected bit storage area to prevent misoperation, and can further prevent the permanent write protection of the corresponding storage partition from being performed by mistake.
  • the preset second write-protection information may be stored in a second write-protection register.
  • the i-th write-protection bit of the register corresponds to the i-th memory partition. If the i-th write-protection bit is logic " 1 ”(enabled), when a write operation needs to be performed on the i-th storage partition, it is necessary to temporarily set the write-protection position of the i-th bit of the second write-protection register to“ 0 ”(disabled), and then the i-th storage partition can be The storage partition performs a write operation. After the write operation is completed, the i-th bit write protection bit needs to be set to “1” (enabled) again to restore the second write protection of the i-th storage partition.
  • the operation to write the write-protected position "0" (forbidden) of the second write-protection register needs to satisfy a preset condition
  • the preset condition may be that the write subject satisfies a preset execution permission.
  • Decryption may be performed on the preset key, or the preset condition may not be set, and only an instruction needs to be sent to control the write protection bit, which is not limited in the embodiment of the present invention.
  • the embodiment of the present invention can more flexibly set the write protection status of the storage partition by adopting the second write protection implemented based on software, and can prevent the erroneous writing operation to the write protection bit storage area, further preventing the storage partition. By mistake.
  • the plurality of storage partitions may include at least a key storage partition 111_X and a configuration information storage partition 111_Y.
  • the key storage partition 111_X is used to store a key required for processor startup; the configuration information storage partition 111_Y is used for storage processing. Configuration information required for the router to start, such as the jtag interface switch.
  • the key storage area 111_X may be protected in stages. For example, a second write protection is performed on the key storage area 111_X before the key writing is completed; a first protection is performed on the key storage area 111_X after the key writing is completed; The key store performs load protection.
  • the configuration information storage partition 111_Y may be protected in stages. For example, a second write protection is performed on the configuration information storage partition 111_Y before the configuration information writing is completed; a first protection is performed on the configuration information storage partition 111_Y after the configuration information writing is completed; The configuration information storage partition 111_Y performs load protection.
  • independent protection mechanisms can also be adaptively set according to their security requirements and operating frequencies.
  • the present invention takes the above-mentioned key storage partition and configuration information storage partition as examples for description but is not limited thereto.
  • the write protection bit storage area 112 may be subjected to load protection and second write protection.
  • the embodiments of the present invention further prevent the above important data from being tampered with, or maliciously tampered with, or configured with the above-mentioned phased, multi-type security protection mechanism for the key storage partition and configuration information storage partition that have high security requirements and do not need to change data. Malicious stealing.
  • part or all of the non-volatile memory is a one-time programmable memory (OTP memory).
  • OTP memory one-time programmable memory
  • each bit of the OTP memory cannot be erased after writing. Therefore, the use of the OTP memory can prevent data from being rewritten to a certain extent. Further, for the write-protected bit storage area, the use of OTP storage can naturally realize that the first write-protection flag cannot be modified to “disable” when it is “enabled”.
  • the embodiments of the present invention can further ensure data security by using an OTP memory.
  • the first protection performed on the storage partition in the non-volatile memory by partitioning is performed, and
  • a more flexible and more secure security protection mechanism can be set for multiple storage partitions.
  • the partition protection device includes: at least a plurality of storage partitions (for example, the first storage area 111_1, the second storage 111_2, ... .., the Nth memory 111_N, where N is a value of 1 or more) and the non-volatile memory 110 and the controller 120 of the write-protected bit storage area 112.
  • the first protection information stored in the write-protected bit storage area 112 performs first protection on the preset storage partition 111; the controller 120 is configured to protect the write-protected bit storage area 112 and / or based on the preset second protection information.
  • a preset storage partition (for example, any one or more of the first storage area 111_1, the second storage 111_2, ..., and the Nth storage 111_N) performs the second protection.
  • the controller 120 is electrically connected to the preset second protection as one or more central processing units (CPUs). After the power-on initialization is completed and the CPU is started, the controller 120 is based on the control of the CPU and according to the preset protection.
  • the rule protects the write-protected bit storage area and / or the preset storage partition through software.
  • the non-volatile memory 110 may be: a flash memory, MRAM, PRAM, FeRAM, and the like.
  • the non-volatile memory 110 is preferably an OTP memory.
  • the foregoing second protection may include one or more of read protection, write protection, load protection, and erasure protection.
  • the read protection means that if a certain storage area is subjected to read protection, read operation is prohibited on the area
  • the above write protection means that if a certain storage area is subjected to read protection, the area is prohibited Write operation is performed;
  • the above-mentioned load protection means that if a certain storage area is subjected to load protection, loading operation on the area is prohibited.
  • the non-volatile storage space is used as a whole storage space and has not been effectively divided.
  • the nonvolatile memory is partitioned and a write protection bit storage area is used to provide independent technical solutions for each divided area, so that the nonvolatile memory can be used more flexibly.
  • the first protection information is first write protection information having multiple write protection identifiers, and the multiple write protection identifiers and the multiple storage partitions (for example, the first storage area 111_1, the second storage 111_2, .. .
  • the above write protection identifier is determined by one bit of stored data, or by two or more bits of data, which is not limited herein.
  • performing the first hardware-based protection on the preset storage partition based on the first protection information stored in the write-protected bit storage area includes:
  • the first protection is a permanent write protection implemented based on hardware.
  • the first write protection bit is a permanent write protection based on hardware and cannot be modified by software.
  • the state of the write protection bit corresponding to the write protection bit storage area of the second storage partition is written from logic “0” to logic "1" also changes the first write protection prohibition to the first write protection enable.
  • the write-protected bit storage area is an OTP storage area, so logic “0” can be modified to logic “1”, but logic "1" cannot be reset to logic "0", that is, the pair cannot be
  • the first write protection state of the preset storage partition is changed from write protection enabled to write protection disabled.
  • the first write protection identifier when the first write protection identifier is newly written into the write protection bit storage area, the first write protection needs to be performed on the corresponding storage partition at the next power-on initialization or restart.
  • the second protection information further includes load protection information, where the load protection information is used to indicate a state of each load protection of each storage partition and a write protection bit storage area;
  • the controller 120 further includes a loading control unit 121 configured to execute:
  • the above storage partition may store configuration information, such as a switch of a jtag interface.
  • configuration information such as a switch of a jtag interface.
  • the jtag interface used for debugging needs to be closed to ensure code security. Otherwise, if jtag is turned on and the correct key is loaded in the hardware, then we can know the program we are executing. Data information is cracked.
  • the switch of the jtag interface may face high-level security threats, such as clock frequency attacks.
  • the memory needs to be read and written in accordance with the correct sequential logic. If the memory is not read and written in accordance with the normal sequential logic, the result of the read and write will have Randomness.
  • the area where the jtag interface switch is stored on the non-volatile memory and the area where the key is stored can not only be loaded into the processor during power-on initialization, but can still be loaded after the CPU starts, then A hacker can give the correct sequential logic to load the correct key during initialization, and then give the wrong sequential logic to attack the jtag function bit after the CPU starts. Since the jtag function bit is only 1 bit, it is easier to crack. You can open the jtag that was originally closed, and at the same time, the correct key has been loaded in the system, and it may further be cracked by using the jtag interface.
  • the embodiment of the present invention performs load protection on a specified storage partition or a write-protected bit storage area, for example, a storage area storing a boot add-on is controlled to be loaded to a processor to perform startup only upon power-on initialization, After the startup, the software-based load protection prohibits data in the storage area from being loaded into the processor.
  • the non-volatile memory is prevented from being subjected to a sequential logic attack, and a better data protection effect is further achieved.
  • the second protection information further includes second write protection information, and the second write protection information is used to indicate a respective second write protection of each of the storage partition and a write protection bit storage area. status;
  • the controller 120 further includes a second write protection control unit 122, which is specifically configured to execute:
  • the state of the second write protection is enabled, the state of the second write protection is modified to be disabled based on a predetermined condition, and then a write operation is performed, and the second write protection is performed after the write operation is completed. Is changed to enabled;
  • the second write protection is a reversible write protection implemented based on software.
  • the above-mentioned second write protection can be applied to multiple types of storage partitions.
  • the embodiments of the present invention generally include data on the storage partition. After the writing is completed, the first write protection is performed on it, that is, the hardware is permanently written protected, but before the data is written, in order to prevent possible misoperations, the second write protection can be performed on it.
  • the embodiment of the present invention can perform a second write protection on it to meet the demand.
  • the above-mentioned second write protection can perform write protection on the write-protected bit storage area to prevent misoperation, and can further prevent the permanent write protection of the corresponding storage partition from being performed by mistake.
  • the preset second write-protection information may be stored in a second write-protection register.
  • the i-th write-protection bit of the register corresponds to the i-th memory partition. If the i-th write-protection bit is logic " 1 ”(enabled), when a write operation needs to be performed on the i-th storage partition, it is necessary to temporarily set the write-protection position of the i-th bit of the second write-protection register to“ 0 ”(disabled), and then the i-th storage partition can be The storage partition performs a write operation. After the write operation is completed, the i-th bit write protection bit needs to be set to “1” (enabled) again to restore the second write protection of the i-th storage partition.
  • the operation to write the write-protected position "0" (forbidden) of the second write-protection register needs to satisfy a preset condition
  • the preset condition may be that the write subject satisfies a preset execution permission.
  • Decryption may be performed on the preset key, or the preset condition may not be set, and only an instruction needs to be sent to control the write protection bit, which is not limited in the embodiment of the present invention.
  • the embodiment of the present invention can more flexibly set the write protection status of the storage partition by adopting the second write protection implemented based on software, and can prevent the erroneous writing operation to the write protection bit storage area, further preventing the storage partition. By mistake.
  • the plurality of storage partitions may include at least a key storage partition 111_X and a configuration information storage partition 111_Y.
  • the key storage partition 111_X is used to store a key required for processor startup; the configuration information storage partition 111_Y is used for storage processing. Configuration information required for the router to start, such as the jtag interface switch.
  • the key storage area 111_X may be protected in stages. For example, a second write protection is performed on the key storage area 111_X before the key writing is completed; a first protection is performed on the key storage area 111_X after the key writing is completed; The key store performs load protection
  • the configuration information storage partition 111_Y may be protected in stages. For example, a second write protection is performed on the configuration information storage partition 111_Y before the configuration information writing is completed; a first protection is performed on the configuration information storage partition 111_Y after the configuration information writing is completed; The configuration information storage partition 111_Y performs load protection.
  • independent protection mechanisms can also be adaptively set according to their security requirements and operating frequencies.
  • the present invention takes the above-mentioned key storage partition and configuration information storage partition as examples for description but is not limited thereto.
  • the write protection bit storage area 112 may be subjected to load protection and second write protection.
  • the embodiments of the present invention further prevent the above important data from being tampered with, or maliciously tampered with, or configured with the above-mentioned phased, multi-type security protection mechanism for the key storage partition and configuration information storage partition that have high security requirements and do not need to change data. Malicious stealing.
  • part or all of the non-volatile memory is a one-time programmable memory (OTP memory).
  • OTP memory one-time programmable memory
  • each bit of the OTP memory cannot be erased after writing. Therefore, the use of the OTP memory can prevent data from being rewritten to a certain extent. Further, for the write-protected bit storage area, the use of OTP storage can naturally realize that the first write-protection flag cannot be modified to “disable” when it is “enabled”.
  • the embodiments of the present invention can further ensure data security by using an OTP memory.
  • the first protection performed on the storage partition in the non-volatile memory by partitioning is performed, and
  • a more flexible and more secure security protection mechanism can be set for multiple storage partitions.
  • the present invention partitions the non-volatile memory and sets a write-protection bit storage area to perform a first protection of the storage partition in the above-mentioned non-volatile storage by performing partitioning, and a second protection of the non-volatile memory by partitioning. Protection, you can set more flexible and more secure security protection mechanism for multiple storage partitions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Storage Device Security (AREA)

Abstract

一种非易失性存储器的分区保护方法及装置,所述非易失性存储器包括多个存储分区以及写保护位存储区,所述分区保护方法包括:基于写保护位存储区中存储的第一保护信息对多个存储分区中的预设存储分区执行第一保护(S110);基于预设的第二保护信息对写保护位存储区和/或预设存储分区执行第二保护(S120)。通过对非易失性存储器进行分区管理,提供了一种更为灵活且安全的保护机制。

Description

一种非易失性存储器的分区保护方法及装置 技术领域
本发明涉及存储器领域,具体涉及一种非易失性存储器的分区保护方法及装置。
背景技术
本部分旨在为权利要求书中陈述的本发明的实施方式提供背景或上下文。此处的描述不因为包括在本部分中就承认是现有技术。
大多数嵌入式系统的芯片中都具有非易失性存储空间,该存储空间中所存储的大量数据之间的重要程度、安全需求程度以及修改频率都不相同,为使易于管理上述大量数据,现有技术中通常采用对非易失性存储器执行分区管理的机制使其具有更加丰富的控制功能,分区管理机制一般是将存储空间按存储地址划分为不同的区块,并将数据按需求进行存储,例如:可以将用户存入的数据分别存入普通级用户数据区或增强级用户数据区,并对增强级用户数据区设置访问限制。
但是这种分区保护机制通常存在难以兼顾灵活性与安全性的问题,由于同一数据可能在不同阶段都可能具有不同的安全需求,采用单一的安全保护机制难以满足存储分区的安全需求,若采用完全的软件保护机制又会导致安全保护力度的欠缺。
发明公开
针对现有技术中的针对非易失性存储器的分区保护机制存在的难以兼顾灵活型与安全性的问题,本发明的实施例提出一种非易失性存储器的分区保护方法及装置,通过采用多重保护机制,在保证安全性的基础上为非易失性存储器的多个分区灵活配置了安全保护机制。
在本发明实施方式的第一方面,提出一种非易失性存储器的分区保护方法,所述非易失性存储器至少包括多个存储分区以及写保护位存储区,其特征在于,所述分区保护方法包括:
基于所述写保护位存储区中存储的第一保护信息对所述多个存储分区中 的预设存储分区执行第一保护;
基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护。
在一种实施方式中,其中,所述第一保护信息为具有多个写保护标识的第一写保护信息,所述多个写保护标识与所述多个存储分区一一对应,用于指示对应的存储分区的第一写保护状态。
在一种实施方式中,其中,所述基于所述写保护位存储区中存储的第一保护信息对所述多个存储分区中的预设存储分区执行第一保护包括:
通过所述第一写保护标识判断对应的存储分区的第一写保护状态;
通过将对应于第一写保护状态的一个或多个存储分区的写保护位置位以使能所述第一保护;
其中,所述第一保护为基于硬件实现的永久写保护。
在一种实施方式中,其中,所述第二保护信息进一步包括加载保护信息,所述加载保护信息用于指示对每个存储分区以及写保护位存储区的加载保护的状态;
以及所述基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护进一步包括:
接收针对写保护位存储区或预设存储分区的加载请求;
判断所述写保护位存储区或预设存储分区的加载保护的状态为使能或禁止;
若所述加载保护的状态为使能,则拒绝加载所述写保护位存储区或预设存储分区;
若所述加载保护的状态为禁止,则允许加载所述写保护位存储区或预设存储分区。
在一种实施方式中,其中,所述第二保护信息进一步包括第二写保护信息,所述第二写保护信息用于指示每个所述存储分区以及写保护位存储区的第二写保护的状态;
以及所述基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护进一步包括:
接收针对写保护位存储区或预设存储分区的写入请求;
判断所述写保护位存储区或预设存储分区的第二写保护的状态为使能或禁止;
若所述第二写保护的状态为使能,则先将所述第二写保护的状态修改为禁止后执行写入操作,并在写入操作执行完毕后将所述第二写保护的状态修改为使能;以及
若所述第二写保护的状态为禁止,则直接向所述写保护位存储区或预设存储分区执行写入操作。
其中,所述第二写保护为基于软件实现的可逆写保护。
在一种实施方式中,其中,所述多个存储分区至少包括密钥存储分区,用于存储处理器启动所需要的密钥;其中,
在密钥写入完成前对所述密钥存储区执行第二写保护;
在密钥写入完成后通过对所述密钥存储区执行第一保护;以及
在启动后对所述密钥存储区执行加载保护
在一种实施方式中,其中,所述多个存储分区至少包括配置信息存储分区,用于存储处理器启动所需要的配置信息;其中,
在配置信息写入完成前对所述配置信息存储分区执行第二写保护;
在配置信息写入完成后对所述配置信息存储分区执行第一保护;以及
在启动后对所述配置信息存储分区执行加载保护。
在一种实施方式中,其中,所述方法还包括:
在启动后对所述写保护位存储区执行第二保护。
在一种实施方式中,其中,所述非易失性存储器的部分或全部为一次性可编程存储器。
本发明实施方式的第二方面,提供一种非易失性存储器的分区保护装置,其特征在于,所述分区保护装置包括:
所述非易失性存储器至少包括多个存储分区以及写保护位存储区,
所述写保护位存储区用于存储第一保护信息,以及基于所述第一保护信息对所述多个存储分区中的预设存储分区执行第一保护;
控制器,用于基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护。
在一种实施方式中,其中,所述第一保护信息为具有多个写保护标识的第 一写保护信息,所述多个写保护标识与所述多个存储分区一一对应,用于指示对应的存储分区的第一写保护状态。
在一种实施方式中,其中,所述基于所述第一保护信息对所述多个存储分区中的预设存储分区执行第一保护包括:
通过所述第一写保护标识判断对应的存储分区的第一写保护状态;
通过将对应于第一写保护状态的一个或多个存储分区的写保护位置位以使能所述第一保护;
其中,所述第一保护为基于硬件实现的永久写保护。
在一种实施方式中,其中,所述第二保护信息进一步包括加载保护信息,所述加载保护信息用于指示对每个存储分区以及写保护位存储区的加载保护的状态;
以及所述控制器进一步包括加载控制单元,用于:
接收针对写保护位存储区或预设存储分区的加载请求;
判断所述写保护位存储区或预设存储分区的加载保护的状态为使能或禁止;
若所述加载保护的状态为使能,则拒绝加载所述写保护位存储区或预设存储分区;
若所述加载保护的状态为禁止,则允许加载所述写保护位存储区或预设存储分区。
在一种实施方式中,其中,所述第二保护信息进一步包括第二写保护信息,所述第二写保护信息用于指示每个所述存储分区以及写保护位存储区的第二写保护的状态;
以及所述控制器进一步包括第二写保护控制单元,用于:
接收针对写保护位存储区或预设存储分区的写入请求;
判断所述写保护位存储区或预设存储分区的第二写保护的状态为使能或禁止;
若所述第二写保护的状态为使能,则先将所述第二写保护的状态修改为禁止后执行写入操作,并在写入操作执行完毕后将所述第二写保护的状态修改为使能;以及
若所述第二写保护的状态为禁止,则直接向所述写保护位存储区或预设存 储分区执行写入操作。
其中,所述第二写保护为基于软件实现的可逆写保护。
在一种实施方式中,其中,所述多个存储分区至少包括密钥存储分区,用于存储处理器启动所需要的密钥;其中,
在密钥写入完成前对所述密钥存储区执行第二写保护;
在密钥写入完成后通过对所述密钥存储区执行第一保护;以及
在启动后对所述密钥存储区执行加载保护
在一种实施方式中,其中,所述多个存储分区至少包括配置信息存储分区,用于存储处理器启动所需要的配置信息;其中,
在配置信息写入完成前对所述配置信息存储分区执行第二写保护;
在配置信息写入完成后对所述配置信息存储分区执行第一保护;以及
在启动后对所述配置信息存储分区执行加载保护。
在一种实施方式中,其中,所述控制器还用于:
在启动后对所述写保护位存储区执行第二保护。
在一种实施方式中,其中,所述非易失性存储器的部分或全部为一次性可编程存储器。
综上,本发明实施例通过对非易失性存储器进行分区,并设置写保护位存储区对上述非易失性存储器中的存储分区进行分区执行的第一保护,以及对非易失性存储器进行分区的第二保护,可以对多个存储分区设置更为灵活且具有更高安全性的安全保护机制。
以下结合附图和具体实施例对本发明进行详细描述,但不作为对本发明的限定。
附图简要说明
在附图中,以示例性而非限制性的方式示出了本发明的若干实施方式,其中:
图1示出了根据本发明实施例的一种非易失性存储器的分区保护装置的示意图。
图2示出了根据本发明实施例的一种非易失性存储器的分区保护方法流程图。
图3示出了根据本发明实施例的另一种非易失性存储器的分区保护方法流程图。
图4示出了根据本发明实施例的又一种非易失性存储器的分区保护方法流程图。
图5示出了根据本发明实施例的又一种非易失性存储器的分区保护方法流程图。
图6示出了根据本发明实施例的另一种非易失性存储器的分区保护装置示意图。
图7示出了根据本发明实施例的另一种非易失性存储器的分区保护装置示意图。
在附图中,相同或对应的标号表示相同或对应的部分。
实现本发明的最佳方式
下面结合附图对本发明的结构原理和工作原理作具体的描述:
下面将参考若干示例性实施方式来描述本发明的原理和精神。应当理解,给出这些实施方式仅仅是为了使本领域技术人员能够更好地理解进而实现本发明,而并非以任何方式限制本发明的范围。相反,提供这些实施方式是为了使本公开更加透彻和完整,并且能够将本公开的范围完整地传达给本领域的技术人员。
示例性方法
本发明实施例提出一种非易失性存储器的分区保护方法,如图1所示,非易失性存储器110至少包括多个存储分区(例如,第一存储区111_1、第二存储器111_2、...、第N存储器111_N,N为1以上的值)以及写保护位存储区112,如图2所示,上述分区保护方法包括:
S110:基于所述写保护位存储区存储的第一保护信息对预设存储分区执行第一保护;
S120:基于预设的第二保护信息对所述写保护位存储区和/或预设存储分区执行第二保护。
具体地,上述预设的第二保护为一个或多个中央处理器(CPU)在上电初始化完成、CPU启动之后根据预设的保护规则通过软件对写保护位存储区和/ 或预设存储分区进行控制的保护机制。
具体地,上述非易失性存储器可以是:闪速存储器、MRAM、PRAM、FeRAM等
具体地,上述第二保护可以包括:读保护、写保护、加载保护、擦除保护中的一种或多种。
进一步地,所述读保护指的是若某一存储区域被执行读保护,则禁止对该区域进行读操作,上述写保护指的是若某一存储区域被执行读保护,则禁止对该区域进行写操作;上述加载保护指的是若某一存储区域被执行加载保护,则禁止对该区域进行加载操作等等。
本领域技术人员可以理解的是,对于大多数芯片而言,其中的非易失性存储空间都是作为一整块存储空间进行使用,而并未被进行有效划分。本发明实施例通过将非易失性存储器进行分区,并使用写保护位存储区对划分出的各个区域提供各自独立的写保护的技术方案,可以更加灵活地使用该非易失性存储器。
以下对本发明实施例的另一实施例进行详细描述,
所述第一保护信息为具有多个写保护标识的第一写保护信息,所述多个写保护标识与所述多个存储分区(例如,第一存储区111_1、第二存储器111_2、...、第N存储器111_N,N为1以上的值)一一对应,用于指示对应的存储分区的第一写保护状态。
具体地,上述写保护标识由一位存储数据决定,或者由两位或更多位数据决定,在此不做限定。
在一实施例中,如图3所示,所述基于所述写保护位存储区存储的第一保护信息对预设存储分区执行基于硬件实现的第一保护包括:
S210:通过所述第一写保护标识判断对应的存储分区的第一写保护状态;
S220:通过将对应于第一写保护状态的一个或多个存储分区的写保护位置位以使能第一保护;
具体地,所述第一保护为基于硬件实现的永久写保护。
具体地,假设非易失性存储器中的第一存储分区在写保护位存储区所对应的写保护位的状态为逻辑“1”,也即处于第一写保护使能状态,得以执行对 第一存储分区的第一写保护,该第一写保护位为基于硬件实现的永久写保护,软件无法修改。
进一步地,若想对非易失性存储器的第二存储分区执行第一写保护,则将第二存储分区在写保护位存储区所对应的写保护位的状态由逻辑“0”写为逻辑“1”,也即将第一写保护禁止变更为第一写保护使能。
在一实施例中,写保护位存储区为OTP存储区,因此逻辑“0”可以被修改为逻辑“1”,但是逻辑“1”不能被复位成逻辑“0”,也即,不能将对预设存储分区的第一写保护状态从写保护使能修改为写保护禁止。
具体地,向写保护位存储区新写入第一写保护标识,需要在下一次上电初始化或重启时对所对应的存储分区执行第一写保护。
进一步地,由于写保护电路的实现本身在本领域技术人员的认知范围内,写保护电路将不进一步描述。
以下结合图4对本发明实施例又一实施例进行详细描述。
在一实施例中,所述第二保护信息进一步包括加载保护信息,所述加载保护信息用于指示对每个存储分区以及写保护位存储区的各自的加载保护的状态;
如图4所示,所述基于预设的第二保护信息对所述写保护位存储区和/或预设存储分区执行第二保护进一步包括:
S310:接收针对写保护位存储区或预设存储分区的加载请求;
S320:判断所述写保护位存储区或预设存储分区的加载保护的状态为使能或禁止;
S330:若所述加载保护的状态为使能,则拒绝加载所述写保护位存储区或预设存储分区;
S340:若所述加载保护的状态为禁止,则允许加载所述写保护位存储区或预设存储分区。
本领域技术人员可以理解的是,上述存储分区可以会存储配置信息,例如jtag接口的开关。在开发、调试等一系列工作完成后需要将用于调试的jtag接口关闭以保证代码安全,否则如果jtag打开,同时硬件中加载有正确的密钥,那么就可以知道我们执行的程序,对存储的数据信息进行破解。jtag接 口的开关可能面临高级别的安全威胁,例如,时钟频率攻击,一般来说存储器需要按照正确的时序逻辑进行读写,如果不按照正常时序逻辑去读写,就会造成读写的结果具有随机性。基于此,如果非易失性存储器上的存储有jtag接口开关的区域与存储有密钥的区域不仅在上电初始化的时候可以被加载到处理器,而在CPU启动之后仍然可以被加载,那么黑客就可以在初始化的时候给出正确的时序逻辑以加载正确的密钥,并在CPU启动后再给出错误的时序逻辑以攻击jtag功能位,由于jtag功能位只有1bit,比较容易破解,那么就可以将本来关闭的jtag打开,同时系统中已经加载的了正确的密钥,进一步可能利用jtag接口进行破解。
进一步地,本发明实施例针对指定的存储分区或写保护位存储区执行加载保护,例如,存储有启动加载项的存储区域,控制其只在上电初始化时被加载至处理器以执行启动,并在启动后基于软件实现的加载保护禁止该存储区域内的数据被加载至处理器。
本发明实施例通过采用对非易失性存储器执行分区加载保护,避免了非易失性存储器遭受到时序逻辑攻击,进一步达到更好的数据保护效果。
在一实施例中,所述第二保护信息进一步包括第二写保护信息,所述第二写保护信息用于指示每个所述存储分区以及写保护位存储区的各自的第二写保护的状态;
如图5所示,所述基于预设的第二保护信息对所述写保护位存储区和/或预设存储分区执行第二保护进一步包括:
S410:接收针对写保护位存储区或预设存储分区的写入请求;
S420:判断所述写保护位存储区或预设存储分区的第二写保护的状态为使能或禁止;
S430:若所述第二写保护的状态为使能,则基于预定条件将所述第二写保护的状态修改为禁止后执行写入操作,并在写入操作执行完毕后将所述第二写保护的状态修改为使能;以及
S440:若所述第二写保护的状态为禁止,则直接向所述写保护位存储区或预设存储分区执行写入操作。
具体地,上述第二写保护为基于软件实现的可逆写保护。
具体地,上述第二写保护可以应用在多类存储分区,例如,对于安全需求 等级较高且无需进行数据更改的存储分区,如密钥存储分区,本发明实施例通常在该存储分区的数据写入完毕后对其执行第一写保护,也即硬件永久写保护,但在数据写入完毕之前,为了防止可能产生的误操作,可以对其执行第二写保护。又例如,对于安全需求等级较高但需要经常更改数据的存储分区,本发明实施例可以对其执行第二写保护以满足需求。
此外,上述第二写保护可以对写保护位存储区执行写保护以防止误操作,进一步可以防止误执行对相应的存储分区的永久写保护。
进一步地,可以将预设的第二写保护信息存储于第二写保护寄存器,例如,该寄存器的第i位写保护位对应于第i存储分区,若该第i位写保护位为逻辑“1”(使能),当需要对该第i存储分区执行写入操作时,需要暂时先将第二写保护寄存器的第i位写保护位置“0”(禁止),而后可以对该第i存储分区执行写入操作,当上述写入操作完毕后,需要再次将第i位写保护位置“1”(使能)以恢复对该第i存储分区的第二写保护。
在一实施例中,想要执行上述对第二写保护寄存器的写保护位置“0”(禁止)的操作需要满足预设条件,该预设条件可以是写入主体满足预设的执行权限,可以是对预设的密钥完成解密,也可以不设定该预设条件,仅需发送指令以控制该写保护位置位,本发明实施例对此不进行限定。
值得注意的是,尽管此处可以将某一存储分区的第二写保护状态从“使能”更改为“禁止”,但若该存储分区的第一写保护的状态为“使能”,则该存储分区仍会一直保持被写保护的状态,也即,第二写保护只实际作用于未被执行第一写保护的存储分区。
本发明实施例通过采用上述基于软件实现的第二写保护可以对存储分区的写保护状态进行更加灵活的设置,而且可以防止对写保护位存储区的误写入操作,进一步防止了对存储分区的误锁定。
以下结合图6具体描述本发明又一实施例。
具体地,所述多个存储分区至少可以包括密钥存储分区111_X与配置信息存储分区111_Y,密钥存储分区111_X用于存储处理器启动所需要的密钥;配置信息存储分区111_Y用于存储处理器启动所需要的配置信息,例如,jtag接口开关。
具体地,可以对密钥存储区111_X执行分阶段的保护。例如,在密钥写入完成前对所述密钥存储区111_X执行第二写保护;在密钥写入完成后通过对所述密钥存储区111_X执行第一保护;以及在启动后对所述密钥存储区执行加载保护。
具体地,可以对配置信息存储分区111_Y执行分阶段的保护。例如,在配置信息写入完成前对所述配置信息存储分区111_Y执行第二写保护;在配置信息写入完成后对所述配置信息存储分区111_Y执行第一保护;以及在启动后对所述配置信息存储分区111_Y执行加载保护。
而对于其他的存储分区,同样可以根据其安全需求程度以及操作频率适应性地为其设置独立的保护机制,本发明以上述密钥存储分区以及配置信息存储分区为例进行描述但不限于此。
在一实施例中,在启动后可以对所述写保护位存储区112执行加载保护与第二写保护。
本发明实施例通过为安全需求较高且不需要更改数据的密钥存储分区与配置信息存储分区配置上述分阶段、多种类的安全保护机制,进一步避免了上述重要数据被误篡改或恶意篡改或恶意盗取。
在一实施例中,所述非易失性存储器的部分或全部为一次性可编程存储器(OTP存储器)。
本领域技术人员可以理解的是,OTP存储器的每一比特位在写入后不可再进行擦除,因此,采用OTP存储器在一定程度上可以防止数据被改写。进一步地,对于写保护位存储区而言,采用OTP存储可以天然地实现第一写保护标识在“使能”不能再修改为“禁止”。
本发明实施例通过采用OTP存储器可以进一步保障数据安全。
综上,本发明实施例通过对非易失性存储器进行分区,并设置写保护位存储区对上述非易失性存储器中的存储分区进行分区执行的第一保护,以及对非易失性存储器进行分区的第二保护,可以对多个存储分区设置更为灵活且具有更高安全性的安全保护机制。
示例性设备
本发明实施例提出一种非易失性存储器的分区保护装置,如图1所示,上 述分区保护装置包括:至少包括多个存储分区(例如,第一存储区111_1、第二存储器111_2、...、第N存储器111_N,N为1以上的值)以及写保护位存储区112的非易失性存储器110以及控制器120。
其中,写保护位存储区112存储的第一保护信息对预设存储分区111执行第一保护;控制器120用于基于预设的第二保护信息对所述写保护位存储区112和/或预设存储分区(例如,第一存储区111_1、第二存储器111_2、...、第N存储器111_N中的任一个或多个)执行第二保护。
具体地,控制器120电连接至上述预设的第二保护为一个或多个中央处理器(CPU),在上电初始化完成、CPU启动之后控制器120基于CPU的控制,根据预设的保护规则通过软件对写保护位存储区和/或预设存储分区进行保护。
具体地,上述非易失性存储器110可以是:闪速存储器、MRAM、PRAM、FeRAM等。
具体地,上述非易失性存储器110优选为OTP存储器。
具体地,上述第二保护可以包括:读保护、写保护、加载保护、擦除保护中的一种或多种。
进一步地,所述读保护指的是若某一存储区域被执行读保护,则禁止对该区域进行读操作,上述写保护指的是若某一存储区域被执行读保护,则禁止对该区域进行写操作;上述加载保护指的是若某一存储区域被执行加载保护,则禁止对该区域进行加载操作等等。
本领域技术人员可以理解的是,对于大多数芯片而言,其中的非易失性存储空间都是作为一整块存储空间进行使用,而并未被进行有效划分。本发明实施例通过将非易失性存储器进行分区,并使用写保护位存储区对划分出的各个区域提供各自独立的写保护的技术方案,可以更加灵活地使用该非易失性存储器。
以下对本发明实施例的另一实施例进行详细描述,
所述第一保护信息为具有多个写保护标识的第一写保护信息,所述多个写保护标识与所述多个存储分区(例如,第一存储区111_1、第二存储器111_2、...、第N存储器111_N,N为1以上的值)一一对应,用于指示对应的 存储分区的第一写保护状态。
具体地,上述写保护标识由一位存储数据决定,或者由两位或更多位数据决定,在此不做限定。
在一实施例中,所述基于所述写保护位存储区存储的第一保护信息对预设存储分区执行基于硬件实现的第一保护包括:
通过所述第一写保护标识判断对应的存储分区的第一写保护状态;
通过将对应于第一写保护状态的一个或多个存储分区的写保护位置位以使能第一保护;
具体地,所述第一保护为基于硬件实现的永久写保护。
具体地,假设非易失性存储器中的第一存储分区在写保护位存储区所对应的写保护位的状态为逻辑“1”,也即处于第一写保护使能状态,得以执行对第一存储分区的第一写保护,该第一写保护位为基于硬件实现的永久写保护,软件无法修改。
进一步地,若想对非易失性存储器的第二存储分区执行第一写保护,则将第二存储分区在写保护位存储区所对应的写保护位的状态由逻辑“0”写为逻辑“1”,也即将第一写保护禁止变更为第一写保护使能。
在一实施例中,写保护位存储区为OTP存储区,因此逻辑“0”可以被修改为逻辑“1”,但是逻辑“1”不能被复位成逻辑“0”,也即,不能将对预设存储分区的第一写保护状态从写保护使能修改为写保护禁止。
具体地,向写保护位存储区新写入第一写保护标识,需要在下一次上电初始化或重启时对所对应的存储分区执行第一写保护。
进一步地,由于写保护电路的实现本身在本领域技术人员的认知范围内,写保护电路将不进一步描述。
以下结合图7对本发明实施例又一实施例进行详细描述。
在一实施例中,所述第二保护信息进一步包括加载保护信息,所述加载保护信息用于指示对每个存储分区以及写保护位存储区的各自的加载保护的状态;
如图7所示,所述控制器120进一步包括加载控制单元121,用于执行:
接收针对写保护位存储区或预设存储分区的加载请求;
判断所述写保护位存储区或预设存储分区的加载保护的状态为使能或禁止;
若所述加载保护的状态为使能,则拒绝加载所述写保护位存储区或预设存储分区;
若所述加载保护的状态为禁止,则允许加载所述写保护位存储区或预设存储分区。
本领域技术人员可以理解的是,上述存储分区可以会存储配置信息,例如jtag接口的开关。在开发、调试等一系列工作完成后需要将用于调试的jtag接口关闭以保证代码安全,否则如果jtag打开,同时硬件中加载有正确的密钥,那么就可以知道我们执行的程序,对存储的数据信息进行破解。jtag接口的开关可能面临高级别的安全威胁,例如,时钟频率攻击,一般来说存储器需要按照正确的时序逻辑进行读写,如果不按照正常时序逻辑去读写,就会造成读写的结果具有随机性。基于此,如果非易失性存储器上的存储有jtag接口开关的区域与存储有密钥的区域不仅在上电初始化的时候可以被加载到处理器,而在CPU启动之后仍然可以被加载,那么黑客就可以在初始化的时候给出正确的时序逻辑以加载正确的密钥,并在CPU启动后再给出错误的时序逻辑以攻击jtag功能位,由于jtag功能位只有1bit,比较容易破解,那么就可以将本来关闭的jtag打开,同时系统中已经加载的了正确的密钥,进一步可能利用jtag接口进行破解。
进一步地,本发明实施例针对指定的存储分区或写保护位存储区执行加载保护,例如,存储有启动加载项的存储区域,控制其只在上电初始化时被加载至处理器以执行启动,并在启动后基于软件实现的加载保护禁止该存储区域内的数据被加载至处理器。
本发明实施例通过采用对非易失性存储器执行分区加载保护,避免了非易失性存储器遭受到时序逻辑攻击,进一步达到更好的数据保护效果。
在一实施例中,所述第二保护信息进一步包括第二写保护信息,所述第二写保护信息用于指示每个所述存储分区以及写保护位存储区的各自的第二写保护的状态;
如图7所示,所述控制器120进一步包括第二写保护控制单元122,具体用于执行:
接收针对写保护位存储区或预设存储分区的写入请求;
判断所述写保护位存储区或预设存储分区的第二写保护的状态为使能或禁止;
若所述第二写保护的状态为使能,则基于预定条件将所述第二写保护的状态修改为禁止后执行写入操作,并在写入操作执行完毕后将所述第二写保护的状态修改为使能;以及
若所述第二写保护的状态为禁止,则直接向所述写保护位存储区或预设存储分区执行写入操作。
具体地,上述第二写保护为基于软件实现的可逆写保护。
具体地,上述第二写保护可以应用在多类存储分区,例如,对于安全需求等级较高且无需进行数据更改的存储分区,如密钥存储分区,本发明实施例通常在该存储分区的数据写入完毕后对其执行第一写保护,也即硬件永久写保护,但在数据写入完毕之前,为了防止可能产生的误操作,可以对其执行第二写保护。又例如,对于安全需求等级较高但需要经常更改数据的存储分区,本发明实施例可以对其执行第二写保护以满足需求。
此外,上述第二写保护可以对写保护位存储区执行写保护以防止误操作,进一步可以防止误执行对相应的存储分区的永久写保护。
进一步地,可以将预设的第二写保护信息存储于第二写保护寄存器,例如,该寄存器的第i位写保护位对应于第i存储分区,若该第i位写保护位为逻辑“1”(使能),当需要对该第i存储分区执行写入操作时,需要暂时先将第二写保护寄存器的第i位写保护位置“0”(禁止),而后可以对该第i存储分区执行写入操作,当上述写入操作完毕后,需要再次将第i位写保护位置“1”(使能)以恢复对该第i存储分区的第二写保护。
在一实施例中,想要执行上述对第二写保护寄存器的写保护位置“0”(禁止)的操作需要满足预设条件,该预设条件可以是写入主体满足预设的执行权限,可以是对预设的密钥完成解密,也可以不设定该预设条件,仅需发送指令以控制该写保护位置位,本发明实施例对此不进行限定。
值得注意的是,尽管此处可以将某一存储分区的第二写保护状态从“使能”更改为“禁止”,但若该存储分区的第一写保护的状态为“使能”,则该存储分区仍会一直保持被写保护的状态,也即,第二写保护只实际作用于未被执行 第一写保护的存储分区。
本发明实施例通过采用上述基于软件实现的第二写保护可以对存储分区的写保护状态进行更加灵活的设置,而且可以防止对写保护位存储区的误写入操作,进一步防止了对存储分区的误锁定。
以下结合图6具体描述本发明又一实施例。
具体地,所述多个存储分区至少可以包括密钥存储分区111_X与配置信息存储分区111_Y,密钥存储分区111_X用于存储处理器启动所需要的密钥;配置信息存储分区111_Y用于存储处理器启动所需要的配置信息,例如,jtag接口开关。
具体地,可以对密钥存储区111_X执行分阶段的保护。例如,在密钥写入完成前对所述密钥存储区111_X执行第二写保护;在密钥写入完成后通过对所述密钥存储区111_X执行第一保护;以及在启动后对所述密钥存储区执行加载保护
具体地,可以对配置信息存储分区111_Y执行分阶段的保护。例如,在配置信息写入完成前对所述配置信息存储分区111_Y执行第二写保护;在配置信息写入完成后对所述配置信息存储分区111_Y执行第一保护;以及在启动后对所述配置信息存储分区111_Y执行加载保护。
而对于其他的存储分区,同样可以根据其安全需求程度以及操作频率适应性地为其设置独立的保护机制,本发明以上述密钥存储分区以及配置信息存储分区为例进行描述但不限于此。
在一实施例中,在启动后可以对所述写保护位存储区112执行加载保护与第二写保护。
本发明实施例通过为安全需求较高且不需要更改数据的密钥存储分区与配置信息存储分区配置上述分阶段、多种类的安全保护机制,进一步避免了上述重要数据被误篡改或恶意篡改或恶意盗取。
在一实施例中,所述非易失性存储器的部分或全部为一次性可编程存储器(OTP存储器)。
本领域技术人员可以理解的是,OTP存储器的每一比特位在写入后不可再 进行擦除,因此,采用OTP存储器在一定程度上可以防止数据被改写。进一步地,对于写保护位存储区而言,采用OTP存储可以天然地实现第一写保护标识在“使能”不能再修改为“禁止”。
本发明实施例通过采用OTP存储器可以进一步保障数据安全。
综上,本发明实施例通过对非易失性存储器进行分区,并设置写保护位存储区对上述非易失性存储器中的存储分区进行分区执行的第一保护,以及对非易失性存储器进行分区的第二保护,可以对多个存储分区设置更为灵活且具有更高安全性的安全保护机制。
此外,尽管在附图中以特定顺序描述了本发明方法的操作,但是,这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。
虽然已经参考若干具体实施方式描述了本发明的精神和原理,但是应该理解,本发明并不限于所公开的具体实施方式,对各方面的划分也不意味着这些方面中的特征不能组合以进行受益,这种划分仅是为了表述的方便。本发明旨在涵盖所附权利要求的精神和范围内所包括的各种修改和等同布置。
工业应用性
采用本发明的非易失性存储器的分区保护方法及装置,具有以下有益效果:
本发明通过对非易失性存储器进行分区,并设置写保护位存储区对上述非易失性存储器中的存储分区进行分区执行的第一保护,以及对非易失性存储器进行分区的第二保护,可以对多个存储分区设置更为灵活且具有更高安全性的安全保护机制。

Claims (18)

  1. 一种非易失性存储器的分区保护方法,所述非易失性存储器至少包括多个存储分区以及写保护位存储区,其特征在于,所述分区保护方法包括:
    基于所述写保护位存储区中存储的第一保护信息对所述多个存储分区中的预设存储分区执行第一保护;
    基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护。
  2. 如权利要求1所述的分区保护方法,其特征在于,所述第一保护信息为具有多个写保护标识的第一写保护信息,所述多个写保护标识与所述多个存储分区一一对应,用于指示对应的存储分区的第一写保护状态。
  3. 如权利要求2所述的分区保护方法,其特征在于,所述基于所述写保护位存储区中存储的第一保护信息对所述多个存储分区中的预设存储分区执行第一保护包括:
    通过所述第一写保护标识判断对应的存储分区的第一写保护状态;
    通过将对应于所述第一写保护状态的一个或多个存储分区的写保护位置位以使能所述第一保护;
    其中,所述第一保护为基于硬件实现的永久写保护。
  4. 如权利要求1所述的分区保护方法,其特征在于,所述第二保护信息进一步包括加载保护信息,所述加载保护信息用于指示对每个存储分区以及写保护位存储区的加载保护的状态;
    以及所述基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护进一步包括:
    接收针对写保护位存储区或预设存储分区的加载请求;
    判断所述写保护位存储区或预设存储分区的加载保护的状态为使能或禁止;
    若所述加载保护的状态为使能,则拒绝加载所述写保护位存储区或预设存储分区;
    若所述加载保护的状态为禁止,则允许加载所述写保护位存储区或预设存储分区。
  5. 如权利要求4所述的分区保护方法,其特征在于,所述第二保护信息进一步包括第二写保护信息,所述第二写保护信息用于指示每个所述存储分区以及写保护位存储区的各自的第二写保护的状态;
    以及所述基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护进一步包括:
    接收针对写保护位存储区或预设存储分区的写入请求;
    判断所述写保护位存储区或预设存储分区的第二写保护的状态为使能或禁止;
    若所述第二写保护的状态为使能,则先将所述第二写保护的状态修改为禁止后执行写入操作,并在写入操作执行完毕后将所述第二写保护的状态修改为使能;以及
    若所述第二写保护的状态为禁止,则直接向所述写保护位存储区或预设存储分区执行写入操作;
    其中,所述第二写保护为基于软件实现的可逆写保护。
  6. 根据权利要求5所述的分区保护方法,其特征在于,所述多个存储分区至少包括密钥存储分区,用于存储处理器启动所需要的密钥;其中,
    在密钥写入完成前对所述密钥存储区执行第二写保护;
    在密钥写入完成后通过对所述密钥存储区执行第一保护;以及
    在启动后对所述密钥存储区执行加载保护。
  7. 根据权利要求5所述的分区保护方法,其特征在于,所述多个存储分区至少包括配置信息存储分区,用于存储处理器启动所需要的配置信息;其中,
    在配置信息写入完成前对所述配置信息存储分区执行第二写保护;
    在配置信息写入完成后对所述配置信息存储分区执行第一保护;以及
    在启动后对所述配置信息存储分区执行加载保护。
  8. 根据权利要求1所述的分区保护方法,其特征在于,所述方法还包括:
    在启动后对所述写保护位存储区执行第二保护。
  9. 根据权利要求1~8所述的分区保护方法,其特征在于,所述非易失性存储器的部分或全部为一次性可编程存储器。
  10. 一种非易失性存储器的分区保护装置,其特征在于,所述分区保护装置包括:
    所述非易失性存储器至少包括多个存储分区以及写保护位存储区,
    所述写保护位存储区用于存储第一保护信息,以及基于所述第一保护信息对所述多个存储分区中的预设存储分区执行第一保护;
    控制器,用于基于预设的第二保护信息对所述写保护位存储区和/或所述预设存储分区执行第二保护。
  11. 如权利要求10所述的分区保护装置,其特征在于,所述第一保护信息为具有多个写保护标识的第一写保护信息,所述多个写保护标识与所述多个存储分区一一对应,用于指示对应的存储分区的第一写保护状态。
  12. 如权利要求11所述的分区保护装置,其特征在于,所述基于所述第一保护信息对所述多个存储分区中的预设存储分区执行第一保护包括:
    通过所述第一写保护标识判断对应的存储分区的第一写保护状态;
    通过将对应于所述第一写保护状态的一个或多个存储分区的写保护位置位以使能所述第一保护;
    其中,所述第一保护为基于硬件实现的永久写保护。
  13. 如权利要求10所述的分区保护装置,其特征在于,所述第二保护信息进一步包括加载保护信息,所述加载保护信息用于指示对每个存储分区以及写保护位存储区的各自的加载保护的状态;
    以及所述控制器进一步包括加载控制单元,用于:
    接收针对写保护位存储区或预设存储分区的加载请求;
    判断所述写保护位存储区或预设存储分区的加载保护的状态为使能或禁止;
    若所述加载保护的状态为使能,则拒绝加载所述写保护位存储区或预设存储分区;
    若所述加载保护的状态为禁止,则允许加载所述写保护位存储区或预设存储分区。
  14. 如权利要求13所述的存储器,其特征在于,所述第二保护信息进一步包括第二写保护信息,所述第二写保护信息用于指示每个所述存储分区以及写保护位存储区的各自的第二写保护的状态;
    以及所述控制器进一步包括第二写保护控制单元,用于:
    接收针对写保护位存储区或预设存储分区的写入请求;
    判断所述写保护位存储区或预设存储分区的第二写保护的状态为使能或禁止;
    若所述第二写保护的状态为使能,则先将所述第二写保护的状态修改为禁止后执行写入操作,并在写入操作执行完毕后将所述第二写保护的状态修改为使能;以及
    若所述第二写保护的状态为禁止,则直接向所述写保护位存储区或预设存储分区执行写入操作;
    其中,所述第二写保护为基于软件实现的可逆写保护。
  15. 根据权利要求14所述的分区保护装置,其特征在于,所述多个存储分区至少包括密钥存储分区,用于存储处理器启动所需要的密钥;其中,
    在密钥写入完成前对所述密钥存储区执行第二写保护;
    在密钥写入完成后通过对所述密钥存储区执行第一保护;以及
    在启动后对所述密钥存储区执行加载保护。
  16. 根据权利要求14所述的分区保护装置,其特征在于,所述多个存储分区至少包括配置信息存储分区,用于存储处理器启动所需要的配置信息;其中,
    在配置信息写入完成前对所述配置信息存储分区执行第二写保护;
    在配置信息写入完成后对所述配置信息存储分区执行第一保护;以及
    在启动后对所述配置信息存储分区执行加载保护。
  17. 根据权利要求10所述的分区保护装置,其特征在于,所述控制器还用于:
    在启动后对所述写保护位存储区执行第二保护。
  18. 根据权利要求10~17所述的分区保护装置,其特征在于,所述非易失性存储器的部分或全部为一次性可编程存储器。
PCT/CN2019/109134 2018-09-29 2019-09-29 一种非易失性存储器的分区保护方法及装置 WO2020063975A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811149772.6A CN110968254A (zh) 2018-09-29 2018-09-29 一种非易失性存储器的分区保护方法及装置
CN201811149772.6 2018-09-29

Publications (1)

Publication Number Publication Date
WO2020063975A1 true WO2020063975A1 (zh) 2020-04-02

Family

ID=69951075

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/109134 WO2020063975A1 (zh) 2018-09-29 2019-09-29 一种非易失性存储器的分区保护方法及装置

Country Status (2)

Country Link
CN (1) CN110968254A (zh)
WO (1) WO2020063975A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112233716A (zh) * 2020-09-27 2021-01-15 加特兰微电子科技(上海)有限公司 存储器、存储装置、集成电路、无线电器件和设备
CN112507402A (zh) * 2021-02-09 2021-03-16 北京紫光青藤微系统有限公司 Flash存储器读保护处理方法及装置
CN115577401A (zh) * 2022-11-08 2023-01-06 苏州萨沙迈半导体有限公司 闪存数据保护装置、系统以及闪存存储器
CN116795299A (zh) * 2023-08-28 2023-09-22 苏州萨沙迈半导体有限公司 只读存储器的模拟系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191562A1 (en) * 2010-02-02 2011-08-04 Broadcom Corporation Apparatus and method for partitioning, sandboxing and protecting external memories
CN103793334A (zh) * 2014-01-14 2014-05-14 上海上讯信息技术股份有限公司 基于移动存储设备的数据保护方法及移动存储设备
CN106372498A (zh) * 2016-09-05 2017-02-01 杭州华三通信技术有限公司 一种软件保护的方法和装置
CN107832637A (zh) * 2017-11-20 2018-03-23 丹东瑞银科技有限公司 Emmc及emmc的分区写保护方法

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1223406A (zh) * 1998-12-12 1999-07-21 林光荣 计算机硬件控制分区存储保护技术
WO2006040798A1 (ja) * 2004-10-08 2006-04-20 Renesas Technology Corp. 半導体集積回路装置および電子システム
CN101661796B (zh) * 2008-08-25 2012-02-29 北京兆易创新科技有限公司 一种非易失性存储器及其数据保护方法
CN101788958A (zh) * 2010-02-04 2010-07-28 杭州晟元芯片技术有限公司 一种存储器数据保护的方法
US9697358B2 (en) * 2013-06-13 2017-07-04 Google Inc. Non-volatile memory operations
CN104951405B (zh) * 2014-03-28 2019-09-06 三星电子株式会社 存储系统以及对存储系统执行和验证写保护的方法
CN104615953B (zh) * 2015-02-10 2018-01-09 复旦大学 一种配置数据流安全性高的可编程逻辑器
CN106295414B (zh) * 2016-08-09 2020-05-12 复旦大学 带分区写保护和保护位置乱处理的非挥发存储器及其写操作方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191562A1 (en) * 2010-02-02 2011-08-04 Broadcom Corporation Apparatus and method for partitioning, sandboxing and protecting external memories
CN103793334A (zh) * 2014-01-14 2014-05-14 上海上讯信息技术股份有限公司 基于移动存储设备的数据保护方法及移动存储设备
CN106372498A (zh) * 2016-09-05 2017-02-01 杭州华三通信技术有限公司 一种软件保护的方法和装置
CN107832637A (zh) * 2017-11-20 2018-03-23 丹东瑞银科技有限公司 Emmc及emmc的分区写保护方法

Also Published As

Publication number Publication date
CN110968254A (zh) 2020-04-07

Similar Documents

Publication Publication Date Title
US10324864B2 (en) Storage system and method for performing and authenticating write-protection thereof
US11615035B2 (en) Storage system and method for performing and authenticating write-protection thereof
WO2020063975A1 (zh) 一种非易失性存储器的分区保护方法及装置
JP4925422B2 (ja) データ処理装置内コンテンツへのアクセス管理
JP6306578B2 (ja) メモリ保護装置及び保護方法
CN110457236B (zh) 存储系统以及对存储系统执行和验证写保护的方法
US7953913B2 (en) Peripheral device locking mechanism
US10354073B2 (en) Information processor device verifying software and method of controlling information processor device
JP5911835B2 (ja) 情報処理装置
JP2001356963A (ja) 半導体装置およびその制御装置
US11143701B2 (en) Method for managing a return of a product for analysis and corresponding product
CN110020561B (zh) 半导体装置和操作半导体装置的方法
US10885196B2 (en) Executing protected code
US20210200876A1 (en) Computer apparatus and authority management method based on trust chain
US20050055530A1 (en) Method and apparatus for protecting a specific memory section
WO2018040678A1 (zh) 一种存储器数据保护方法、集成电路芯片及存储介质
CN110569205A (zh) 安全系统单芯片及其操作方法

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: 19866370

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: 19866370

Country of ref document: EP

Kind code of ref document: A1