An embedded Flash controller supporting encrypted storage

By using the Feistel block cipher structure and cache module in the embedded Flash controller, efficient data encryption and decryption is achieved, solving the security and efficiency problems of embedded Flash storage, and providing higher security and data processing capabilities. .

CN113220498BActive Publication Date: 2024-08-23QINGXIN SEMICON TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110514401.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-08
Publication Date
2024-08-23
Estimated Expiration
2041-05-08

AI Technical Summary

Technical Problem

The security of embedded Flash encrypted storage in the existing technology is not high, and the data burning efficiency is low, making it difficult to meet users' needs for high security and efficient data management.

Method used

An embedded Flash controller that supports encrypted storage is designed. It uses a write data encryption module and a read data decryption module, combined with the Feistel group symmetric cipher structure, to realize data encryption and decryption, and realizes automatic address management through the initial address register, increasing Flash cache and splice cache modules to increase data bit width and efficiency.

Benefits of technology

It realizes data encryption and decryption with double security protection, improves data programming efficiency, adapts to data processing of different bit widths, and enhances the versatility and security of the controller.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113220498B
    Figure CN113220498B
Patent Text Reader

Abstract

The present invention discloses an embedded Flash controller supporting encrypted storage, comprising a configuration bus interface and a read data bus interface communicatively connected to a processor, a control command path, a burning data path and a read data path. The burning data path is provided with a write data encryption module for encrypting the data to be burned, and the read data path is provided with a read data decryption module for decrypting the read data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and in particular to an embedded Flash controller supporting encrypted storage. Background Art

[0002] Compared to ROM, embedded Flash (eFlash) has the ability to be repeatedly burned and written. The data stored in the embedded Flash can be erased and re-burned; and compared to SRAM, the content stored in the embedded Flash will not be lost after power failure. Therefore, as a non-volatile storage module, embedded Flash can be widely used in the field of low-power and low-cost system chip design, especially in the field of security chips. Embedded Flash can be used to store keys and support key updates, so it has been widely used.

[0003] like Figure 1 As shown, the system chip may include a processor CPU, a direct memory access DMA and an embedded Flash, and the processor CPU, the direct memory access DMA and the embedded Flash communicate with the security subsystem and the peripherals through the system bus. Among them, the processor CPU is responsible for control, operating system platform, and general signal processing tasks, and the embedded Flash is used to store instructions and data. The processor CPU accesses the embedded Flash to obtain the required instructions and data, and then completes the corresponding task operation.

[0004] As users' security awareness increases, the demand for embedded Flash encrypted storage is also increasing. For example, patent application 201610987767.7 discloses a Flash encrypted storage method and device, which generates a set of byte exchange positions (i, j) and keys through the device's unique ID, and encrypts and exchanges the data at positions i and j in a page of data. This method is mainly based on software implementation, and the encryption method is relatively simple and not very secure. Patent application 201911356169.X discloses a Flash encryption and decryption interface circuit and method, which uses a dual-key encryption and decryption circuit design to achieve encryption of write data and decryption of read data. Summary of the invention

[0005] In view of some or all of the problems in the prior art, the present invention provides an embedded Flash controller supporting encrypted storage, comprising:

[0006] A bus interface is configured, which is communicatively connected to the processor and is used to obtain data to be burned and a burning address from the processor;

[0007] A read data bus interface, which is communicatively connected to the processor, and is used to obtain a read data address and send the read Flash memory data to the processor;

[0008] Control command pathways, including:

[0009] A command register is communicatively connected to the configuration bus interface for receiving

[0010] Operating instructions; and

[0011] A command parsing state machine, which is communicatively connected to the command register and is used to parse received operation instructions;

[0012] The programming data path is used to implement the programming of Flash memory data, including:

[0013] A write data register is communicatively connected to the configuration bus interface for storing

[0014] Store the data to be burned;

[0015] A write data encryption module is communicatively connected to the write data register and is used to

[0016] Encrypt the data to be burned; and

[0017] a burn-in address register, which is communicatively connected to the configuration bus interface and is used to store a burn-in address; and

[0018] The read data path is used to read the Flash memory data, including:

[0019] A read data decryption module is communicatively connected to the read data bus interface and is used for performing a decryption operation on the read data.

