[go: up one dir, main page]

CN114490452A - Data management method, device and control chip for embedded flash memory - Google Patents

Data management method, device and control chip for embedded flash memory Download PDF

Info

Publication number
CN114490452A
CN114490452A CN202210118615.9A CN202210118615A CN114490452A CN 114490452 A CN114490452 A CN 114490452A CN 202210118615 A CN202210118615 A CN 202210118615A CN 114490452 A CN114490452 A CN 114490452A
Authority
CN
China
Prior art keywords
data
flash memory
embedded flash
encrypted
insertion logic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210118615.9A
Other languages
Chinese (zh)
Other versions
CN114490452B (en
Inventor
彭程
庄腾飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yspring Technology Co ltd
Original Assignee
Shenzhen Yspring Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Yspring Technology Co ltd filed Critical Shenzhen Yspring Technology Co ltd
Priority to CN202210118615.9A priority Critical patent/CN114490452B/en
Publication of CN114490452A publication Critical patent/CN114490452A/en
Application granted granted Critical
Publication of CN114490452B publication Critical patent/CN114490452B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1408Protection against unauthorised use of memory or access to memory by using cryptography

Landscapes

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

Abstract

The embodiment of the application provides a data management method, a device and a control chip for an embedded flash memory, wherein the method comprises the following steps: obtaining effective data to be stored and an encryption configuration instruction; determining the position insertion logic of the current verification data according to the encryption configuration instruction, and generating the verification data based on Hamming codes by using the position insertion logic and the effective data; inserting the check data into the valid data according to the position insertion logic to obtain encrypted combined data; and storing the encrypted combined data and the encryption related information in the embedded flash memory in an associated manner. The method can greatly improve the confidentiality of the stored data and the like by inserting the logic into the position of the check data in the Hamming code to perform configurable operation.

Description

用于嵌入式闪存的数据管理方法、装置和控制芯片Data management method, device and control chip for embedded flash memory

技术领域technical field

本申请涉及数据存储技术领域,尤其涉及一种用于嵌入式闪存的数据管理方法、装置和控制芯片。The present application relates to the technical field of data storage, and in particular, to a data management method, device and control chip for embedded flash memory.

背景技术Background technique

Flash(闪存)作为非易失性存储器,例如,可用于存储程序代码,也可以用于保存数据等,其被广泛应用在各种场合,其中包括应用于微处理器(MCU)芯片设计中,此时也称为嵌入式闪存(即eFlash)。eFlash中数据的稳定保持以及数据的安全性就需要更有效的保障。现有的加密方式通常包括汉明码加密等,然而,对于汉明码加密时,其加密的校验码的位置始终是固定的,一旦数据被窃取后容易被解密,导致数据的安全性不高。Flash (flash memory) as a non-volatile memory, for example, can be used to store program codes, and can also be used to save data, etc. It is widely used in various occasions, including in the design of microprocessor (MCU) chips, Also known as embedded flash memory (ie eFlash) at this time. The stability of data in eFlash and the security of data need more effective protection. Existing encryption methods usually include Hamming code encryption, etc. However, when the Hamming code is encrypted, the position of the encrypted check code is always fixed. Once the data is stolen, it is easy to be decrypted, resulting in low data security.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本申请实施例提供一种用于嵌入式闪存的数据管理方法、装置和控制芯片。In view of this, embodiments of the present application provide a data management method, device and control chip for embedded flash memory.

第一方面,本申请实施例提供一种用于嵌入式闪存的数据管理方法,包括:In a first aspect, an embodiment of the present application provides a data management method for an embedded flash memory, including:

获取待存储的有效数据和加密配置指令;Obtain valid data to be stored and encrypted configuration instructions;

根据所述加密配置指令确定本次校验数据的位置插入逻辑,并利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据;Determine the position insertion logic of the verification data this time according to the encryption configuration instruction, and use the position insertion logic and the valid data to generate the verification data based on Hamming coding;

按照所述位置插入逻辑将所述校验数据插入到所述有效数据中,得到加密组合数据;Inserting the check data into the valid data according to the position insertion logic to obtain encrypted combined data;

将所述加密组合数据与加密相关信息关联存储到嵌入式闪存中。The encrypted combined data is stored in the embedded flash memory in association with the encryption related information.

在一些实施例中,该用于嵌入式闪存的数据管理方法还包括:In some embodiments, the data management method for embedded flash memory further includes:

读取所述加密组合数据和关联的所述加密相关信息,并根据所述加密相关信息确定所述加密组合数据对应的所述位置插入逻辑;Read the encrypted combination data and the associated encryption related information, and determine the position insertion logic corresponding to the encrypted combination data according to the encryption related information;

根据所述位置插入逻辑对所述加密组合数据进行汉明解密,得到所述有效数据。Perform Hamming decryption on the encrypted combined data according to the position insertion logic to obtain the valid data.

在一些实施例中,所述位置插入逻辑包括所述校验数据中各个校验码在待求解的加密组合数据中的插入位置,所述利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据,包括:In some embodiments, the position insertion logic includes the insertion position of each check code in the check data in the encrypted combined data to be solved, and the position insertion logic and the valid data are based on Hamming encoding to generate the verification data, including:

根据各位校验码的插入位置,得到由多位未知校验码和所述有效数据组合成的待求解的加密组合数据;According to the insertion position of each check code, obtain the encrypted combined data to be solved composed of the combination of multiple unknown check codes and the valid data;

获得所述待求解的加密组合数据中每位数据位的二进制索引;Obtain the binary index of each data bit in the encrypted combined data to be solved;

按照每组分组中只包含1位未知校验码的规则对所述待求解的加密组合数据基于二进制索引进行分组,得到多组分组;According to the rule that only 1 unknown check code is included in each grouping, the encrypted combined data to be solved is grouped based on the binary index to obtain multiple groups of groups;

按照每组分组中的“1”的数量为偶数的规则分别确定各组中的未知校验码的取值,已知取值的各个校验码共同构成所述校验数据。The values of the unknown check codes in each group are determined according to the rule that the number of "1" in each group is an even number, and the check codes with known values together constitute the check data.

在一些实施例中,每种所述位置插入逻辑最多不超过两位校验码在同一位置连续插入;所述位置插入逻辑不包括在2N对应的数据位分别插入各位校验码,其中,N为大于等于0的整数。In some embodiments, no more than two check codes are inserted continuously at the same position for each type of position insertion logic; the position insertion logic does not include inserting each check code into the corresponding data bits of 2 N respectively, wherein, N is an integer greater than or equal to 0.

在一些实施例中,所述校验数据的位数与待存储的有效数据的位数满足如下关系:In some embodiments, the number of bits of the verification data and the number of bits of valid data to be stored satisfy the following relationship:

2r>=n+1;2 r >=n+1;

式中,r表示所需校验码的最小位数,n表示所述有效数据的位数。In the formula, r represents the minimum number of digits of the required check code, and n represents the number of digits of the valid data.

在一些实施例中,所述校验数据的不同位置插入逻辑与不同的加密配置指令的对应关系通过可编程逻辑器件实现。In some embodiments, the correspondence between the insertion logic at different positions of the verification data and the different encryption configuration instructions is implemented by a programmable logic device.

第二方面,本申请实施例还提供一种用于嵌入式闪存的数据管理装置,包括:In a second aspect, an embodiment of the present application further provides a data management device for an embedded flash memory, including:

获取模块,用于获取待存储的有效数据和加密配置指令;The acquisition module is used to acquire valid data to be stored and encrypted configuration instructions;

校验生成模块,用于根据所述加密配置指令确定本次校验数据的位置插入逻辑,并利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据;A verification generation module, configured to determine the position insertion logic of the verification data this time according to the encryption configuration instruction, and generate the verification data based on the Hamming coding using the position insertion logic and the valid data;

加密重组模块,用于按照所述位置插入逻辑将所述校验数据插入到所述有效数据中,得到加密组合数据;an encryption and reorganization module, configured to insert the verification data into the valid data according to the position insertion logic to obtain encrypted combined data;

存储模块,用于将所述加密组合数据与加密相关信息关联存储到嵌入式闪存中。The storage module is used for storing the encrypted combined data and the encryption related information in the embedded flash memory in association.

在一些实施例中,用于嵌入式闪存的数据管理装置还包括:In some embodiments, the data management apparatus for embedded flash memory further includes:

读取模块,用于读取所述加密组合数据和所述加密相关信息,并根据所述加密相关信息确定所述加密组合数据对应的所述位置插入逻辑;a reading module, configured to read the encrypted combined data and the encrypted related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encrypted related information;

数据解密模块,用于根据所述位置插入逻辑对所述组合数据进行汉明解密,得到所述有效数据。A data decryption module, configured to perform Hamming decryption on the combined data according to the position insertion logic to obtain the valid data.

第三方面,本申请实施例还提供一种控制芯片,包括嵌入式闪存、存储器和处理器,所述嵌入式闪存用于存取加密组合数据,所述存储器用于存储计算机程序,所述计算机程序在所述处理器上运行时使所述控制芯片执行上述的用于嵌入式闪存的数据管理方法。In a third aspect, embodiments of the present application further provide a control chip, including an embedded flash memory, a memory, and a processor, where the embedded flash memory is used to access encrypted combined data, the memory is used to store a computer program, and the computer When the program runs on the processor, the control chip executes the above-mentioned data management method for embedded flash memory.

第四方面,本申请实施例还提供一种可读存储介质,其存储有计算机程序,所述计算机程序在处理器上执行时,实施上述的用于嵌入式闪存的数据管理方法。In a fourth aspect, an embodiment of the present application further provides a readable storage medium, which stores a computer program, and when the computer program is executed on a processor, implements the above-mentioned data management method for an embedded flash memory.

本申请的实施例具有如下有益效果:The embodiments of the present application have the following beneficial effects:

本申请实施例的用于嵌入式闪存的数据管理方法通过获取待存储的有效数据和加密配置指令;然后根据该加密配置指令确定本次校验数据的位置插入逻辑,并利用该位置插入逻辑和该有效数据基于汉明编码,生成该校验数据;最后,按照该位置插入逻辑将该校验数据插入到该有效数据中,得到加密组合数据;并将该加密组合数据与加密相关信息关联存储到嵌入式闪存中。该方法通过对汉明编码中的校验数据的位置插入逻辑进行可配置操作,并仍基于汉明码编码的原理进行数据加密,这样可以在不需要修改原有的汉明编码逻辑的情况下,由于校验码不再是原来的固定位置,在解密过程中会增大破解难度,因此可以大大提升存储数据的保密性,还能更有效的保证数据写入读出的可靠性等。The data management method for an embedded flash memory according to the embodiment of the present application obtains valid data to be stored and an encrypted configuration instruction; then determines the location of the current verification data according to the encrypted configuration instruction to insert logic, and uses the location to insert a logic sum The valid data is based on Hamming coding, and the verification data is generated; finally, the verification data is inserted into the valid data according to the position insertion logic to obtain encrypted combined data; and the encrypted combined data is stored in association with the encryption related information into the embedded flash. The method performs a configurable operation on the position insertion logic of the check data in the Hamming coding, and still encrypts the data based on the principle of Hamming coding, so that the original Hamming coding logic does not need to be modified. Since the check code is no longer the original fixed position, it will increase the difficulty of cracking during the decryption process, so the confidentiality of the stored data can be greatly improved, and the reliability of data writing and reading can be more effectively guaranteed.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following drawings will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore do not It should be regarded as a limitation of the scope, and for those of ordinary skill in the art, other related drawings can also be obtained according to these drawings without any creative effort.

图1示出了本申请实施例的用于嵌入式闪存的数据管理方法的第一流程图;FIG. 1 shows a first flowchart of a data management method for an embedded flash memory according to an embodiment of the present application;

图2示出了本申请实施例的校验数据生成的流程图;Fig. 2 shows the flow chart of the verification data generation of the embodiment of the present application;

图3示出了本申请实施例的用于嵌入式闪存的数据管理方法的系统架构图;FIG. 3 shows a system architecture diagram of a data management method for embedded flash memory according to an embodiment of the present application;

图4示出了本申请实施例的用于嵌入式闪存的数据管理方法的第二流程图;FIG. 4 shows a second flowchart of a data management method for an embedded flash memory according to an embodiment of the present application;

图5示出了本申请实施例的用于嵌入式闪存的数据管理装置的第一结构示意图;FIG. 5 shows a first structural schematic diagram of a data management apparatus for embedded flash memory according to an embodiment of the present application;

图6示出了本申请实施例的用于嵌入式闪存的数据管理装置的第二结构示意图;FIG. 6 shows a second schematic structural diagram of a data management apparatus for an embedded flash memory according to an embodiment of the present application;

图7示出了本申请实施例的控制芯片的结构示意图。FIG. 7 shows a schematic structural diagram of a control chip according to an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.

通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Thus, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the application as claimed, but is merely representative of selected embodiments of the application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

在下文中,可在本申请的各种实施例中使用的术语“包括”、“具有”及其同源词仅意在表示特定特征、数字、步骤、操作、元件、组件或前述项的组合,并且不应被理解为首先排除一个或更多个其它特征、数字、步骤、操作、元件、组件或前述项的组合的存在或增加一个或更多个特征、数字、步骤、操作、元件、组件或前述项的组合的可能性。Hereinafter, the terms "comprising", "having" and their cognates, which may be used in various embodiments of the present application, are only intended to denote particular features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the presence of or adding one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing or the possibility of a combination of the foregoing.

此外,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。Furthermore, the terms "first", "second", "third", etc. are only used to differentiate the description and should not be construed as indicating or implying relative importance.

除非另有限定,否则在这里使用的所有术语(包括技术术语和科学术语)具有与本申请的各种实施例所属领域普通技术人员通常理解的含义相同的含义。所述术语(诸如在一般使用的词典中限定的术语)将被解释为具有与在相关技术领域中的语境含义相同的含义并且将不被解释为具有理想化的含义或过于正式的含义,除非在本申请的各种实施例中被清楚地限定。Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having the same meaning as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized or overly formal meaning, unless explicitly defined in the various embodiments of the present application.

现有的汉明码编码算法都是在2的N次幂(即2N)对应的数据位依次插入各个校验码,其中,N为大于等于0的整数。具体地,在组合数据中的第1位(即对应20)、第2位(即对应21)、第4位(即对应22)、第8位(即对应23)和第16位(即对应24)等这些位置中各插入一位校验码,这些校验码可以用于对这些有效数据进行加密,此外,还可以通过对任意的1位错误数据进行纠正。可知,现有的汉明码编码都是固定的位置上插入校验码,这就导致一旦其他人获得了加密后的组合数据后,也可以较为容易地恢复出原来的有效数据,从而窃取相应有效信息。In the existing Hamming code encoding algorithm, each check code is sequentially inserted into the data bits corresponding to the N power of 2 (ie, 2 N ), where N is an integer greater than or equal to 0. Specifically, the first bit (ie, corresponding to 2 0 ), the second bit (ie, corresponding to 2 1 ), the fourth bit (ie, corresponding to 2 2 ), the eighth bit (ie, corresponding to 2 3 ) and the 16th bit in the combined data Bits (that is, corresponding to 2 4 ) are inserted into each of these positions with a check code. These check codes can be used to encrypt the valid data, and can also correct any 1-bit error data. It can be seen that the existing Hamming code encoding is to insert the check code at a fixed position, which leads to the fact that once other people obtain the encrypted combined data, the original valid data can be easily recovered, thereby stealing the corresponding valid data. information.

为此,本申请实施例提出一种用于嵌入式闪存的数据管理方法,其基于汉明码编码的原理,通过对校验数据的位置插入逻辑进行可配置操作,使得这些校验数据不再是固定在2的N次幂对应的数据位,而是可以由用户进行指定或可以进行动态配置的。这样进行解密过程中,虽然同样是利用汉明码解密,但由于其他人并不知道这些校验码的具体位置,因此会大大增加解密难度,即通过对现有的汉明码编码进行改进,可提升存储数据的保密性。下面对该用于嵌入式闪存的数据管理方法进行详细说明。To this end, an embodiment of the present application proposes a data management method for embedded flash memory, which is based on the principle of Hamming code encoding, and performs configurable operations on the position insertion logic of the verification data, so that the verification data is no longer It is fixed at the data bit corresponding to the N power of 2, but can be specified by the user or can be dynamically configured. In the decryption process in this way, although the Hamming code is also used for decryption, since other people do not know the specific location of these check codes, it will greatly increase the difficulty of decryption. That is, by improving the existing Hamming code encoding, it can be improved. Confidentiality of stored data. The data management method for the embedded flash memory will be described in detail below.

请参照图1,本申请实施例提出一种用于嵌入式闪存的数据管理方法,可以应用于如微处理器(MCU)芯片、片上系统(SoC)芯片等的数据存取。Referring to FIG. 1 , an embodiment of the present application proposes a data management method for an embedded flash memory, which can be applied to data access such as a microprocessor (MCU) chip, a system-on-chip (SoC) chip, and the like.

示范性地,该用于嵌入式闪存的数据管理方法包括步骤S110~S140:Exemplarily, the data management method for embedded flash memory includes steps S110-S140:

S110,获取待存储的有效数据和加密配置指令。S110: Obtain valid data to be stored and an encrypted configuration instruction.

本实施例中,将基于汉明码编码的原理,通过对汉明码中的校验数据的插入位置进行可配置,然后利用配置的与传统汉明码编码的插入位置的规则不同的插入位置逻辑来进行重编码,以生成这些校验数据。In this embodiment, based on the principle of Hamming code encoding, the insertion position of the check data in the Hamming code is configurable, and then the configuration is performed by using the insertion position logic that is different from the rules of the insertion position of the traditional Hamming code encoding. Re-encoding to generate these check data.

其中,上述的加密配置指令与用于对有效数据进行加密的校验数据的位置插入逻辑存在一一对应关系,即一种位置插入逻辑对应于一个加密配置指令。例如,一个控制芯片中,可以存储有多种位置插入逻辑,而用户可根据存储需要来选择其中一种来进行加密存储,也可以每隔一段时间就换另一种逻辑来进行加密,从而提高存储数据的安全性等。可以理解,上述的对应关系可进行预先存储,以便在对实际的有效数据进行加密时,可以根据输入的加密配置指令来确定本次存储操作的位置插入逻辑。There is a one-to-one correspondence between the above-mentioned encryption configuration instruction and the position insertion logic of the verification data used for encrypting valid data, that is, one type of position insertion logic corresponds to one encryption configuration instruction. For example, a control chip can store multiple positions of insertion logic, and the user can choose one of them for encrypted storage according to storage needs, or change the other logic for encryption at regular intervals, so as to improve the Security of stored data, etc. It can be understood that the above-mentioned corresponding relationship can be stored in advance, so that when the actual valid data is encrypted, the position insertion logic of the current storage operation can be determined according to the input encryption configuration instruction.

例如,在一种实施方式中,可根据位置插入逻辑的数量来确定加密配置指令中的配置字段的位数,例如,当存在3种或4种位置插入逻辑时,配置字段sel可采用两位(即sel[1:0])来表示,例如,sel=00,选取第一种位置插入逻辑;sel=01时,选取第二种位置插入逻辑;如此类推。可以理解,若是存在至少5种位置插入逻辑,则配置字段可以采用更多的位数来表示。For example, in one embodiment, the number of bits of the configuration field in the encrypted configuration instruction can be determined according to the number of position insertion logics. For example, when there are 3 or 4 kinds of position insertion logics, the configuration field sel can use two bits (ie sel[1:0]) to represent, for example, sel=00, select the first position to insert the logic; when sel=01, select the second position to insert the logic; and so on. It can be understood that if there are at least 5 kinds of position insertion logic, the configuration field can be represented by more bits.

可以理解的是,本实施例中的校验数据的位数与待存储的有效数据的位数有关。例如,在一种实施方式中,该校验数据的位数与待存储的有效数据的位数可满足如下关系:It can be understood that the number of bits of the verification data in this embodiment is related to the number of bits of the valid data to be stored. For example, in one embodiment, the number of bits of the check data and the number of bits of valid data to be stored may satisfy the following relationship:

2r>=n+1;2 r >=n+1;

式中,r表示所需校验码的最小位数,n表示有效数据的位数。In the formula, r represents the minimum number of digits of the required check code, and n represents the number of digits of valid data.

例如,当有效数据为16位时,则至少需要5位校验码;当有效数据为32位时,则至少需要6位校验码;当有效数据为64位时,则至少需要9位校验码等。可以理解,有效数据的位数并不限于只为偶数,也可以是如7位、13位、15位、31位等奇数个,这里不作限定。可以理解,加密后的组合数据的总位数则等于有效数据的位数与所需校验码的最小位数之和。For example, when the valid data is 16 bits, at least 5 check codes are required; when the valid data is 32 bits, at least 6 check codes are required; when the valid data is 64 bits, at least 9 check codes are required code verification, etc. It can be understood that the number of bits of valid data is not limited to an even number, and may also be an odd number such as 7 bits, 13 bits, 15 bits, and 31 bits, which is not limited here. It can be understood that the total number of bits of the encrypted combined data is equal to the sum of the number of bits of the valid data and the minimum number of bits of the required check code.

S120,根据该加密配置指令确定本次校验数据的位置插入逻辑,并利用该位置插入逻辑和有效数据基于汉明编码,生成校验数据。S120: Determine the position insertion logic of the current verification data according to the encryption configuration instruction, and generate verification data based on Hamming coding by using the position insertion logic and the valid data.

示范性地,由于加密配置指令与校验数据的位置插入逻辑存在对应关系,在已知加密配置指令后,则可以通过查询该对应关系来确定本次的位置插入逻辑。进而,根据这些校验码的插入位置,则可以进一步利用汉明码的编码原则来计算出各个校验码的具体取值。Exemplarily, since there is a corresponding relationship between the encryption configuration instruction and the position insertion logic of the verification data, after the encryption configuration instruction is known, the current position insertion logic can be determined by querying the corresponding relationship. Furthermore, according to the insertion positions of these check codes, the specific value of each check code can be calculated by further utilizing the coding principle of Hamming code.

举例说明,若待存储的有效数据的位数为32,校验数据的位数为6,对于待求解的38位组合数据,则设置的校验数据的不同位置插入逻辑可以包括多种,例如,下面列举出了8种,其中,每种方案都不相同。For example, if the number of digits of the valid data to be stored is 32, and the number of digits of the verification data is 6, for the 38-bit combination data to be solved, the set insertion logic at different positions of the verification data can include a variety of, for example , 8 are listed below, each of which is different.

第一种方案:在第1、2、11、12、21和22位分别插入一位校验码;第二种方案:在第3、4、13、14、23和24位分别插入一位校验码;第三种方案:在第5、6、15、16、25和26位分别插入一位校验码;第四种方案:在第7、8、17、18、27和28位分别插入一位校验码;第五种方案:在第9、10、19、20、29和30位分别插入一位校验码;第六种方案:在第11、12、21、22、31和32位分别插入一位校验码;第七种方案:在第13、14、23、24、33和34位分别插入一位校验码;第八种方案:在第15、16、25、26、35和36位分别插入一位校验码。The first scheme: insert a check code in the 1st, 2nd, 11th, 12th, 21st and 22nd bits respectively; the second scheme: insert one bit in the 3rd, 4th, 13th, 14th, 23rd and 24th bits respectively Check code; the third scheme: insert a check code in the 5th, 6th, 15th, 16th, 25th and 26th respectively; the fourth scheme: in the 7th, 8th, 17th, 18th, 27th and 28th Insert a check code respectively; the fifth scheme: insert a check code in the 9th, 10th, 19th, 20th, 29th and 30th respectively; the sixth scheme: in the 11th, 12th, 21st, 22nd, 31 and 32 bits are inserted with a check code respectively; the seventh scheme: insert a check code in the 13th, 14th, 23rd, 24th, 33rd and 34th bits respectively; the eighth scheme: in the 15th, 16th, 25, 26, 35 and 36 bits are respectively inserted with a check code.

可以理解,上述的在间隔的相邻两个位置连续插入的这8种的位置插入逻辑仅仅是一些可行的示例,此外,也可以是在每间隔相应数据位后插入一位校验码等,即不连续插入等,用户可以随机选取或根据需要来指定均可,这里不作限定。通常地,每种位置插入逻辑最多不超过两位校验码在同一位置连续插入。此外,这些位置插入逻辑通常不包括在2N对应的数据位分别插入各位校验码,即不会与传统的位置插入规则相同。It can be understood that the above-mentioned 8 kinds of position insertion logics that are continuously inserted in two adjacent positions of the interval are only some feasible examples. In addition, a check code can also be inserted after the corresponding data bits in each interval, etc., That is, discontinuous insertion, etc., can be randomly selected by the user or specified as required, which is not limited here. Usually, the logic of each position insertion does not exceed two consecutive check codes at the same position. In addition, these position insertion logic usually does not include inserting the check codes of each bit into the data bits corresponding to 2 N respectively, that is, it will not be the same as the traditional position insertion rules.

其中,上述的校验数据的不同位置插入逻辑与不同的加密配置指令的对应关系可以通过软件,也可以通过硬件来实现,例如,若是通过硬件实现,可采用可编程逻辑器件,比如,可编程逻辑阵列(PLA)等来实现输入不同的加密配置指令来选取不同的位置插入逻辑。The correspondence between the insertion logic at different positions of the above-mentioned verification data and different encryption configuration instructions can be implemented by software or hardware. For example, if it is implemented by hardware, a programmable logic device can be used. Logic array (PLA), etc. to realize inputting different encryption configuration instructions to select different positions to insert logic.

在一种实施方式中,如图2所示,该检验数据中各个校验码的取值过程,可包括以下子步骤S210~S240:In an embodiment, as shown in FIG. 2 , the value-taking process of each check code in the check data may include the following sub-steps S210-S240:

S210,根据各位校验码的插入位置,得到由多位未知校验码和有效数据组合成的待求解的加密组合数据。S210, according to the insertion position of each check code, obtain the encrypted combined data to be solved composed of a combination of a plurality of unknown check codes and valid data.

S220,获得待求解的加密组合数据中每位数据位的二进制索引。S220: Obtain the binary index of each data bit in the encrypted combined data to be solved.

S230,按照每组分组中只包含1位未知校验码的规则对待求解的加密组合数据基于二进制索引进行分组,得到多组分组。S230: Group the encrypted combined data to be solved based on the binary index according to the rule that each group of groups contains only one unknown check code to obtain multiple groups of groups.

S240,按照每组分组中的“1”的数量为偶数的规则分别确定各组中的未知校验码的取值,已知取值的各个校验码共同构成所述校验数据。S240: Determine the values of the unknown check codes in each group according to the rule that the number of "1"s in each group is an even number, and the check codes with known values together constitute the check data.

如图3所示,以一个32位的有效数据的加密场景为例,则可以确定校验码数据的最小位数为6位,可知,待求解的加密组合数据的位数总共为38位,这里表示为D0~D37。以上述八种位置插入逻辑中的第二种方案来进行说明,即在D2、D3、D12、D13、D22和D23的位置分别插入一个未知的校验码X,则可以得到一个待求解的加密组合数据。As shown in Figure 3, taking an encryption scenario of 32-bit valid data as an example, it can be determined that the minimum number of digits of the check code data is 6 digits. It can be seen that the number of digits of the encrypted combination data to be solved is 38 digits in total. Here, it is expressed as D0 to D37. The second scheme in the above-mentioned eight position insertion logic is explained, that is, an unknown check code X is inserted into the positions of D2, D3, D12, D13, D22 and D23 respectively, then an encryption to be solved can be obtained. Combine data.

然后,根据每个数据位的二进制索引,即用多位二进制位数来表示每个数据位的序号,由于组合数据的位数为38位,可用六位二进制位来表示,例如,D0的二进制索引为000001,D1的二进制索引为000010,如此类推,D38的二进制索引为100100。Then, according to the binary index of each data bit, that is, the serial number of each data bit is represented by multiple binary digits. Since the number of bits of the combined data is 38 bits, it can be represented by six binary bits, for example, the binary number of D0 The index is 000001, the binary index of D1 is 000010, and so on, the binary index of D38 is 100100.

于是,按照每组分组中只包含1位未知校验码的规则对这些二进制索引进行划分,例如,对于第1组P1,其包含的数据位的二进制索引满足xxxxx1;对于第2组P2,其包含的数据位的二进制索引满足xxxx1x;依次类推,则可得到六个分组P1~P6,其中,每个未知的校验码将被划分到相应组中。然后,利用同一组的所有数据中“1”的数量需要为偶数的规则,即可以确定该组中未知校验码的取值是1还是0。由此,得到本次校验数据。Therefore, these binary indexes are divided according to the rule that each group of groups contains only 1 unknown check code. For example, for the first group P1, the binary indexes of the data bits contained in it satisfy xxxxx1; for the second group P2, its binary indexes The binary index of the included data bits satisfies xxxx1x; and so on, six groups P1 to P6 can be obtained, wherein each unknown check code will be divided into a corresponding group. Then, by using the rule that the number of "1" in all data in the same group needs to be an even number, it can be determined whether the value of the unknown check code in the group is 1 or 0. As a result, the current verification data is obtained.

S130,按照该位置插入逻辑将生成的校验数据插入到该有效数据中,得到加密组合数据。S130, insert the generated check data into the valid data according to the position insertion logic to obtain encrypted combined data.

示范性地,在确定本次的校验数据的具体取值后,可利用这些校验码对有效数据进行加密,即按照上述的位置插入逻辑将这些校验码插入到对应位置中,即可得到对有效数据进行加密的加密组合数据,然后执行步骤S140。Exemplarily, after determining the specific value of the check data this time, these check codes can be used to encrypt the valid data, that is, these check codes are inserted into the corresponding positions according to the above-mentioned position insertion logic. The encrypted combined data for encrypting the valid data is obtained, and then step S140 is performed.

S140,将该加密组合数据与加密相关信息关联存储到嵌入式闪存中。S140, store the encrypted combined data and the encryption related information in the embedded flash memory in association.

其中,上述的加密相关信息可以是具体的加密配置指令,也可以是本次位置插入逻辑的索引,还可以是能够用于反映本次位置输入逻辑与本次有效数据之间存在关联关系的其他数据等,这里不作限定。The above-mentioned encryption-related information may be a specific encryption configuration instruction, an index of the current position insertion logic, or other information that can be used to reflect the relationship between the current position input logic and the current valid data. Data, etc., are not limited here.

示范性地,在得到加密组合数据后,可将其与本次加密相关的信息进行关联,然后将这些数据存储到嵌入式闪存中,以便后续在读取到该加密组合数据后,可同时获取到加密相关信息,进而利用该加密相关信息来进行解密,从而恢复出原来的有效数据。Exemplarily, after obtaining the encrypted combined data, it can be associated with the information related to the current encryption, and then the data can be stored in the embedded flash memory, so that after the encrypted combined data is read later, it can be obtained at the same time. to the encryption-related information, and then use the encryption-related information to decrypt, so as to restore the original valid data.

作为一种可选的方案,将有效数据进行加密存储后,若需要得到原来的有效数据,则还涉及到从闪存中读取出数据并进行解密的过程。参照图4,示范性地,该用于嵌入式闪存的数据管理方法还包括如下步骤S150~S160:As an optional solution, after the valid data is encrypted and stored, if the original valid data needs to be obtained, the process of reading the data from the flash memory and decrypting it is also involved. Referring to FIG. 4, exemplarily, the data management method for embedded flash memory further includes the following steps S150-S160:

S150,读取上述加密组合数据和关联的加密相关信息,并根据该加密相关信息确定该加密组合数据对应的位置插入逻辑。S150: Read the above encrypted combined data and associated encryption related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encryption related information.

S160,根据该位置插入逻辑对该加密组合数据进行汉明解密,得到上述有效数据。可以理解,汉明解密操作与上述汉明加密操作紧密相关。如图3所示,通过获取到原来加密时的位置插入逻辑,则可以确定这些校验码的取值,进而按照汉明码解密的原理,可恢复出被未加密的有效数据。S160, performing Hamming decryption on the encrypted combined data according to the position insertion logic to obtain the above-mentioned valid data. It can be understood that the Hamming decryption operation is closely related to the above-mentioned Hamming encryption operation. As shown in Figure 3, by obtaining the original encryption position insertion logic, the values of these check codes can be determined, and then according to the principle of Hamming code decryption, the unencrypted valid data can be recovered.

此外,如若组合数据中有任意1位数据发生错误,也不会影响到真实的有效数据。因为通过汉明码的纠错特性,可以纠正任意1位错误数据。当然,如果出现多位错误数据,则将无法保证这些有效数据的正确性。In addition, if any 1-bit data in the combined data is wrong, it will not affect the real valid data. Because of the error correction feature of Hamming code, any 1-bit erroneous data can be corrected. Of course, if there are multiple bits of erroneous data, the correctness of these valid data cannot be guaranteed.

本申请实施例的用于嵌入式闪存的数据管理方法通过对汉明编码中的校验数据的位置插入逻辑进行可配置操作,并仍基于汉明码编码的原理进行数据加密,这样可以在不需要修改原有的汉明编码逻辑的情况下,提高数据被泄露时的破解难度,因此可以大大提升存储数据的保密性,而且基于汉明码编码的逻辑,还能更有效的保证数据写入读出的可靠性等。The data management method for embedded flash memory according to the embodiment of the present application performs a configurable operation by inserting logic into the position of check data in Hamming coding, and still performs data encryption based on the principle of Hamming coding. In the case of modifying the original Hamming coding logic, it will improve the difficulty of cracking when the data is leaked, so the confidentiality of the stored data can be greatly improved, and based on the logic of the Hamming code coding, it can more effectively ensure data writing and reading. reliability, etc.

请参照图5,基于上述实施例的用于嵌入式闪存的数据管理方法,本实施例提出一种用于嵌入式闪存的数据管理装置100。示范性地,该用于嵌入式闪存的数据管理装置100包括:Referring to FIG. 5 , based on the data management method for embedded flash memory in the foregoing embodiment, this embodiment provides a data management apparatus 100 for embedded flash memory. Exemplarily, the data management apparatus 100 for embedded flash memory includes:

获取模块110,用于获取待存储的有效数据和加密配置指令;an acquisition module 110, configured to acquire valid data to be stored and encrypted configuration instructions;

校验生成模块120,用于根据所述加密配置指令确定本次校验数据的位置插入逻辑,并利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据;The verification generation module 120 is configured to determine the position insertion logic of the verification data this time according to the encryption configuration instruction, and generate the verification data based on the Hamming coding using the position insertion logic and the valid data;

加密重组模块130,用于按照所述位置插入逻辑将所述校验数据插入到所述有效数据中,得到加密组合数据;an encryption and reorganization module 130, configured to insert the verification data into the valid data according to the position insertion logic to obtain encrypted combined data;

存储模块140,用于将所述加密组合数据与加密相关信息关联存储到嵌入式闪存中。The storage module 140 is configured to store the encrypted combined data and the encryption related information in the embedded flash memory in association.

进一步地,如图6所示,用于嵌入式闪存的数据管理装置100还包括:Further, as shown in FIG. 6 , the data management apparatus 100 for embedded flash memory further includes:

读取模块150,用于读取所述加密组合数据和所述加密相关信息,并根据所述加密相关信息确定所述加密组合数据对应的所述位置插入逻辑;a reading module 150, configured to read the encrypted combined data and the encrypted related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encrypted related information;

数据解密模块160,用于根据所述位置插入逻辑对所述组合数据进行汉明解密,得到所述有效数据。The data decryption module 160 is configured to perform Hamming decryption on the combined data according to the position insertion logic to obtain the valid data.

可以理解,本实施例的装置对应于上述实施例的方法,上述实施例中的可选项同样适用于本实施例,故在此不再重复描述。It can be understood that the apparatus of this embodiment corresponds to the method of the above-mentioned embodiment, and the options in the above-mentioned embodiment are also applicable to this embodiment, so the description is not repeated here.

请参照图7,本申请还提供了一种控制芯片,例如,可以是MCU(微处理器)芯片、SoC(片上系统)芯片等。示范性地,该控制芯片包括嵌入式闪存(又称eFlash)、处理器和存储器,其中,嵌入式闪存用于存取加密组合数据,存储器存储有计算机程序,处理器通过运行所述计算机程序,从而使控制芯片执行上述的用于嵌入式闪存的数据管理方法或者上述用于嵌入式闪存的数据管理装置中的各个模块的功能。Referring to FIG. 7 , the present application also provides a control chip, which may be, for example, an MCU (microprocessor) chip, a SoC (system on chip) chip, or the like. Exemplarily, the control chip includes an embedded flash memory (also known as eFlash), a processor and a memory, wherein the embedded flash memory is used to access encrypted combined data, the memory stores a computer program, and the processor runs the computer program, Thereby, the control chip is made to execute the functions of each module in the above-mentioned data management method for embedded flash memory or the above-mentioned data management apparatus for embedded flash memory.

本申请还提供了一种可读存储介质,用于储存上述控制芯片中使用的所述计算机程序。The present application also provides a readable storage medium for storing the computer program used in the above-mentioned control chip.

在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和结构图显示了根据本申请的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,结构图和/或流程图中的每个方框、以及结构图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may also be implemented in other manners. The apparatus embodiments described above are only schematic. For example, the flowcharts and structural diagrams in the accompanying drawings show possible implementation architectures and functions of apparatuses, methods and computer program products according to various embodiments of the present application. and operation. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more functions for implementing the specified logical function(s) executable instructions. It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart diagrams, can be implemented using dedicated hardware-based systems that perform the specified functions or actions. be implemented, or may be implemented in a combination of special purpose hardware and computer instructions.

另外,在本申请各个实施例中的各功能模块或单元可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或更多个模块集成形成一个独立的部分。In addition, each functional module or unit in each embodiment of the present application may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是智能手机、个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution, and the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application.

Claims (10)

1.一种用于嵌入式闪存的数据管理方法,其特征在于,包括:1. A data management method for embedded flash memory, characterized in that, comprising: 获取待存储的有效数据和加密配置指令;Obtain valid data to be stored and encrypted configuration instructions; 根据所述加密配置指令确定本次校验数据的位置插入逻辑,并利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据;Determine the position insertion logic of the verification data this time according to the encryption configuration instruction, and use the position insertion logic and the valid data to generate the verification data based on Hamming coding; 按照所述位置插入逻辑将所述校验数据插入到所述有效数据中,得到加密组合数据;Inserting the check data into the valid data according to the position insertion logic to obtain encrypted combined data; 将所述加密组合数据与加密相关信息关联存储到嵌入式闪存中。The encrypted combined data is stored in the embedded flash memory in association with the encryption related information. 2.根据权利要求1所述的用于嵌入式闪存的数据管理方法,其特征在于,还包括:2. The data management method for embedded flash memory according to claim 1, further comprising: 读取所述加密组合数据和关联的所述加密相关信息,并根据所述加密相关信息确定所述加密组合数据对应的所述位置插入逻辑;Read the encrypted combination data and the associated encryption related information, and determine the position insertion logic corresponding to the encrypted combination data according to the encryption related information; 根据所述位置插入逻辑对所述加密组合数据进行汉明解密,得到所述有效数据。Perform Hamming decryption on the encrypted combined data according to the position insertion logic to obtain the valid data. 3.根据权利要求1所述的用于嵌入式闪存的数据管理方法,其特征在于,所述位置插入逻辑包括所述校验数据中各个校验码在待求解的加密组合数据中的插入位置,所述利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据,包括:3 . The data management method for embedded flash memory according to claim 1 , wherein the position insertion logic comprises the insertion position of each check code in the check data in the encrypted combined data to be solved. 4 . , the use of the position insertion logic and the valid data to generate the check data based on Hamming coding, including: 根据各位校验码的插入位置,得到由多位未知校验码和所述有效数据组合成的待求解的加密组合数据;According to the insertion position of each check code, obtain the encrypted combined data to be solved composed of the combination of multiple unknown check codes and the valid data; 获得所述待求解的加密组合数据中每位数据位的二进制索引;Obtain the binary index of each data bit in the encrypted combined data to be solved; 按照每组分组中只包含1位未知校验码的规则对所述待求解的加密组合数据基于二进制索引进行分组,得到多组分组;According to the rule that only 1 unknown check code is included in each grouping, the encrypted combined data to be solved is grouped based on the binary index to obtain multiple groups of groups; 按照每组分组中的“1”的数量为偶数的规则分别确定各组中的未知校验码的取值,已知取值的各个校验码共同构成所述校验数据。The values of the unknown check codes in each group are determined according to the rule that the number of "1" in each group is an even number, and the check codes with known values together constitute the check data. 4.根据权利要求1所述的用于嵌入式闪存的数据管理方法,其特征在于,每种所述位置插入逻辑最多不超过两位校验码在同一位置连续插入;4. The data management method for embedded flash memory according to claim 1, characterized in that, each kind of said position insertion logic is at most no more than two check codes are inserted continuously at the same position; 所述位置插入逻辑不包括在2N对应的数据位分别插入各位校验码,其中,N为大于等于0的整数。The position insertion logic does not include inserting each bit of check code into the corresponding data bits of 2 N , where N is an integer greater than or equal to 0. 5.根据权利要求1至4中任一项所述的用于嵌入式闪存的数据管理方法,其特征在于,所述校验数据的位数与待存储的有效数据的位数满足如下关系:5. The data management method for embedded flash memory according to any one of claims 1 to 4, wherein the number of bits of the check data and the number of bits of valid data to be stored satisfy the following relationship: 2r>=n+1;2 r >=n+1; 式中,r表示所需校验码的最小位数,n表示所述有效数据的位数。In the formula, r represents the minimum number of digits of the required check code, and n represents the number of digits of the valid data. 6.根据权利要求1所述的用于嵌入式闪存的数据管理方法,其特征在于,所述校验数据的不同位置插入逻辑与不同的加密配置指令的对应关系通过可编程逻辑器件实现。6 . The data management method for embedded flash memory according to claim 1 , wherein the correspondence between the insertion logic in different positions of the verification data and different encryption configuration instructions is implemented by a programmable logic device. 7 . 7.一种用于嵌入式闪存的数据管理装置,其特征在于,包括:7. A data management device for embedded flash memory, comprising: 获取模块,用于获取待存储的有效数据和加密配置指令;The acquisition module is used to acquire valid data to be stored and encrypted configuration instructions; 校验生成模块,用于根据所述加密配置指令确定本次校验数据的位置插入逻辑,并利用所述位置插入逻辑和所述有效数据基于汉明编码,生成所述校验数据;A verification generation module, configured to determine the position insertion logic of the verification data this time according to the encryption configuration instruction, and generate the verification data based on the Hamming coding using the position insertion logic and the valid data; 加密重组模块,用于按照所述位置插入逻辑将所述校验数据插入到所述有效数据中,得到加密组合数据;an encryption and reorganization module, configured to insert the verification data into the valid data according to the position insertion logic to obtain encrypted combined data; 存储模块,用于将所述加密组合数据与加密相关信息关联存储到嵌入式闪存中。The storage module is used for storing the encrypted combined data and the encryption related information in the embedded flash memory in association. 8.根据权利要求7所述的用于嵌入式闪存的数据管理装置,其特征在于,还包括:8. The data management device for embedded flash memory according to claim 7, further comprising: 读取模块,用于读取所述加密组合数据和所述加密相关信息,并根据所述加密相关信息确定所述加密组合数据对应的所述位置插入逻辑;a reading module, configured to read the encrypted combined data and the encrypted related information, and determine the position insertion logic corresponding to the encrypted combined data according to the encrypted related information; 数据解密模块,用于根据所述位置插入逻辑对所述组合数据进行汉明解密,得到所述有效数据。A data decryption module, configured to perform Hamming decryption on the combined data according to the position insertion logic to obtain the valid data. 9.一种控制芯片,其特征在于,包括嵌入式闪存、存储器和处理器,所述嵌入式闪存用于存取加密组合数据,所述存储器用于存储计算机程序,所述计算机程序在所述处理器上运行时使所述控制芯片执行根据权利要求1-6中任一项所述的用于嵌入式闪存的数据管理方法。9. A control chip, characterized in that it comprises an embedded flash memory, a memory and a processor, the embedded flash memory is used to access encrypted combined data, the memory is used to store a computer program, and the computer program is used in the When running on the processor, the control chip is made to execute the data management method for embedded flash memory according to any one of claims 1-6. 10.一种可读存储介质,其特征在于,其存储有计算机程序,所述计算机程序在处理器上执行时,实施根据权利要求1-6中任一项所述的用于嵌入式闪存的数据管理方法。10. A readable storage medium, characterized in that it stores a computer program that, when executed on a processor, implements the method for embedded flash memory according to any one of claims 1-6. data management methods.
CN202210118615.9A 2022-02-08 2022-02-08 Data management method and device for embedded flash memory and control chip Active CN114490452B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210118615.9A CN114490452B (en) 2022-02-08 2022-02-08 Data management method and device for embedded flash memory and control chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210118615.9A CN114490452B (en) 2022-02-08 2022-02-08 Data management method and device for embedded flash memory and control chip

Publications (2)

Publication Number Publication Date
CN114490452A true CN114490452A (en) 2022-05-13
CN114490452B CN114490452B (en) 2025-09-19

Family

ID=81479121

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210118615.9A Active CN114490452B (en) 2022-02-08 2022-02-08 Data management method and device for embedded flash memory and control chip

Country Status (1)

Country Link
CN (1) CN114490452B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7134025B1 (en) * 2002-03-29 2006-11-07 Xilinx, Inc. Methods and circuits for preventing the overwriting of memory frames in programmable logic devices
CN102833259A (en) * 2012-09-03 2012-12-19 中科华核电技术研究院有限公司 Tamper-proof detection method for intersystem data, as well as method and apparatus for generating check code
CN104503705A (en) * 2014-12-22 2015-04-08 吴剀劼 Trusted storage system constructed by flash memory devices and method for constructing trusted storage system by flash memory devices
CN106961602A (en) * 2017-03-30 2017-07-18 福建北卡科技有限公司 A kind of cross-platform incompressible color image information hidden algorithm based on RS and Hamming code
CN109766213A (en) * 2018-12-28 2019-05-17 上海微阱电子科技有限公司 A kind of memory circuit for realizing correcting data error based on Hamming code
CN113687976A (en) * 2021-08-27 2021-11-23 中国人民解放军军事科学院军事医学研究院 Encoding and decoding method and device for DNA information storage
CN113988242A (en) * 2021-10-19 2022-01-28 艾斯芸防伪科技(福建)有限公司 Multi-region-based anti-counterfeiting code generation and verification method, system, equipment and medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7134025B1 (en) * 2002-03-29 2006-11-07 Xilinx, Inc. Methods and circuits for preventing the overwriting of memory frames in programmable logic devices
CN102833259A (en) * 2012-09-03 2012-12-19 中科华核电技术研究院有限公司 Tamper-proof detection method for intersystem data, as well as method and apparatus for generating check code
CN104503705A (en) * 2014-12-22 2015-04-08 吴剀劼 Trusted storage system constructed by flash memory devices and method for constructing trusted storage system by flash memory devices
CN106961602A (en) * 2017-03-30 2017-07-18 福建北卡科技有限公司 A kind of cross-platform incompressible color image information hidden algorithm based on RS and Hamming code
CN109766213A (en) * 2018-12-28 2019-05-17 上海微阱电子科技有限公司 A kind of memory circuit for realizing correcting data error based on Hamming code
CN113687976A (en) * 2021-08-27 2021-11-23 中国人民解放军军事科学院军事医学研究院 Encoding and decoding method and device for DNA information storage
CN113988242A (en) * 2021-10-19 2022-01-28 艾斯芸防伪科技(福建)有限公司 Multi-region-based anti-counterfeiting code generation and verification method, system, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱念好: "对称密码算法功耗分析攻击防御措施的研究", 《中国博士学位论文全文数据库 (信息科技辑)》, 15 July 2015 (2015-07-15), pages 136 - 28 *

Also Published As

Publication number Publication date
CN114490452B (en) 2025-09-19

Similar Documents

Publication Publication Date Title
US20220229727A1 (en) Encoding and storage node repairing method for minimum storage regenerating codes for distributed storage systems
US11693754B2 (en) Aggregate GHASH-based message authentication code (MAC) over multiple cachelines with incremental updates
KR102412616B1 (en) Method for protecting data from algebraic manipulation
EP2789116B1 (en) Soft decision error correction for memory based puf using a single enrollment
US8185749B2 (en) System and method for revising boolean and arithmetic operations
CN110008745A (en) Encryption method, computer equipment and computer storage medium
CN112035857B (en) Data protection methods, devices, equipment and media
CN104484126B (en) A kind of data safety delet method and system based on correcting and eleting codes
BR112019012368A2 (en) ELECTRONIC CALCULATION DEVICE, ELECTRONIC CALCULATION METHOD, AND MEDIA LEGIBLE BY COMPUTER
US20100194609A1 (en) Method and Device For Coding Data Words
WO2021161304A1 (en) Methods and ip cores for reducing vulnerability to hardware attacks and/or improving processor performance
US11995006B2 (en) Algebraic and deterministic memory authentication and correction with coupled cacheline metadata
Luo et al. Differential fault analysis of SHA-3 under relaxed fault models
CN114490452A (en) Data management method, device and control chip for embedded flash memory
Colombier et al. Horizontal correlation attack on classic McEliece
CN110311773B (en) Method for preventing injection type attack of advanced encryption standard coprocessor
US7529365B2 (en) Device and method of applying check bit to encrypt instruction for protection
CN120256327B (en) Data randomization storage method, system, storage medium and device
CN118051892B (en) Integer unique identification confusion protection method, device, equipment and medium
US20050050341A1 (en) Device of applying protection bit codes to encrypt a program for protection
CN100353274C (en) A device for encrypting and protecting a program with a protection bit code
CN115221568A (en) Safety log system based on transaction terminal
CN119848899A (en) Memory management method and memory device
CN100390697C (en) Device and method for encrypting protection of processor instruction by check bit
CN119740245A (en) Device data encryption method, computer device, storage medium and program product

Legal Events

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