Memory information protection method and device, equipment and storage medium
By setting the protection switch bit and preset password in the memory, the number of times the incorrect password is input, and the memory is locked when the set number is reached, the problem of protection information leakage and error operation failure in the prior art is solved, and the memory is improved Confidentiality and security.
Patent Information
- Application Number
- CN202310546677.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-11-15
AI Technical Summary
Existing memory protection technology still allows access to memory when the protection password is incorrect, resulting in poor confidentiality and information leakage, and bad software can crack password protection through unlimited password attacks.
By setting the protection switch bit and the preset password in the memory, the number of times the wrong password is input is limited, and the memory is locked when the set number is reached, preventing access and overwriting of protection information.
Effectively prevent protection information leakage, improve memory confidentiality and security, avoid write operation failures caused by misoperation, and provide fault tolerance opportunities for incorrect password input.
Smart Images

Figure CN118964237A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of memory technology, and in particular to a memory information protection method, device, computer equipment, and computer-readable storage medium. Background Art
[0002] In the field of memory technology, in order to meet the user's application requirements for memory security, the memory needs to be protected to prevent others from performing write operations and read operations on the memory.
[0003] In the related art, a protection password is set to protect the memory, and when the protection password is correct, write and read operations on the memory are allowed. However, when the protection password is incorrect, the memory can still be accessed, resulting in poor confidentiality of the memory and easy information leakage. Summary of the invention
[0004] The purpose of the present disclosure is to provide a memory information protection method, device, equipment and storage medium, which can improve the confidentiality of the memory and prevent information from being leaked.
[0005] An embodiment of the present disclosure provides a method for protecting memory information, wherein the memory includes a memory array, the memory array includes a function configuration storage area and a protection information storage area, the function configuration storage area is not allowed to be rewritten, a protection switch bit is set in the function configuration storage area, and the protection information storage area stores protection information. The method includes: when the protection switch bit is enabled, performing the following operations: receiving an i-th protection information rewrite password, where i is a positive integer; when the i-th protection information rewrite password is inconsistent with a preset password and i is less than a set number of times, receiving an i+1-th protection information rewrite password; when the i+1-th protection information rewrite password is inconsistent with the preset password and i+1 is equal to the set number of times, locking the memory so that the memory cannot be accessed and the protection information cannot be rewritten.
[0006] In some exemplary embodiments of the present disclosure, the memory also includes a status register, and the status register includes a read operation protection bit; when the protection switch bit is enabled and turned on, the method also includes: when the i+1th protection information rewrite password verification error occurs and i+1 is less than the set number of times, allowing the protection information to be rewritten; when allowing the protection information to be rewritten, determining whether the read operation protection bit is valid; if valid, allowing access to part of the protection information storage area; if invalid, allowing access to the entire protection information storage area.
[0007] In some exemplary embodiments of the present disclosure, after receiving the i-th protection information rewrite password, the method further includes: when the i-th protection information rewrite password is consistent with a preset password and i is less than or equal to a set number of times, allowing access to the protection information storage area and rewriting of the protection information.
[0008] In some exemplary embodiments of the present disclosure, when the protection switch bit is enabled and turned on, the method further includes: when the i+1th protection information rewrite password verification error occurs and i+1 is less than the set number of times, rewriting of the protection information is not allowed; when rewriting of the protection information is not allowed, determining whether the read operation protection bit is valid; if valid, allowing access to part of the protection information storage area; if invalid, allowing access to the entire protection information storage area.
[0009] In some exemplary embodiments of the present disclosure, the method further comprises: when the protection switch bit is enabled to be turned off, allowing access to the memory and rewriting of the protection information.
[0010] In some exemplary embodiments of the present disclosure, the method further comprises: when the memory is powered on again, resetting i to 1.
[0011] In some exemplary embodiments of the present disclosure, the partial area of the protection information storage area is a 2MB area starting with a minimum address in the protection information storage area.
[0012] According to another aspect of the present disclosure, there is provided an information protection device for a memory, wherein the memory includes a storage array, the storage array includes a function configuration storage area and a protection information storage area, the function configuration storage area is not allowed to be rewritten, a protection switch bit is set in the function configuration storage area, and the protection information storage area stores protection information, and the device includes: a receiving module and a locking module. When the protection switch bit is enabled, the following operations are performed: the receiving module is used to receive the i-th protection information rewrite password, i is a positive integer; the receiving module is also used to receive the i+1-th protection information rewrite password when the i-th protection information rewrite password is inconsistent with the preset password and i is less than the set number of times; the locking module is used to lock the memory when the i+1-th protection information rewrite password is inconsistent with the preset password and i+1 is equal to the set number of times, so that the memory cannot be accessed and the protection information cannot be rewritten.
[0013] According to another aspect of the present disclosure, a computer device is provided, comprising one or more processors; and a memory configured to store one or more programs, so that when the one or more programs are executed by the one or more processors, the computer device implements the memory information protection method in any embodiment of the present disclosure.
[0014] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the memory information protection method in any embodiment of the present disclosure.
[0015] According to another aspect of the present disclosure, a computer program product is provided. When the computer program is executed by a processor, the memory information protection method in any embodiment of the present disclosure is implemented.
[0016] The memory information protection method, device, equipment and storage medium provided by the embodiments of the present disclosure, when the protection switch is enabled and turned on, performs the following operations: receiving the i-th protection information rewrite password, i is a positive integer; when the i-th protection information rewrite password is inconsistent with the preset password, and i is less than the set number of times, receiving the i+1-th protection information rewrite password; when the i+1-th protection information rewrite password is inconsistent with the preset password, and i+1 is equal to the set number of times, locking the memory so that the memory cannot be accessed and the protection information cannot be rewritten. The present disclosure locks the memory when the number of times the protection information rewrite password is input is equal to the set number of times, and the protection information rewrite password is inconsistent with the preset password, so that the memory cannot be accessed and the protection information stored on the memory cannot be rewritten. This can prevent the leakage of protection information and improve the confidentiality and security of the memory.
[0017] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0019] Figure 1 A schematic diagram showing a memory information protection system according to an embodiment of the present disclosure is shown;
[0020] Figure 2 A flow chart of a method for protecting memory information in an embodiment of the present disclosure is shown;
[0021] Figure 3 A functional block diagram of a status register in an embodiment of the present disclosure is shown;
[0022] Figure 4 A schematic diagram of a memory information protection device according to an embodiment of the present disclosure is shown;
[0023] Figure 5 A schematic diagram showing the structure of a computer device in an embodiment of the present disclosure is shown;
[0024] Figure 6 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0025] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0026] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0028] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more", where "plurality" refers to two or more.
[0030] The present disclosure is described by taking the application of a non-volatile memory to a memory of a basic input / output system of a computer system as an example, but is not limited thereto.
[0031] The memory is a memory component used to store programs and various data information. In the field of memory technology, in order to meet the user's application requirements for memory security, the memory needs to be protected to prevent others from writing and reading the memory.
[0032] In the related art, a protection password is set to protect the memory, and when the protection password is correct, write and read operations on the memory are allowed. However, when the protection password is incorrect, the memory can still be accessed, resulting in poor confidentiality of the memory and easy information leakage.
[0033] The inventors have found that even if a protection password is set for the memory, it can still lead to the leakage of protection information. For example, bad software can crack the password protection of the memory through unlimited password attacks, resulting in the leakage of protection information. For another example, hackers steal the protection information stored on the memory by invading the memory. Even if the protection password entered is wrong, they can still access the memory (perform a read operation), resulting in the leakage of protection information stored on the memory. In other words, the protection password can only protect the write operation, but not the reading of the protection information. In addition, the inventors also found that due to the user's mistaken input of the wrong protection password, the write operation cannot be performed, which in turn affects the user's normal use of the memory.
[0034] Based on this, the embodiments of the present disclosure provide a memory information protection method, device, equipment and storage medium, which can be applied in the field of memory technology, and exemplarily, can be applied to specific scenarios of memory information protection. The present disclosure discloses that when the number of times the protection information rewrite password is input is equal to the set number, and the protection information rewrite password is inconsistent with the preset password, that is, the protection information rewrite password is input a predetermined number of times, and each input protection information rewrite password is incorrect. Since the protection information rewrite password input the predetermined number of times is incorrect, the memory is locked, so that the protection information on the memory and the protection information stored on the memory cannot be accessed and rewritten. The present disclosure can prevent the leakage of protection information and improve the confidentiality and security of the memory. In addition, by setting the set number of times, the present disclosure can allow the user to enter multiple wrong protection information rewrite passwords, thereby solving the problem of being unable to perform write operations due to the wrong protection information rewrite password (protection password) input by mistake.
[0035] In order to facilitate the overall understanding of the technical solution provided by the embodiment of the present disclosure, the memory information protection system provided by the embodiment of the present disclosure is described below. Figure 1As shown, the memory information protection system 10 may include a write control logic (Write Control Logic) 11, a command & control logic (Command & Control Logic) 12, a status register (Status Register) 13 and a storage area 14.
[0036] The command & control logic 12 can be connected to an electronic device through an external signal interface, and the electronic device includes but is not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, a wearable device, an augmented reality device, a virtual reality device, etc. The present disclosure can input a protection information rewrite password through an electronic device. Exemplarily, an input device is connected to the electronic device, and the protection information rewrite password can be input through an input device such as a mouse, a keyboard, etc., and the protection information rewrite password can also be input through other devices that communicate with the electronic device. For example, the protection information rewrite password is input to the electronic device through a computer that communicates with the electronic device. The communication method between the electronic device and the computer can adopt a wireless network or a wired network.
[0037] The wireless network or wired network described above uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or any combination of a virtual private network). In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.
[0038] The instruction & control logic 12 can verify whether the input protection information rewrite password is correct, and a preset password is stored on the instruction & control logic 12. When the protection information rewrite password is consistent with the preset password, it means that the protection information rewrite password is the correct password and the verification is successful. On the contrary, when the protection information rewrite password is inconsistent with the preset password, it means that the protection information rewrite password is an incorrect password and the verification fails. When the protection information rewrite password is the correct password, the write control logic 11 is allowed to rewrite the value on the status register 13, so that the memory is in a state where the protection information is allowed to be rewritten, that is, the memory is not locked. When the protection information rewrite password is an incorrect password, the value on the status register 13 is kept unchanged, so that the memory is in a state where the protection information is not allowed to be rewritten, that is, the memory is locked. The instruction & control logic 12 can also count the number of times the protection information rewrite password is input, and compare the number of times the protection information rewrite password is input within a period of time with the set number of times. When the number of times the protection information rewrite password is input is less than the set number of times, the memory can be accessed.
[0039] It should be noted that the storage area 14 may be a storage array on a memory for storing protection information and function configuration information. The instruction & control logic 12 may be an instruction & control logic of a serial peripheral interface (SPI), and the instruction & control logic 12 may be a controller or a logic circuit, but the present disclosure is not limited thereto, and any device that can achieve the above functions may be used.
[0040] A method for protecting memory information is provided in an embodiment of the present disclosure. The method can be executed by any processing device with information protection capability. Exemplarily, the processing device with information protection capability can be a memory.
[0041] Figure 2 A flow chart of a memory information protection method in an embodiment of the present disclosure is shown. The memory may include a storage array. The storage array may include a function configuration storage area and a protection information storage area. The function configuration storage area is not allowed to be rewritten. A protection switch bit is set in the function configuration storage area. The protection information storage area stores protection information, such as Figure 2 As shown, the memory information protection method provided in the embodiment of the present disclosure may include executing the following S201 to S203 when the protection switch bit is enabled and turned on.
[0042] S201, receiving the i-th protection information rewriting password, where i is a positive integer.
[0043] The protection information rewrite password is a password input into the memory through an external electronic device, and the password is used to indicate whether the protection information stored in the memory can be rewritten. The protection information rewrite password may include one or more forms of text, letters, numbers, symbols, etc., and the specific form of the protection information rewrite password is not limited in the embodiments of the present disclosure.
[0044] The i-th protection information rewrite password may be the i-th protection information rewrite password input into the memory. The protection information rewrite password may be counted cumulatively from the first input. The i-th protection information rewrite password is the i-th protection information rewrite password input into the memory.
[0045] The i-th protection information rewrite password can also be the i-th protection information rewrite password input into the memory within a set time period, and the present disclosure does not limit the predetermined time period. For example, the predetermined time period can be 1 hour, or 6 hours. The time when the predetermined time period starts can be the time when the protection information rewrite password is first input. For example, if the predetermined time period is 1 hour, and the time when the protection information rewrite password is first input is 12:00, the i-th protection information rewrite password is the i-th protection information rewrite password input into the memory between 12:00 and 13:00, and the present disclosure is not limited to this.
[0046] S202 , when the i-th protection information rewriting password is inconsistent with the preset password and i is less than the set number of times, receiving the i+1-th protection information rewriting password.
[0047] The preset password may be a password stored in advance in the memory, and is used to determine whether the input protection information rewrite password is correct. The preset password may include one or more forms of text, letters, numbers, symbols, etc., and the specific form of the preset password is not limited in the embodiments of the present disclosure. If the protection information rewrite password is inconsistent with the preset password, it means that the input protection information rewrite password is wrong. If the protection information rewrite password is consistent with the preset password, it means that the input protection information rewrite password is correct.
[0048] The setting number of times may be a preset value. The present disclosure does not limit the specific value of the setting number of times, and it may be set according to specific application scenarios and experience. The setting number of times is a positive integer. Exemplarily, the setting number of times may be any value from 1 to 50. For example, the setting number of times may be any value from 2, 5, 10, and 20. It should be noted that, considering the actual application needs, the setting number of times is generally less than or equal to 20.
[0049] When the number of times the protection information rewrite password is input is less than the set number of times, and the input protection information rewrite password is inconsistent with the preset password, the next input protection information rewrite password (i+1th protection information rewrite password) can be received. For example, assuming that the set number of times is 20, and the first input protection information rewrite password is inconsistent with the preset password, since 1 is less than 20 and the protection information rewrite password is inconsistent with the preset password, the second input protection information rewrite password can be received.
[0050] In the embodiment of the present disclosure, by setting a set number of times, it is possible to prevent unlimited password attacks by bad software. When the number of password attacks by bad software reaches the set number of times, the memory is locked, which can effectively prevent the leakage of protection information and improve the confidentiality and security of the memory. It should be noted that when the number of password attacks by bad software reaches the set number of times, the present disclosure can output in the form of an alarm, for example, a buzzer, an indicator light, a prompt box, etc., to alert the malicious attack of the bad software.
[0051] S203, when the i+1th protection information rewriting password is inconsistent with the preset password and i+1 is equal to the set number of times, the memory is locked to prevent the memory from being accessed and the protection information from being rewritten.
[0052] The memory is locked, that is, the memory cannot be accessed and the protection information cannot be overwritten.
[0053] The following two examples illustrate how to lock the memory.
[0054] Exemplarily, the memory includes a plurality of status registers. Figure 3 As shown, the memory includes a status register 1 (SR1) and a status register 2 (SR2), and multiple protection bits are set on the status register 1 and the status register 2. One of the multiple protection bits of the status register 1 is a block protection bit SRP0 (status register protection bit, SRP). For example, when the value of SRP0 is 1, the regional protection code (BP2, BP1 and BP0) on the status register 1 cannot be rewritten. It should be noted that different regional protection codes correspond to different storage areas in the storage area 14. For example, when the values of BP2, BP1 and BP0 are 000, they correspond to storage area 0; when the values of BP2, BP1 and BP0 are 001, they correspond to storage area 1. Assume that the values of BP2, BP1 and BP0 are 000, and the value of SRP0 is 1. Accordingly, the protection information stored in the storage area 0 cannot be rewritten or accessed.
[0055] In order to further protect the status register 1, a protection bit can be set as register protection bit SRP1 among multiple protection bits of status register 2. When the value of SRP1 is 1, any protection bit in status register 1 cannot be rewritten, that is, when SRP1=1, the value of SRP0 in status register 1 cannot be rewritten. In other words, when the values of SRP1 and SRP0 are both 1, the memory is locked.
[0056] Exemplarily, if the number of failures reaches the set number and there is no successful match (the i+1th protection information rewrite password is inconsistent with the preset password, and i+1 is equal to the set number of times), then the memory is locked, and cannot be decoded normally when the instruction & control logic (also known as the SPI_command control decoding module) controls the read, write, erase and decode, cannot compile instructions, cannot write and read any area of the memory, and cannot rewrite the memory protection information. The present disclosure is not limited to this.
[0057] In the disclosed embodiment, when the i+1th protection information rewrite password is inconsistent with the preset password and i+1 is equal to the set number of times, the values of SRP1 and SRP0 in the status register are kept unchanged at 11, or, the instruction & control logic cannot decode normally when controlling the read, write, erase and decode, thereby locking the memory so that the memory cannot be accessed and the protection information cannot be rewritten.
[0058] The present disclosure locks the memory when the number of times the protection information rewrite password is input is equal to the set number of times, and the protection information rewrite password is inconsistent with the preset password, so that the memory cannot be accessed and the protection information stored in the memory cannot be rewritten. This can prevent the leakage of protection information and improve the confidentiality and security of the memory.
[0059] Furthermore, the present disclosure provides a certain error tolerance opportunity for the user to input the protection information rewriting password by setting a set number of times, thereby avoiding the memory being locked due to the user mistakenly inputting the wrong protection information rewriting password.
[0060] In an exemplary embodiment, the memory may further include a status register, and the status register may include a read operation protection bit. When the protection switch bit is enabled and turned on, the memory information protection method may further include: when the i+1th protection information rewrite password verification error occurs, and i+1 is less than the set number of times, allowing the protection information to be rewritten; when the protection information is allowed to be rewritten, judging whether the read operation protection bit is valid; if valid, allowing access to part of the protection information storage area; if invalid, allowing access to the entire protection information storage area.
[0061] Regarding the protection switch bit enable, the memory may include a storage array, and the storage array may include a function configuration storage area and a protection information storage area. The protection information storage area is used to store protection information. The function configuration storage area is used to store function configuration information, and the function configuration information is burned into the memory when it leaves the factory and cannot be changed. That is to say, the function configuration storage area is not allowed to be overwritten. A protection switch bit is set in the function configuration storage area, and the value of the protection switch bit is burned into the factory. For example, if the value of the protection switch bit is burned into 0 at the factory, the protection switch bit enable is turned on. If the value of the protection switch bit is burned into 1 at the factory, the protection switch bit enable is turned off.
[0062] The operation instructions that allow the protection information to be rewritten may include a program operation and an erase operation, and the program operation and the erase operation may be collectively referred to as a write operation. When the number of times the protection information rewrite password is input is less than the set number of times, a write operation can be performed on the memory, that is, as long as the number of times the protection information rewrite password is input is less than the set number of times, a write operation can be performed on the memory. Regarding how to implement the above functions, the present disclosure does not limit. For example, when the number of times the protection information rewrite password is input is less than the set number of times, the values of SRP1 and SRP0 are rewritten, and the values of SRP1 and SRP0 are rewritten to 00. It should be noted that the values of SRP1 and SRP0 are 00, and a write operation can be performed on the memory. By rewriting the value on the regional protection code, the storage area (protection information storage area) in a protected state is placed in a non-protected state, and the protection information stored in the storage area is rewritten. For another example, if the number of failures does not reach the set number and the match is not successful, the instruction & control logic sends a verification failure signal, and the instruction & control logic controls the normal decoding during the read-write-erase decoding, and compiles the instruction to perform a write operation on any area of the memory. The present disclosure is not limited to this.
[0063] Regarding the read operation protection bit, the read operation protection bit is used to indicate whether the memory can be read (read operation). For example, the read operation protection bit can be a protection bit on the status register. Figure 3As shown, the pwd corresponding to the protection bit S10 is a read operation protection bit. When the value of the read operation protection bit is 1, the read operation protection bit is valid, allowing access to a portion of the protection information storage area. Exemplarily, the portion of the protection information storage area is a 2 megabyte (MB) area starting with the minimum address in the protection information storage area. If the protection information storage area includes a 1024MB storage space, the storage space is address-encoded in bytes, the minimum address of the address coding is 0, and the storage space corresponding to the address coding 0 to 2048000 is a 2MB area starting with the minimum address in the protection information storage area. When the value of the read operation protection bit is 0, the read operation protection bit is invalid, allowing access to the entire area of the protection information storage area.
[0064] In the case where the number of failures does not reach the set number and no successful match has occurred, the disclosed embodiment can perform write and read operations on the memory, giving the user a certain fault tolerance opportunity to input protection information to rewrite the password, thereby avoiding the memory being locked due to the user mistakenly inputting the wrong protection information to rewrite the password.
[0065] In another exemplary embodiment, when the protection switch bit is enabled and turned on, the memory information protection method may also include: when the i+1th protection information rewrite password verification error occurs and i+1 is less than the set number of times, rewriting of the protection information is not allowed; when rewriting of the protection information is not allowed, determining whether the read operation protection bit is valid; if valid, allowing access to part of the protection information storage area; if invalid, allowing access to the entire protection information storage area.
[0066] How to enable the protection switch bit to be turned on has been explained in the above exemplary embodiment and will not be repeated here. In the case where the i+1th protection information rewrite password verification error and i+1 is less than the set number of times, rewriting of the protection information is not allowed. In other words, the number of failures has not reached the set number of times and has not been successfully matched, and writing operations to the memory are not allowed. In other words, as long as the number of times the protection information rewrite password is entered is less than the set number of times, writing operations to the memory are not allowed. Regarding how to implement the above functions, the present disclosure does not limit. For example, when the number of times the protection information rewrite password is entered is less than the set number of times, the values of SRP1 and SRP0 remain unchanged at 11. It should be noted that when the values of SRP1 and SRP0 are 11, writing operations to the memory are not allowed. Rewriting the value on the regional protection code is not allowed, so that the storage area in a protected state (protection information storage area) is in a protected state, and the protection information stored in the storage area cannot be rewritten. For another example, if the number of failures does not reach the set number and the match is not successful, the memory is locked, and the command & control logic (also known as the SPI_command control decoding module) cannot decode normally when controlling the read, write, erase and decode, cannot compile instructions, cannot write and read any area of the memory, and cannot rewrite the memory protection information. The present disclosure is not limited to this.
[0067] Regarding the read operation protection bit, the read operation protection bit is used to indicate whether the memory can be read (read operation). For example, the read operation protection bit can be a protection bit on the status register. Figure 3 As shown, the pwd corresponding to the protection bit S10 is a read operation protection bit. When the value of the read operation protection bit is 1, the read operation protection bit is valid, allowing access to a portion of the protection information storage area. Exemplarily, the portion of the protection information storage area is a 2 megabyte (MB) area starting with the minimum address in the protection information storage area. When the value of the read operation protection bit is 0, the read operation protection bit is invalid, allowing access to the entire area of the protection information storage area.
[0068] In the embodiment of the present disclosure, when the number of failures does not reach the set number and the match is not successful, the memory cannot be written, but the memory can be read. Compared with the case where the protection information is input and the password is rewritten and verified to be correct, when the number of failures does not reach the set number and the match is not successful, the present disclosure further protects the memory, that is, only access is allowed, and rewriting is not allowed.
[0069] The present disclosure is a memory protection mechanism. When the protection switch is enabled (also known as password mode), if the number of failures when the user enters the protection information to rewrite the password reaches or does not reach the set number of times, the memory will be protected to different degrees. After the number of failures is reached, the protection level is higher and the memory cannot be accessed or rewritten.
[0070] In another exemplary embodiment, after receiving the i-th protection information rewrite password, the memory information protection method may further include: when the i-th protection information rewrite password is consistent with a preset password and i is less than or equal to a set number of times, allowing access to the protection information storage area and rewriting of the protection information.
[0071] The i-th protection information rewrite password is consistent with the preset password, and i is less than or equal to the set number of times, that is, the correct protection information rewrite password is entered within the preset number of times, and the memory is allowed to be written and read. Entering the correct protection information rewrite password within the preset number of times includes two situations, the first situation is that the number of failures does not reach the set number of times and the match is successful, and the second situation is that the protection information rewrite password entered for the first time is the correct password (matching is successful).
[0072] If the protection information rewrite password entered within the predetermined number of times is consistent with the preset password, it means that the protection information rewrite password verification is successful. Access to the protection information storage area and rewriting of the protection information are allowed. For example, if the correct protection information rewrite password is entered within the predetermined number of times, write operations and read operations on the memory are allowed. Exemplarily, the values of SRP1 and SRP0 are rewritten, and the values of SRP1 and SRP0 can be rewritten from 11 or 01 to 00. It should be noted that when the values of SRP1 and SRP0 are 00, the memory can be written. When the values of SRP1 and SRP0 are rewritten to 11, the memory cannot be written. Exemplarily, when the values of SRP1 and SRP0 are 11, the status register cannot be rewritten, and then the area protection code corresponding to the protection information storage area cannot be modified, and the protection information stored in the protection information storage area cannot be modified. The values of SRP1 and SRP0 are rewritten to 01, and the protection information cannot be directly written through the rewrite instruction, which is equivalent to not being able to write to the memory. For another example, if the correct protection information rewrite password is entered within a predetermined number of times, the instruction & control logic sends a verification success signal, and the instruction & control logic controls the normal decoding during the read-write-erase decoding, and compiles the instruction to perform a write operation on any area of the memory. The present disclosure is not limited to this.
[0073] The present invention rewrites or accesses the memory by ensuring that the protection information rewriting password entered within a predetermined number of times is consistent with the preset password, which is convenient for users to use and can also prevent the protection information from being leaked, thereby improving the confidentiality and security of the memory.
[0074] In yet another exemplary embodiment, the memory information protection method may further include: resetting i to 1 when the memory is powered on again.
[0075] It should be noted that if the number of times the protection information modification password is entered exceeds the set number, the user can initialize or restart the memory or the device where the memory is located, so as to reset the number of times the protection information modification password is entered, that is, i = 1. For example, restarting the computer or restarting the computer after power failure, etc., but the present disclosure is not limited thereto.
[0076] The disclosed embodiment can reset the number of times the protection information modification password is entered by powering on again, thereby further providing the user with a certain error tolerance opportunity when entering the protection information rewrite password, thereby avoiding the memory being locked due to the user mistakenly entering the wrong protection information rewrite password.
[0077] In yet another exemplary embodiment, the memory information protection method may further include: in a case where the protection switch bit enable is turned off, allowing access to the memory and rewriting of the protection information.
[0078] How to enable the protection switch bit has been described in the above exemplary embodiment and will not be repeated here. When the protection switch bit is enabled to be turned off, access to the memory and rewriting of protection information are allowed, that is, when the protection switch bit is enabled to be turned off, the password mode is not entered, but the normal mode is entered, and the memory can be written and read in the normal mode.
[0079] The disclosed embodiment provides more working modes for the memory by setting the protection switch bit. Different working modes are selected by applying the memory to different scenarios. For example, when there is a requirement to protect the confidentiality of information, the password mode is used. When there is no requirement to protect the information, the normal mode is used. By setting the two modes, the application scope of the memory is increased.
[0080] Based on the same inventive concept, the present disclosure also provides a memory information protection device, as described in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0081] Figure 4 A schematic diagram of a memory information protection device in an embodiment of the present disclosure is shown, wherein the memory includes a storage array, the storage array includes a function configuration storage area and a protection information storage area, the function configuration storage area is not allowed to be rewritten, a protection switch bit is set in the function configuration storage area, and the protection information storage area stores protection information, such as Figure 4As shown, the device may include a receiving module 41 and a locking module 42, and when the protection switch is enabled and turned on, the following operations are performed: the receiving module 41 can be used to receive the i-th protection information rewrite password, where i is a positive integer; the receiving module 41 can also be used to receive the i+1-th protection information rewrite password when the i-th protection information rewrite password is inconsistent with the preset password and i is less than the set number of times; the locking module 42 can be used to lock the memory when the i+1-th protection information rewrite password is inconsistent with the preset password and i+1 is equal to the set number of times, so that the memory cannot be accessed and the protection information cannot be rewritten.
[0082] In one embodiment, the memory may further include a status register, which may include a read operation protection bit. When the protection switch bit is enabled, the receiving module 41 may also be used to allow the protection information to be rewritten when the password verification error of the i+1th protection information rewrite occurs and i+1 is less than the set number of times; when the protection information is allowed to be rewritten, determine whether the read operation protection bit is valid; if valid, access to part of the protection information storage area is allowed; if invalid, access to the entire protection information storage area is allowed.
[0083] In one embodiment, after receiving the i-th protection information rewrite password, the receiving module 41 can also be used to allow access to the protection information storage area and rewrite the protection information when the i-th protection information rewrite password is consistent with the preset password and i is less than or equal to the set number of times.
[0084] In one embodiment, when the protection switch bit is enabled and turned on, the receiving module 41 can also be used to not allow the protection information to be rewritten when the i+1th protection information rewrite password verification error occurs and i+1 is less than the set number of times; when rewriting the protection information is not allowed, determine whether the read operation protection bit is valid; if valid, allow access to part of the protection information storage area; if invalid, allow access to the entire protection information storage area.
[0085] In one embodiment, the locking module 42 may also be used to allow access to the memory and rewrite protection information when the protection switch bit enable is turned off.
[0086] In one embodiment, the receiving module 41 may also be configured to reset i to 1 when the memory is powered on again.
[0087] In one embodiment, the partial area of the protection information storage area is a 2MB area starting from the minimum address in the protection information storage area.
[0088] In the memory information protection device of the disclosed embodiment, when the i+1th protection information rewrite password is inconsistent with the preset password and i+1 is equal to the set number of times, the values of SRP1 and SRP0 in the status register are kept unchanged at 11, or the instruction & control logic cannot decode normally when controlling the read, write, erase and decode, thereby locking the memory to prevent the memory from being accessed and the protection information from being rewritten.
[0089] When the number of times the protection information rewrite password is input is equal to the set number of times, and the protection information rewrite password is inconsistent with the preset password, the memory is locked in the memory, so that the memory cannot be accessed and the protection information stored in the memory cannot be rewritten. This can prevent the leakage of protection information and improve the confidentiality and security of the memory.
[0090] Furthermore, the memory information protection device of the disclosed embodiment provides a certain error tolerance opportunity for the user to input the protection information rewriting password by setting a set number of times, thereby avoiding the memory being locked due to the user mistakenly inputting the wrong protection information rewriting password.
[0091] See also Figure 5 , Figure 5 Schematic diagram of a computer device provided by an embodiment of the present disclosure. Figure 5 As shown, the computer device in the embodiment of the present disclosure may include: one or more processors 501, a memory 502, and an input-output interface 503. The processor 501, the memory 502, and the input-output interface 503 are connected via a bus 504. The memory 502 is used to store a computer program, which includes program instructions. The input-output interface 503 is used to receive data and output data, such as for data interaction between a host machine and a computer device, or for data interaction between virtual machines in a host machine; the processor 501 is used to execute the program instructions stored in the memory 502.
[0092] Among them, the processor 501 can perform the following operations: receiving the i-th protection information rewrite password, where i is a positive integer; when the i-th protection information rewrite password is inconsistent with the preset password and i is less than the set number of times, receiving the i+1-th protection information rewrite password; when the i+1-th protection information rewrite password is inconsistent with the preset password and i+1 is equal to the set number of times, locking the memory so that the memory cannot be accessed and the protection information cannot be rewritten.
[0093] The memory 502 may include a read-only memory and a random access memory, and provide instructions and data to the processor 501 and the input / output interface 503. A portion of the memory 502 may also include a non-volatile random access memory. In a specific implementation, the computer device may execute the implementation methods provided by the various steps in any of the above method embodiments through its built-in functional modules, and the implementation methods provided by the various steps in the figure shown in the above method embodiments may be referred to, and will not be repeated here.
[0094] The embodiments of the present disclosure provide a computer device, including a processor, an input / output interface, and a memory. The processor obtains a computer program in the memory to execute each step of the method shown in any of the above embodiments.
[0095] The present disclosure also provides a computer-readable storage medium storing a computer program. Figure 6 A schematic diagram of a computer-readable storage medium in an embodiment of the present disclosure is shown. Figure 6 As shown, a program product capable of implementing the above method of the present disclosure is stored on the computer-readable storage medium 600. The computer program is suitable for being loaded by the processor and executing the memory information protection method provided in each step of any of the above embodiments.
[0096] The present disclosure also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in any of the above-mentioned optional modes.
[0097] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are to be considered exemplary only, and the true scope and concept of the present disclosure are indicated by the claims.
Claims
1. A method for protecting memory information, characterized in that: The memory includes a storage array, the storage array includes a function configuration storage area and a protection information storage area, the function configuration storage area is not allowed to be rewritten, a protection switch bit is set in the function configuration storage area, and the protection information storage area stores protection information, and the method includes: When the protection switch is enabled, perform the following operations: Receive the i-th protection information and rewrite the password, where i is a positive integer; When the i-th protection information rewriting password is inconsistent with the preset password, and i is less than the set number of times, the i+1-th protection information rewriting password is received; When the (i+1)th protection information rewriting password is inconsistent with the preset password, and i+1 is equal to the set number of times, the memory is locked to prevent the memory from being accessed and the protection information from being rewritten.
2. The method according to claim 1, characterized in that The memory also includes a status register, and the status register includes a read operation protection bit; When the protection switch is enabled and turned on, the method further includes: If the i+1th protection information rewriting password verification fails and i+1 is less than the set number of times, rewriting the protection information is allowed; In the case where rewriting of the protection information is allowed, determining whether the read operation protection bit is valid; If valid, access to a portion of the protection information storage area is allowed; If invalid, access to the entire area of the protection information storage area is allowed.
3. The method according to claim 1, characterized in that After receiving the i-th protection information rewriting password, the method further includes: When the i-th protection information rewriting password is consistent with the preset password, and i is less than or equal to the set number of times, access to the protection information storage area and rewriting of the protection information are allowed.
4. The method according to claim 2, characterized in that When the protection switch is enabled and turned on, the method further includes: If the i+1th protection information rewriting password verification fails and i+1 is less than the set number of times, rewriting the protection information is not allowed; In the case where rewriting of the protection information is not allowed, determining whether the read operation protection bit is valid; If valid, access to a portion of the protection information storage area is allowed; If invalid, access to the entire area of the protection information storage area is allowed.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the protection switch bit is enabled to be off, access to the memory and rewriting of the protection information are allowed.
6. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the memory is powered on again, i is reset to 1.
7. The method according to claim 2 or 4, characterized in that The partial area of the protection information storage area is a 2MB area starting from the minimum address in the protection information storage area.
8. A memory information protection device, characterized in that: The memory includes a storage array, the storage array includes a function configuration storage area and a protection information storage area, the function configuration storage area is not allowed to be rewritten, a protection switch bit is set in the function configuration storage area, and the protection information storage area stores protection information, and the device includes: When the protection switch is enabled, perform the following operations: A receiving module, used for receiving the i-th protection information rewriting password, where i is a positive integer; The receiving module is further configured to receive the (i+1)th protection information rewriting password when the i-th protection information rewriting password is inconsistent with the preset password and i is less than a set number of times; The locking module is used to lock the memory when the i+1th protection information rewriting password is inconsistent with the preset password and i+1 is equal to the set number of times, so that the memory cannot be accessed and the protection information cannot be rewritten.
9. A computer device, characterized in that: include: one or more processors; The memory is configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the computer device implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