[0020] Furthermore, the embedded Flash controller also includes an initial address register, which is communicatively connected to the configuration bus interface and is used to store a start address for burning the Flash memory.

[0021] Furthermore, the embedded Flash controller also includes:

[0022] An ECC encoding module, which is communicatively connected to the write data encryption module and is used to perform checksum encoding on the encrypted data; and

[0023] The ECC decoding module is communicatively connected to the read data decryption module and is used to verify and decode the data read from the Flash.

[0024] Furthermore, the embedded Flash controller also includes a cache module, including:

[0025] At least one write buffer, which is communicatively connected to the write data encryption module, and the size of any of the write buffers is the same as the data bit width of the configuration bus interface;

[0026] A cache empty and full logic module, used to monitor whether the write cache is full, and if all the write caches are full, suspend the configuration bus interface;

[0027] At least one splicing buffer, which is communicatively connected to the writing buffer and is used to splice the data stored in the writing buffer into data of a specified size, the sum of the sizes of the splicing buffers is equal to the sum of the sizes of the writing buffers, and the size of any of the splicing buffers is equal to the effective data bit width of the Flash memory;

[0028] A data splitting module, which is used to split the data read from the Flash memory into specified sizes and store them in the read data cache module, wherein the specified size refers to the size of the read data cache module; and

[0029] At least one read data cache is communicatively connected to the write data encryption module, and the size of any of the read data caches is the same as the data bit width of the read data bus interface.

[0030] Furthermore, the command register includes 1-bit “erase enable bit” and 1-bit “write enable bit”.

[0031] Further, the configuration bus interface and / or the read data bus interface is an AMBA (Advanced Microcontroller Bus Architecture) AHB (Advanced High Performance Bus) 2.0 interface, but is not limited to an AHB interface.

[0032] Furthermore, the write data encryption module and / or the read data decryption module includes at least one level of encryption circuit, wherein the encryption circuit at any level is used to implement the following functions:

[0033] After the low bit of the data and the key are subjected to a round function operation, the low bit of the data is subjected to a bitwise XOR operation with the high bit of the data to obtain a new low bit of the data; and

[0034] The low bit of the data is directly passed to the high bit of the new data, and the low bit and high bit of the new data are used as inputs for the next group of encryption circuits.

[0035] Furthermore, the keys of the encryption circuits at each level are fixed values, and the key input order of the write data encryption module and the read data decryption module is opposite.

[0036] Furthermore, the keys of the encryption circuits at each level are different.

[0037] Furthermore, the rotation function is a substitution operation function or a finite field matrix operation function.

[0038] The present invention provides an embedded Flash controller supporting encrypted storage. First, by adding a write data encryption module and a read data decryption module, the encryption of Flash memory data is realized. According to needs, an ECC encoding and decoding module can also be added to perform verification encoding on the data to provide double security protection. The write data encryption module and the read data decryption module adopt a Feistel group symmetric cipher structure, and the round of the encryption circuit can be determined according to the security level requirements. Secondly, the controller sets an initial address register so that the data to be burned can be continuously written. The controller only needs to perform address self-increment according to the initial address to realize automatic address management and improve data burning efficiency. In addition, the controller is also provided with a burning cache and a corresponding splicing cache module. When the Flash memory data bit width is greater than the configuration bus interface, the controller can perform data splicing, thereby realizing encryption and burning operations of larger bit width data, thereby improving the versatility of the controller. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] To further illustrate the above and other advantages and features of various embodiments of the present invention, a more specific description of various embodiments of the present invention will be presented with reference to the accompanying drawings. It will be understood that these drawings only depict typical embodiments of the present invention and are therefore not to be considered as limiting the scope thereof. In the accompanying drawings, for clarity, identical or corresponding parts will be represented by identical or similar reference numerals.

[0040] Figure 1 A schematic diagram showing the structure of a system chip in the prior art is shown;

[0041] Figure 2 A schematic diagram showing the structure of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention;

[0042] Figure 3 A schematic diagram showing a circuit architecture of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention;

[0043] Figure 4 A schematic diagram showing the structure of an encryption circuit of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention; and

[0044] Figure 5 A schematic diagram showing the timing sequence of an erase operation of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0045] In the following description, the present invention is described with reference to various embodiments. However, those skilled in the art will recognize that various embodiments can be implemented without one or more specific details or with other replacement and / or additional methods, materials or components. In other cases, well-known structures, materials or operations are not shown or described in detail to avoid blurring the inventive point of the present invention. Similarly, for the purpose of explanation, specific quantities, materials and configurations are set forth to provide a comprehensive understanding of embodiments of the present invention. However, the present invention is not limited to these specific details. In addition, it should be understood that the various embodiments shown in the drawings are illustrative representations and are not necessarily drawn in correct proportions.

[0046] In this specification, reference to "one embodiment" or "the embodiment" means that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present invention. The phrase "in one embodiment" appearing in various places in this specification does not necessarily all refer to the same embodiment.

[0047] It should be noted that the embodiments of the present invention describe the process steps in a specific order, but this is only for the purpose of illustrating the specific embodiment, rather than limiting the order of the steps. On the contrary, in different embodiments of the present invention, the order of the steps can be adjusted according to the adjustment of the process.

[0048] In order to realize data encryption of Flash memories with different bit widths, the present invention provides an embedded Flash controller supporting encrypted storage. The scheme of the present invention is further described below in conjunction with the accompanying drawings of the embodiments.

[0049] Figure 2 FIG. 1 is a schematic diagram showing the structure of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention. Figure 2 As shown, an embedded Flash controller supporting encrypted storage includes a configuration bus interface 001, a read data bus interface 002, a control command path 003, a programming data path 004 and a read data path 005.

[0050] The embedded Flash memory is different from the ROM. The embedded Flash controller can erase all the contents in the embedded Flash memory, that is, the erase operation. At the same time, it can also re-burn the contents in the embedded Flash memory, that is, the re-burn (program) operation. Usually, the erase and program operations require a high level of authority. In an embodiment of the present invention, the erase and program operations are implemented through the configuration bus interface 001. The configuration bus interface 001 is communicatively connected to the processor, and is used to receive the burn instruction, erase instruction, and re-burn instruction from the processor, and obtain the data to be burned and the burn address. In one embodiment of the present invention, the configuration bus interface 001 adopts AMBA (Advanced Microcontroller Bus Architecture) AHB (Advanced High Performance Bus) 2.0 interface, or AMBA APB (Advanced Peripheral Bus) interface, or a more advanced AXI bus interface, so as to be suitable for ARM processors. In another embodiment of the present invention, the configuration bus interface 001 adopts CoreConnect bus to be suitable for IBM PowerPC processors, and, in another embodiment of the present invention, the configuration bus interface 001 can adopt open source Wishbone, TileLink and other buses.

[0051] For ordinary users, compared with SRAM, the read or write operation can be completed within a single clock cycle, but the data is lost after power failure; when using the embedded Flash memory, only data or instructions need to be read from the embedded Flash memory, and there is no need to update the data or instructions, so the read delay of the embedded Flash memory is also longer than that of SRAM. In an embodiment of the present invention, the reading of data is realized through the read data bus interface 002. The read data bus interface 002 is communicatively connected to the processor, and is used to receive the read data instruction sent by the processor, obtain the address of the data to be read, and send the read Flash memory data to the processor.

[0052] The control command path 003 and the burning data path 004 communicate with the processor through the configuration bus interface 001, wherein the control command path 003 can control the timing of the burning data path 004 and the reading data path 005, and the burning data path 004 implements data burning of the Flash memory according to the received instructions.

[0053] The read data path 005 communicates with the processor via the read data bus interface 002 and is used to read data at a specified address of the Flash memory according to a data read instruction.

[0054] Figure 3 FIG. 1 is a schematic diagram showing a circuit architecture of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention. Figure 3 As shown, the control command path 003 includes a command register 301 and a command parsing state machine 302 , the burning data path 004 includes a write data register 401 , a write data encryption module 402 and a burning address register 403 , and the read data path 005 includes a read data decryption module 501 .

[0055] The command register 301 is communicatively connected to the configuration bus interface 001, and is used to receive operation instructions, and send the received operation instructions to the command parsing state machine 302 for parsing, and then obtain the corresponding timing. In order to realize the functions of erasing and burning of the Flash memory, the command register 301 needs to include at least 1 "erase enable bit" and 1 "burn enable bit". In one embodiment of the present invention, the command register 301 is 32 bits, which can also include valid data such as "cache clear" bit and "ECC off" bit to realize different functions.

[0056] The write data register 401 is communicatively connected to the configuration bus interface 001 and is used to store data to be burned.

[0057] The write data encryption module 402 is communicatively connected to the write data register 401, and is used to encrypt the data to be burned. In one embodiment of the present invention, the write data encryption module 402 uses the Feistel block cipher algorithm to implement symmetric encryption. Among them, the Feistel block cipher structure is composed of many identical round function circuits. More iterative rounds can achieve better security, but the hardware overhead is larger and the combinational logic timing is worse. In other embodiments of the present invention, other symmetric encryption methods can also be used. In one embodiment of the present invention, the write data encryption module includes at least one level of encryption circuit, wherein any level of the encryption circuit includes a round function and an adder. Among them, the round function can use a simple substitution operation or a complex finite field matrix operation. The more complex the round function, the higher the security of the encryption circuit, but the corresponding circuit complexity also increases. Taking 32-bit input plaintext as an example, Figure 4 FIG. 1 is a schematic diagram showing the structure of an encryption circuit of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention. Figure 4 As shown, the implementation principle of the write data encryption module is as follows:

[0058] First, the input plaintext is divided into two 16-bit groups, where the upper 16 bits are counted as LE0 and the lower 16 bits are counted as RE0;

[0059] Then, RE0 and the 16-bit key data_key[15:0] are rotated by the function F, and then bitwise XORed with LE0 to obtain RE1, and RE0 is directly passed to LE1. In this way, the first round of encryption circuit is completed, and RE1 and LE1 are the inputs of the next level of encryption circuit. The above operation is repeated, but the keys of each level of encryption circuit are different.

[0060] exist Figure 4 In the embodiment shown, a total of 4 levels of encryption circuits are included. After obtaining the outputs LE4 and RE4 of the fourth level encryption circuit, the LE4 is passed to RE5, and RE4 is directly passed to LE5, and finally a 32-bit output ciphertext is obtained. It should be understood that the number of levels of the encryption circuit can be adjusted according to actual needs. For example, when the timing allows, the number of levels of the encryption circuit can be increased to improve the security level, or the number of levels of the encryption circuit can be reduced to reduce the security level. Since the embedded Flash memory stores non-volatile data, the key used in the write data encryption module 402 is a fixed value for the same chip, so as to ensure that the same key can still be used to decrypt the Flash memory data after the power is turned on again next time. The key can be stored in a fuse, or it can be a string solidified in the chip.

[0061] The writing address register 403 is communicatively connected to the configuration bus interface 001, and is used to store the writing address, wherein Addr[1:0] of the writing address register 403 is used to mark the offset of the byte, and the writing address is stored in Addr[4:2]. In order to realize automatic address management, in one embodiment of the present invention, the writing data path 004 also includes an initial address register 404, which is arranged between the configuration bus interface 001 and the writing address register 403, and is used to store the writing start address of the Flash memory, so that the writing can be started from any address of the Flash memory. After setting the writing address register 403, it is only necessary to continuously write the data to be written into the writing data register 401, and the address management and data encryption, splicing and writing operations can be automatically completed. Specifically, after completing a data write, the writing address register 403 will automatically increase 1 data bit width. The writing address in the writing address register 403 is parsed by the row and column address decoder 006 to obtain the row address and column address in the Flash controller, so as to facilitate the writing of data.

[0062] In order to realize data burning of the Flash memory which is inconsistent with the data bit width of the configuration bus interface, in one embodiment of the present invention, the burning data path 004 also includes a first cache module 405, which is connected to the output end of the write data encryption module 402 and is communicatively connected to the burning address register 403, for realizing data splicing. The first cache module 405 includes:

[0063] At least one write buffer 4051, which is communicatively connected to the write data encryption module 402, and the size of any of the write buffers is the same as the data bit width of the configuration bus interface 001; for example, if the data bit width of the configuration bus interface 001 is 32 bits, any of the write buffers can store 1 32-bit data;

[0064] The cache full and empty logic module 4052 is used to monitor whether the burning cache is full. If all the burning caches are full, the configuration bus interface is suspended. In one embodiment of the present invention, the cache full and empty logic module 4052 implements the suspension of the configuration bus by providing a fifo_full full indication signal to the configuration bus interface 001. At this time, the configuration bus can only start working after the fifo_empty empty indication signal is given again. In another embodiment of the present invention, if the configuration bus adopts AMBA AHB2.0, it can realize the suspension function by pulling down the HREADY signal of AHB; and

[0065] At least one splicing cache 4053, which is communicatively connected to the write cache 4051, and is used to splice the data stored in the write cache into data of a specified size. The sum of the sizes of the splicing cache modules is equal to the sum of the sizes of the write cache modules, and the size of any of the splicing cache modules is equal to the effective data bit width of the Flash memory. For example, if the data bit width of the configuration bus interface 001 is 32 bits, and the effective data of the Flash memory is 32 bits wide, when there are 8 write caches, the cache module 405 can splice the data of the 8 write caches to obtain 8 32-bit write data aligned with any address, and store them in 8 32-bit splicing caches respectively; if the data bit width of the configuration bus interface 001 is 32 bits, and the effective data of the Flash memory is 64 bits wide, when there are 8 write caches, the cache module 405 can splice the data of the 8 write caches to obtain 8 32-bit write data aligned with any address, and store them in 8 32-bit splicing caches respectively; if the data bit width of the configuration bus interface 001 is 32 bits, and the effective data of the Flash memory is 64 bits wide, when there are 8 write caches The storage module 405 can splice the data of the 8 burn caches to obtain 4 64-bit burn data aligned with any address, and store them in the 4 64-bit spliced ​​caches respectively; and if the data bit width of the configuration bus interface 001 is 32 bits, and the valid data of the Flash memory is 32 bits wide, when there are 8 burn caches, the cache module 405 can splice the data of the 8 burn caches to obtain 2 128-bit burn data aligned with any address, and store them in the 2 128-bit spliced ​​caches respectively.

[0066] The read data decryption module 501 is communicatively connected to the read data bus interface 002, and is used to decrypt the read data and return it to the read data bus. In one embodiment of the present invention, the circuit structure of the read data decryption module 501 is the same as that of the write data encryption module 402, except that the key input order of each level of encryption circuit is opposite to that of the write data encryption module 402. Figure 4 In the illustrated embodiment, the read data decryption module 501 and the write data encryption module 402 both include a 4-level encryption circuit, wherein the key used by the first-level encryption circuit of the write data encryption module 402 is data_key[15:0], the key used by the second-level encryption circuit is data_key[31:16], the key used by the third-level encryption circuit is data_key[47:32], and the key used by the fourth-level encryption circuit is data_key[63:48]. The key used by the first-level encryption circuit of the read data decryption module 501 is data_key[63:48], the key used by the second-level encryption circuit is data_key[47:32], the key used by the third-level encryption circuit is data_key[31:16], and the key used by the fourth-level encryption circuit is data_key[15:0].

[0067] In order to implement data programming of the Flash memory that is inconsistent with the data bit width of the configuration bus interface, in one embodiment of the present invention, the read data path 005 further includes a second cache module 502, which is arranged between the Flash memory and the read data decryption module 501 and is used to split the data read from the Flash memory into data of the same size as the data bit width of the read data bus interface 002. The second cache module includes:

[0068] A data splitting module 5021, which is used to split the data read from the Flash memory into data of the same size as the data bit width of the read data bus interface 002, and store the data in the read data cache module 5022; and

[0069] At least one read data cache 5022 is communicatively connected to the write data encryption module 501, and is used to store the data split by the data splitting module 5021 and send it to the write data encryption module 501 for decryption. The size of any of the read data cache modules is the same as the data bit width of the read data bus interface, and the number of the read data caches 5022 should satisfy that the sum of the sizes of all read data caches 5022 is at least equal to the data bit width of the Flash memory. For example, if the data bit width of the Flash memory is 128 bits and the data bit width of the read data bus interface 002 is 32 bits, then the size of any of the read data caches 5022 is 32 bits, and the second cache module 502 should include at least 4 read data caches 5022, and the number of read data caches 5022 should be a multiple of 4.

[0070] In order to further improve the security of data, in one embodiment of the present invention, the embedded Flash controller is further provided with an ECC protection module for performing ECC check encoding on the data to be burned to obtain additional 9-bit check data. The ECC protection module includes:

[0071] An ECC encoding module 406 is used to perform verification encoding on the encrypted data again; and

[0072] The ECC decoding module 503 is used to verify and decode the data read from the Flash, and then perform data splitting and / or data decryption.

[0073] The following describes the erase, program and read data operations of the embedded Flash controller by taking the configuration bus interface and data bus interface with 32-bit data width as an example. The operations of the configuration bus interface and data bus interface with other data widths are similar.

[0074] If the embedded Flash controller is to be erased, the "erase enable bit" in the command register 301 needs to be set to 1 through the configuration bus interface 001, and then the command parsing state machine 302 parses it into the control port timing of the Flash memory. Figure 5 The following is a schematic diagram of the erase operation timing of an embedded Flash controller supporting encrypted storage according to an embodiment of the present invention. Taking TSMC's 40nm embedded Flash particles as an example, after receiving the erase instruction, the command parsing state machine 302 first needs to pull down the YE / SE / MAS1 input, and then pull up XE in the next cycle, and then pull up the ERASE and NVSTR ports to start erasing; after waiting for the erase time specified in the embedded Flash manual, the ERASE and NVSTR ports are pulled down in order, and then the YE / SE / MAS1 and other ports are pulled up.

[0075] The programming operation of the embedded Flash controller includes:

[0076] First, through the configuration bus interface 001, the "write enable bit" (prog_en) in the command register 301 is written to 1, and the command parsing state machine 302 will know that it has entered the write enable state, and it will automatically monitor the full indication signal of the full flag (fifo_full) of the cache full logic module 4052;

[0077] Next, the initial address of the burning is written into the initial address register 404 through the configuration bus interface 001. For example, if 0x00000000 is written into the initial address register 404, it means that the burning starts from the first address of the embedded Flash. It should be understood that the setting of the initial address register 404 allows the embedded Flash controller to start burning from any address.

[0078] Next, the data to be written is written into the write data register 401 through the configuration bus interface 001. The data to be written is first encrypted by the write data encryption module 402 and converted into 32-bit encrypted data. If the current addr[4:2] of the write address register 402 is 3'b000, the encrypted data will be stored in the 32-bit write buffer 0. Since one data has been written, the write address register 402 will automatically add 4, that is, the address will increase by 4 bytes, that is, the address will increase by 1 32-bit word, and its addr[4:2] will become 3'b001;

[0079] Next, the second data to be written is continued to be written into the write data register 401 through the configuration bus interface 001; the second data to be written is encrypted by the write data encryption module 402 and converted into 32-bit encrypted data; because it is the second data to be written, the current addr[4:2] of the write address register 402 is 3'b001, and the encrypted data is stored in the write cache 1;

[0080] Repeat the above steps until the programming buffer 0-programming buffer 7 are all full. At this time, the cache full and empty logic module 4052 will provide the fifo_full full indication signal to the configuration bus interface 001 to suspend the configuration bus; the configuration bus can only start working until the fifo_empty empty indication signal is given again. If the configuration bus adopts AMBA AHB2.0, the suspension function can be realized by pulling down the HREADY signal of AHB.

[0081] The cache empty and full logic module 4052 will also input fifo_full to the splicing cache 4053. If the valid data of the Flash memory is 32 bits wide, there are 8 32-bit splicing caches 4053; if the valid data of the Flash memory is 64 bits wide, there are 4 64-bit splicing caches 4053; if the valid data of the Flash memory is 128 bits wide, there are 2 128-bit splicing caches 4053. Taking 128 bits wide as an example, the splicing cache splices the data of 8 burning caches to splice out 128 bits of burning data aligned with any address;

[0082] Next, the 128-bit encrypted data output by the splicing buffer enters the ECC encoding module 406, and generates an additional 9-bit check data, generating a final 137-bit data, which is written into the Flash memory, wherein the command parsing state machine 302 ensures the timing correctness of the Flash memory's writing control signal, and controls the row and column address decoder 006 to generate the correct row address and column address; and

[0083] Finally, through the configuration bus interface 001, the "burning enable bit" (prog_en) in the command register 301 is written to 0 to exit the burning state.

[0084] The read operation of the embedded Flash controller includes:

[0085] The read command and the read address are sent through the read data bus interface 002, and the command parsing state machine 302 sends the row address, column address and the read command passed through the row and column address decoder 006 to the Flash memory; after the waiting time that meets the specification, the read data of 137 is output from the Flash memory and enters the ECC decoding module 503;

[0086] The ECC decoding module 503 verifies the data and outputs 128 bits of verified data in real time, which is still encrypted data.

[0087] The data splitting module 5021 splits the 128-bit data into four 32-bit data and stores them in the read data cache 0 - read data cache 3;

[0088] Finally, the read data decryption module 501 decrypts the 32-bit data in the read data cache and returns it to the read data bus.

[0089] Although various embodiments of the present invention are described above, it should be understood that they are presented as examples only and not as limitations. It is obvious to those skilled in the relevant art that various combinations, modifications and changes can be made thereto without departing from the spirit and scope of the present invention. Therefore, the breadth and scope of the present invention disclosed herein should not be limited by the exemplary embodiments disclosed above, but should only be defined according to the attached claims and their equivalents.

Claims

1. An embedded Flash controller supporting encrypted storage, characterized in that: include: A bus interface is configured, which is communicatively connected to the processor and is configured to obtain data to be burned and a burning address from the processor; A read data bus interface, which is communicatively connected to the processor and is configured to obtain a read data address and send the read Flash memory data to the processor; Control command pathways, including: a command register communicatively connected to the configuration bus interface and configured to receive an operation instruction; and A command parsing state machine, which is communicatively connected to the command register and is configured to parse a received operation instruction; The programming data path is configured to enable programming of Flash memory data, including: A write data register, which is communicatively connected to the configuration bus interface and is configured to store data to be burned; a write data encryption module, which is communicatively connected to the write data register and is configured to encrypt the data to be burned; and a burn address register, which is communicatively connected to the configuration bus interface and is configured to store a burn address; and The read data path is configured to enable reading of Flash memory data, including: a read data decryption module, which is communicatively connected to the read data bus interface and is configured to perform a decryption operation on the read data; and Cache module, including: At least one write buffer, which is communicatively connected to the write data encryption module, and the size of any of the write buffers is the same as the data bit width of the configuration bus interface; A cache empty and full logic module is configured to monitor whether the write cache is full, and suspend the configuration bus interface if all the write caches are full; At least one splicing buffer, which is communicatively connected to the write buffer and is configured to splice data stored in the write buffer into data of a specified size, wherein the sum of the sizes of the splicing buffers is equal to the sum of the sizes of the write buffers, and the size of any of the splicing buffers is equal to the effective data bit width of the Flash memory; a data splitting module configured to split the data read from the Flash memory into data of a specified size and store the data into a read data cache module, wherein the specified size refers to the size of the read data cache module; and At least one read data cache is communicatively connected to the write data encryption module, and the size of any of the read data caches is the same as the data bit width of the read data bus interface.

2. The embedded Flash controller according to claim 1, wherein: It also includes an initial address register, which is communicatively connected to the configuration bus interface and is configured to store a start address for burning the Flash memory.

3. The embedded Flash controller according to claim 1, wherein: Also includes: An ECC encoding module, which is communicatively connected to the write data encryption module and is configured to be able to perform check encoding on the encrypted data; as well as The ECC decoding module is communicatively connected to the read data decryption module and is configured to be able to verify and decode the data read from the Flash.

4. The embedded Flash controller according to claim 1, wherein: The command register includes 1 "erase enable bit" and 1 "write enable bit".

5. The embedded Flash controller according to claim 1, wherein: The write data encryption module and / or the read data decryption module comprises at least one level of encryption circuit, wherein the encryption circuit at any level is configured to achieve the following functions: After the low bit of the data and the key are subjected to a round function operation, the low bit of the data is subjected to a bitwise XOR operation with the high bit of the data to obtain a new low bit of the data; and The low bit of the data is directly passed to the high bit of the new data, and the low bit and high bit of the new data are used as inputs for the next group of encryption circuits.

6. The embedded Flash controller according to claim 5, characterized in that: The keys of the encryption circuits at each level are fixed values, and the key input order of the write data encryption module and the read data decryption module is opposite.

7. The embedded Flash controller according to claim 5, characterized in that: The keys for each level of encryption circuit are different.

8. The embedded Flash controller according to claim 5, characterized in that: The rotation function is a substitution operation function or a finite field matrix operation function.