EMMc memory with encryption and decryption functions
By integrating encryption and decryption functions into the eMMC memory, the risks of data leakage and system complexity are resolved, ensuring secure data storage and compatibility, and guaranteeing low-cost and efficient encryption operation of the eMMC memory.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU XINSHENG INTELLIGENT TECH CO LTD
- Filing Date
- 2026-04-13
- Publication Date
- 2026-05-12
AI Technical Summary
Existing eMMC storage devices pose a risk of data leakage when the device is replaced or scrapped. Furthermore, existing hardware encryption schemes increase system costs and complexity and cannot achieve fine-grained encryption of eMMC protocol data streams.
The eMMC memory integrates encryption and decryption functions. The internal encryption algorithm module encrypts the written data, and the decryption algorithm module decrypts the read data. Selective encryption is achieved through the key management unit and the encryption enable control unit. It supports the conversion of plaintext data into ciphertext for storage and is compatible with the standard eMMC protocol.
It enables encrypted storage of data in NAND Flash, avoiding the risk of data leakage, maintaining the integration and low-cost advantages of eMMc memory, and providing flexible data adaptation strategies to ensure seamless compatibility with standard eMMc protocol hosts.
Smart Images

Figure CN122020744A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of encryption technology, and in particular to an eMMC memory with encryption and decryption functions. Background Technology
[0002] In certain scenarios, data needs to be written in plaintext and read in encrypted text to ensure it is not leaked when the host is changed. However, with the increasing digitization of information, information security faces more and more threats, and eMMC storage also carries the risk of information leakage.
[0003] For example, in some eMMC storage devices, when the device is scrapped or replaced, it needs to be disassembled and the eMMC chip needs to be drilled and destroyed to ensure that information is not leaked. If the data eMMC memory is not completely destroyed, there is a chance to read data from the NAND Flash memory within the eMMC, leading to data leakage.
[0004] In existing technologies, some techniques employ hardware encryption devices that physically separate the encryption / decryption module from the storage module, using an external management module for key pairing to control data link connectivity. However, these solutions require additional hardware modules and complex out-of-band interaction processes, increasing system cost and design complexity, and are particularly unsuitable for embedded eMMC storage scenarios with extremely high requirements for size, cost, and compatibility. Furthermore, this approach cannot achieve fine-grained, selective encryption of data streams conforming to the eMMC protocol based on command content. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide an eMMC memory with encryption and decryption functions. After the host writes plaintext data into the eMMC, the eMMC memory converts the plaintext into ciphertext and then stores the ciphertext data in NAND Flash. Even when the data is read from NAND Flash, it is encrypted data, which plays a role in protecting the data.
[0006] The objective of this invention is achieved through the following technical solution:
[0007] This application discloses an eMMC memory with encryption and decryption functions, including an eMMC control unit and a Flash storage unit connected to the eMMC control unit. The eMMC control unit is provided with a host interface for communication with a host. The eMMC control unit further includes: an encryption algorithm module disposed on the data write path from the host interface to the Flash storage unit, used to encrypt the written data; a decryption algorithm module disposed on the data read path from the Flash storage unit to the host interface, used to decrypt the read data; a key management unit, used to provide encryption and decryption keys for the encryption algorithm module and the decryption algorithm module; and an encryption enable control unit connected to the command channel of the host interface, used to control the encryption algorithm module to enable or disable encryption operations on corresponding written data according to commands from the host.
[0008] Furthermore, when the encryption enable control unit determines, based on the command, that a control command used for internal parsing by the eMMc control unit is present in the data to be written, it controls the encryption algorithm module to disable encryption operations on the control command. The encryption enable control unit includes a command parsing subunit and an encryption strategy subunit. The command parsing subunit is used to parse commands from the host to identify whether the control command is included in the data to be written. The encryption strategy subunit generates an encryption enable signal based on the identification result of the command parsing subunit. In response to the encryption enable signal, the encryption algorithm module selectively performs encryption operations on valid data in the data to be written and transmits the control command to the Flash storage unit in plaintext form.
[0009] Furthermore, the encryption algorithm used by the encryption algorithm module and the decryption algorithm used by the decryption algorithm module are reversible algorithms, enabling the same key to encrypt and decrypt data; wherein, the encryption algorithm and the decryption algorithm are configured such that, when using the same key, the ciphertext data obtained by encrypting plaintext data using the encryption algorithm can be decrypted by the decryption algorithm to recover the plaintext data, and different keys will produce different ciphertext results when encrypting the same data.
[0010] Furthermore, the key management unit receives and stores the keys issued by the host through the command channel; wherein, the key management unit includes a key storage subunit and a key selection subunit, the key storage subunit is used to store at least one set of keys issued by the host, the key selection subunit is connected to the command channel, and is used to select the key used for the current write operation or read operation from the key storage subunit according to the key selection command from the host, and the encryption algorithm module and the decryption algorithm module perform the corresponding encryption or decryption operation based on the key selected by the key selection subunit.
[0011] Furthermore, the key management unit automatically generates and manages the encryption and decryption keys within the eMMC memory; wherein, the key management unit includes a key generation subunit and a key lifecycle management subunit, the key generation subunit is used to automatically generate the encryption and decryption keys when the eMMC memory is powered on and initialized or when an internal trigger instruction is received, and the key lifecycle management subunit is used to update, invalidate and destroy the automatically generated keys, so as to use different keys to encrypt data written in different batches and data in different logical address ranges.
[0012] Furthermore, the eMMc control unit also includes a decryption enable control unit, used to control the decryption algorithm module to selectively output decrypted plaintext data or ciphertext data directly read from the Flash storage unit according to configuration or host commands; wherein, the decryption enable control unit is connected to the command channel of the host interface, when the decryption enable control unit determines to output ciphertext data according to a preset register configuration value from the host, the decryption algorithm module is configured to bypass the decryption operation and directly output the ciphertext data stored in the Flash storage unit to the host interface; when the decryption enable control unit determines to output plaintext data, the decryption algorithm module is configured to perform a decryption operation on the ciphertext data read from the Flash storage unit before outputting it to the host interface.
[0013] Furthermore, the key management unit automatically generates keys internally, and the decryption enable control unit is configured to control the decryption algorithm module to output decrypted plaintext data by default. In the default plaintext data output mode, all data transmitted between the host interface and the host is in plaintext format. The encryption algorithm module automatically encrypts the plaintext data sent by the host and stores it in the Flash storage unit on the write path. The decryption algorithm module automatically decrypts the ciphertext data read from the Flash storage unit and restores it to plaintext data on the read path and transmits it to the host, thereby achieving compatibility with the standard eMMC protocol host.
[0014] Furthermore, the eMMc control unit also includes a key encryption module; the decryption enable control unit is further configured to: when controlling the decryption algorithm module to output ciphertext data, simultaneously trigger the key encryption module to encrypt the currently used encryption / decryption key, and send the encrypted key to the host through the host interface; the key encryption module uses an encryption algorithm independent of the encryption algorithm module to encrypt and protect the encryption / decryption key provided by the key management unit; when the decryption enable control unit receives a command to output ciphertext data from the host, it generates a key enable signal; the key encryption module responds to the key enable signal by performing encryption operations on the currently used encryption / decryption key, and returns the encrypted key to the host through the command channel or the data channel, so that the host can obtain the original key used to decrypt the ciphertext data by decrypting the encrypted key.
[0015] Furthermore, the command is a Packed command in the eMMC protocol, and the data to be written includes a PackedHeader and valid data. The encryption enable control unit is configured to disable encryption for the Packed Header and enable encryption for the valid data. The encryption enable control unit is configured to parse the command type in the Packed command. When a Packed write operation is identified, the data stream transmitted in the data channel is detected, and no encryption is performed on the fixed-length Packed Header portion, while encryption is performed on the valid data portion corresponding to the data length indicated in the Packed Header. When a Packed read operation is identified, the encryption enable control unit also disables encryption for the Packed Header sent through the data channel to ensure that the eMMC control unit can correctly parse the control information in the Packed Header.
[0016] Furthermore, the encryption enable control unit is also configured to: determine the storage area attribute corresponding to the data to be written based on the address information or logical block address range carried in the command, wherein the storage area attribute includes an encryption protection area and a plaintext area; when the storage area attribute is marked as an encryption protection area, forcibly enable the encryption algorithm module to encrypt the data to be written, and store the encrypted data in the corresponding encryption storage partition in the Flash storage unit; when the storage area attribute is marked as a plaintext area, forcibly disable the encryption algorithm module to encrypt the data to be written, and directly store the data to be written in plaintext form in the corresponding plaintext storage partition in the Flash storage unit; and the encryption enable control unit is also used to read the partition configuration table from the Flash storage unit when the eMMC memory is powered on and initialized, wherein the partition configuration table is used to define the storage area attributes corresponding to different logical address ranges, and to manage the storage space by region encryption.
[0017] The beneficial effects of this invention are as follows: By integrating encryption and decryption functions within the eMMC controller and setting up an encryption enable control unit directly connected to the command channel, selective encryption of control information and payload in the written data stream can be achieved based on real-time parsing of eMMC protocol commands. This ensures that control commands (such as PackedHeader) within the eMMC memory are not encrypted but can be parsed normally by the controller itself. Simultaneously, user data is stored in encrypted form in NAND Flash, fundamentally avoiding the risk of data leakage. Furthermore, it eliminates the need for additional external hardware modules, maintaining the high integration and low-cost advantages of the eMMC memory. Secondly, a flexible adaptation strategy is provided during data reading.
[0018] Specifically, a flexible adaptation strategy is provided during data reading. When the eMMC memory is configured to return decrypted plaintext data to the host, the host can directly use the data without performing any decryption operations. This allows the eMMC memory of this invention to be seamlessly compatible with hosts that support the general eMMC protocol, exhibiting excellent compatibility. When configured to return encrypted data to the host, stronger data protection is provided. In this mode, if the key is not provided simultaneously, the host must handle the decryption itself. If the encrypted key (ciphertext key) is provided to the host simultaneously, since the key itself is generated internally by the eMMC and can be unique or not fixed, double encryption protection can be achieved, further enhancing data security. Attached Figure Description
[0019] Figure 1 This is a simplified schematic diagram of an eMMC memory and host with encryption and decryption functions according to some embodiments of this application;
[0020] Figure 2This application provides a modular schematic diagram of an eMMC memory with encryption / decryption functionality and a host computer, representing some embodiments of this application.
[0021] Figure 3 This is a simplified schematic diagram of the encryption module of some embodiments of this application and eMMcio;
[0022] Figure 4 This is a simplified schematic diagram of the decryption module in some embodiments of this application and eMMcio;
[0023] Figure 5 This is a schematic diagram illustrating the Packed write command package format of some embodiments of this application;
[0024] Figure 6 This is a schematic diagram illustrating the command format in some embodiments of this application where only a Packed Header is present. Detailed Implementation
[0025] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] Before introducing the solutions of the embodiments of this application, some terms will be explained:
[0027] Plaintext data / command: Data / command before encryption; Ciphertext data: Data after encryption; Ciphertext key: Key after decryption; Vendor CMD: Command that can be defined by the eMMc controller manufacturer; CMD: Command; eMMcio: Host interface of the eMMc memory, including command and data channels, used for communication with the host; eMMcio receiver: Circuit module inside the eMMc control unit used to receive commands and data from the host interface; eMMcio transmitter: Circuit module inside the eMMc control unit used to send commands and data to the host interface; Packed command: A batch transfer command defined in the eMMc protocol, which allows the transfer of multiple data blocks in a single command interaction to improve transmission efficiency; Packed Header: The data packet header carried in the Packed command, used to describe the organization, length, logical address, and other control information of the subsequent valid data. It needs to be parsed by the eMMc control unit and therefore cannot be encrypted; NAND Flash: A specific implementation of the Flash storage unit in this application, used for final data storage.
[0028] refer to Figures 1-6The eMMC memory with encryption / decryption functionality described in the embodiments of this application includes: an eMMC control unit and a Flash storage unit (i.e., NAND Flash) connected to the eMMC control unit. The eMMC control unit is provided with a host interface for communicating with a host (e.g., ...). Figure 1 and Figure 2 (eMMcio in the middle).
[0029] In this embodiment, the eMMC control unit further includes: an encryption algorithm module, configured on the data write path from the host interface to the Flash storage unit, for encrypting the written data; and a decryption algorithm module, configured on the data read path from the Flash storage unit to the host interface, for decrypting the read data. The key management unit provides encryption and decryption keys for the encryption algorithm module and the decryption algorithm module. The encryption enable control unit is connected to the command channel of the host interface and controls the encryption algorithm module to enable or disable encryption operations on the corresponding written data according to commands from the host.
[0030] In detail, the eMMC memory in this example generally includes three main components: eMMCio, eMMC controller, and NAND Flash.
[0031] eMMCio includes command and data channels, and communication between the host and the eMMC memory is achieved through eMMCio. The eMMC controller mainly implements the control of the entire eMMC memory, including parsing / controlling eMMCio, controlling NAND Flash, and scheduling as the central hub of the eMMC memory. NAND Flash is mainly used for final data storage. In this embodiment, the encrypted eMMC storage scheme adds an encryption module in the data write direction and a decryption module in the data read direction to the unencrypted storage. The eMMCio receiver mainly receives data and commands, and the eMMCio transmitter mainly sends commands and data. There is command interaction between the receiver and the transmitter. The encryption module is responsible for data encryption, the decryption module is responsible for data decryption, the CTRL module controls the eMMC storage, and the NAND Flash is used for final data storage.
[0032] Specifically, the encryption enable control unit is configured to: when the command determines that the control command in the data to be written is used for internal parsing of the eMMc control unit, control the encryption algorithm module to disable the encryption operation of the control command.
[0033] like Figure 3As shown, the encryption module includes an encryption algorithm module, an encryption enable control module, and a key management module. The encryption enable control module receives a CMD sent from the command channel. Based on the CMD, the encryption enable module determines whether the command contains plaintext data from the write data channel, and whether the plaintext data includes a plaintext command. If a plaintext command is present, the encryption enable for the command field is disabled; otherwise, encryption is enabled. As shown, the encryption enable is sent to the encryption algorithm module. The key management module receives the CMD from the command channel and sends the key to the encryption algorithm module. The encryption algorithm module receives the plaintext data sent from the write data channel and then outputs ciphertext data and plaintext data.
[0034] Specifically, in eMMC memory, some special write data channels may contain plaintext commands. These commands cannot be encrypted. The encryption enable control module needs to determine whether the plaintext data in the write data channel contains plaintext commands. When a plaintext command is input to the encryption enable module in the write data channel, encryption must be disabled to ensure that the plaintext command is not encrypted. In all other cases, encryption must be enabled.
[0035] Furthermore, the encryption enable control unit includes a command parsing subunit and an encryption strategy subunit. The command parsing subunit is used to parse commands from the host to identify whether the control command is included in the data to be written. The encryption strategy subunit generates an encryption enable signal based on the identification result of the command parsing subunit. In response to the encryption enable signal, the encryption algorithm module selectively performs encryption operations on valid data in the data to be written, while transmitting the control command to the Flash storage unit in plaintext.
[0036] The encryption algorithm used in the encryption module and the decryption algorithm used in the decryption module are reversible algorithms, allowing the same key to encrypt and decrypt data. This design does not restrict the specific encryption / decryption algorithms, but they must be reversible; that is, plaintext data and the key are encrypted using the encryption / decryption algorithm to obtain ciphertext data, and the ciphertext data and the corresponding key are then inversely processed to obtain the plaintext data. Furthermore, different keys will produce different results when processing the same data. The encryption algorithm module takes plaintext data, encryption enable, and the key as inputs. The encryption algorithm module outputs ciphertext data and plaintext commands from the write data channel.
[0037] Based on the foregoing, this application outlines two main methods for obtaining the key.
[0038] In some embodiments, the key management unit receives and stores keys issued by the host through the command channel. That is, the source of the key can be configured by the host via CMD. Specifically, the key management unit includes a key storage subunit and a key selection subunit. The key storage subunit stores at least one set of keys issued by the host. The key selection subunit is connected to the command channel and is used to select the key used for the current write or read operation from the key storage subunit according to a key selection command from the host. The encryption algorithm module and the decryption algorithm module perform corresponding encryption or decryption operations based on the key selected by the key selection subunit.
[0039] In some embodiments, the key management unit automatically generates and manages the encryption and decryption keys within the eMMC memory. Specifically, the key management unit includes a key generation subunit and a key lifecycle management subunit. The key generation subunit automatically generates the encryption and decryption keys when the eMMC memory is powered on and initialized or when an internal trigger command is received. The key lifecycle management subunit manages the updating, invalidation, and destruction of the automatically generated keys, so that different keys are used to encrypt data written in different batches and data within different logical address ranges. Alternatively, the key management module can be selected to automatically generate the keys through a key management process. The key management module takes the CMD sent from the command channel as input and retrieves the corresponding key based on the CMD.
[0040] Regarding data reading, the eMMC control unit also includes a decryption enable control unit, used to control the decryption algorithm module to selectively output decrypted plaintext data or ciphertext data directly read from the Flash storage unit, based on configuration or commands from the host. When the host reads data, two methods are supported:
[0041] The first method involves the host issuing a read command, the eMMC internally reading the ciphertext data from the NAND Flash, and then transmitting the ciphertext data, or the ciphertext data and ciphertext key, back to the host. The second method involves the host issuing a read command, the eMMC internally reading the ciphertext data from the NAND Flash, decrypting it to obtain the plaintext data, and then returning the plaintext data to the host.
[0042] For some specific examples, refer to Figure 4The decryption module includes a decryption algorithm module, a decryption enable control unit, a key management module, and a key encryption algorithm module. The input to the decryption algorithm module is ciphertext data, a decryption enable function, and a key. The decryption enable function controls whether the ciphertext is decrypted. When decryption enable is on, the ciphertext is decrypted and sent to the eMMcio transmitter in plaintext. When decryption enable is off, the data is sent to the eMMcio transmitter in ciphertext.
[0043] The decryption enable control unit is connected to the command channel of the host interface. When the decryption enable control unit determines to output ciphertext data according to the preset register configuration value from the host, the decryption algorithm module is configured to bypass the decryption operation and directly output the ciphertext data stored in the Flash storage unit to the host interface. When the decryption enable control unit determines to output plaintext data, the decryption algorithm module is configured to perform a decryption operation on the ciphertext data read from the Flash storage unit before outputting it to the host interface.
[0044] like Figure 3 When decryption enable is activated, the command channel inputs CMD, the Key encryption algorithm module, and the Key management module to the decryption enable unit. The decryption enable unit then sends the key enable to the Key encryption algorithm module. When the data decryption module is configured to output ciphertext data, the Key encryption algorithm module encrypts the original key used for encryption and decryption and returns the encrypted key (ciphertext key) to the host. The Key management module simultaneously sends the key to both the Key encryption algorithm module and the decryption algorithm module; the decryption enable control unit sends the decryption enable to the decryption algorithm module. Thus, the decryption algorithm module decrypts the received ciphertext data and sends the plaintext data to the eMMcio receiver.
[0045] Therefore, during data writing, the eMMC memory automatically encrypts the plaintext data before storage, ensuring that all data stored in the NAND Flash is ciphertext, fundamentally avoiding the risk of data leakage. During data reading, a flexible adaptation strategy is provided. When the eMMC memory is configured to return decrypted plaintext data to the host, the host can directly use the data without any decryption operation. This allows the eMMC memory of this invention to be seamlessly compatible with hosts supporting the general eMMC protocol, exhibiting excellent compatibility. When configured to return ciphertext data to the host, stronger data protection is provided. In this mode, if the key is not provided simultaneously, the host must handle the decryption itself. If the encrypted key (ciphertext key) is provided to the host simultaneously, since the key itself is generated internally by the eMMC and can be unique or not fixed, double encryption protection can be achieved, further enhancing data security.
[0046] In some preferred embodiments, the key management unit automatically generates keys internally, and the decryption enable control unit is configured to control the decryption algorithm module to output decrypted plaintext data by default. This corresponds to an example scenario where the eMMC memory's eMMCio interface is all encrypted, and the internal data is all plaintext. In this case, the key source of the key management module is automatically generated internally by the eMMC memory, which is more secure. In this scenario, the host is unaware of the encryption and decryption processes within the eMMC memory, resulting in the strongest compatibility. In this default plaintext data output mode, the data transmitted between the host interface and the host is all in plaintext format. The encryption algorithm module automatically encrypts the plaintext data sent by the host and stores it in the Flash storage unit on the write path. The decryption algorithm module automatically decrypts the encrypted data read from the Flash storage unit on the read path, restores it to plaintext data, and transmits it to the host, thus ensuring compatibility with standard eMMC protocol hosts.
[0047] Furthermore, the eMMc control unit also includes a key encryption module; the decryption enable control unit is further configured to: when controlling the decryption algorithm module to output ciphertext data, simultaneously trigger the key encryption module to encrypt the currently used encryption / decryption key, and send the encrypted key to the host through the host interface. The key encryption module employs an encryption algorithm independent of the encryption algorithm module to encrypt and protect the encryption / decryption key provided by the key management unit. When the decryption enable control unit receives a command from the host to output ciphertext data, it generates a key enable signal. In response to the key enable signal, the key encryption module performs encryption operations on the currently used encryption / decryption key and returns the encrypted key to the host through the command channel or the data channel, enabling the host to obtain the original key used to decrypt the ciphertext data by decrypting the encrypted key.
[0048] In detail, the decryption enable control unit's decryption enable is enabled by default. It can be disabled via the Vendor CMD command channel. Disabling decryption also requires configuring key enablement. When key enablement is enabled, the key management module transmits the key to the key encryption module for encryption. The encrypted key then sends the encryption key back to the host via the command channel. Disabling decryption disables key enablement, and the key encryption algorithm ceases operation. Here, the key management module and the key management module within the encryption module use the same module.
[0049] In a preferred embodiment, the method of this application is used to process a specific command format in the eMMC protocol, with excellent results. Specifically, the command is the Packed command in the eMMC protocol, and the data to be written includes a PackedHeader and valid data; the encryption enable control unit is configured to disable encryption operation for the Packed Header and enable encryption operation for the valid data.
[0050] For example, refer to Figure 5 and Figure 6 Understanding is key. When the eMMC memory processes packed commands, the data channel contains a PackedHeader command. The Packed Header contains control information that needs to be parsed and controlled internally by the eMMC memory; therefore, the Packed Header cannot be encrypted. An encryption scheme is required, specifically the encryption enable control section. The packed command and data formats are as follows, with two formats: Packed read and Packed write. For a Packed write operation, the command channel first sends a Packedwrite CMD, then sends the Packed Header and Data through the data channel. The length of the Packed Header is fixed, and the length of the Data is contained within the Packed Header. In this case, the Packed Header on the data channel cannot be encrypted; it needs to be used internally by the eMMC controller. The Data needs to be encrypted. For a Packed read operation, the command channel first sends a PackedwriteHeaderCMD, then sends the Packed Header through the data channel, and finally sends a PackedreadDataCMD to read the Data through the data channel. Similarly, the Packed Header cannot be encrypted.
[0051] Specifically, the encryption enable control unit is configured to parse the command type in the Packed command. When a Packed write operation is identified, the data stream transmitted in the data channel is detected. The Packed Header portion with a fixed length is not encrypted, while the valid data portion corresponding to the data length indicated in the Packed Header is encrypted. When a Packed read operation is identified, the encryption enable control unit also disables encryption for the Packed Header sent through the data channel to ensure that the eMMc control unit can correctly parse the control information in the Packed Header.
[0052] Therefore, this embodiment enables the encryption-enabled control unit to accurately parse the Packed command format unique to the eMMC protocol, identifying the Packed Header (control information) and valid data (Payload) in the data stream, and applying unencrypted and encrypted processing respectively. This achieves deep coupling with the eMMC protocol, enabling fine-grained encryption control at the data packet level, improving the security of encryption operations, and ensuring good compatibility between the eMMC memory and hosts using the standard eMMC protocol.
[0053] Furthermore, the encryption enable control unit is configured to: determine the storage area attribute corresponding to the data to be written based on the address information or logical block address range carried in the command, wherein the storage area attribute includes an encryption protection area and a plaintext area; when the storage area attribute is marked as an encryption protection area, forcibly enable the encryption algorithm module to encrypt the data to be written, and store the encrypted data in the corresponding encryption storage partition in the Flash storage unit; when the storage area attribute is marked as a plaintext area, forcibly disable the encryption algorithm module to encrypt the data to be written, and directly store the data to be written in plaintext form in the corresponding plaintext storage partition in the Flash storage unit; and the encryption enable control unit is also configured to read the partition configuration table from the Flash storage unit when the eMMC memory is powered on and initialized, wherein the partition configuration table is used to define the storage area attributes corresponding to different logical address ranges, and to manage the storage space by region encryption.
[0054] Next, we will illustrate this with other exemplary scenarios.
[0055] In one example, the eMMC memory's write port displays plaintext, while its read port displays ciphertext. The host needs to decrypt the data to obtain the plaintext. This scenario is applicable when the eMMC memory is moved to a different host, but the plaintext data can still be directly accessed. A unique ID is used to distinguish between the host and the eMMC memory. If the IDs are different, the host cannot decrypt the data. If decryption is still possible after changing hosts, vendor authorization is required, thus providing end-to-end data protection. In this scenario, there are two key options:
[0056] Option 1: The key is configured by the host. The host does not need to configure key enabling through Vendor CMD. The host knows the corresponding key itself, and after receiving the ciphertext, the host internally obtains the key for decryption. This corresponds to the method where the key management unit receives and stores the key issued by the host through the command channel.
[0057] Option 2: The key is generated internally by the eMMC controller. When reading data, key enable is activated, and the key is encrypted by the key encryption module to generate a ciphertext key. The host obtains the ciphertext key through Vendor authorization, decrypts the key to obtain the key for decrypting the data, and then decrypts the data. This corresponds to the eMMC control unit also including a key encryption module; the decryption enable control unit is further configured to: when controlling the decryption algorithm module to output ciphertext data, simultaneously trigger the key encryption module to encrypt the currently used encryption / decryption key, and send the encrypted key to the host through the host interface, and at this time the key is generated internally.
[0058] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. An eMMC memory with encryption / decryption functions, comprising an eMMC control unit and a Flash storage unit connected to the eMMC control unit, wherein the eMMC control unit is provided with a host interface for communication with a host, characterized in that, The eMMc control unit also includes: An encryption algorithm module is set on the data write path from the host interface to the Flash storage unit, and is used to encrypt the written data; A decryption algorithm module is set on the data reading path from the Flash storage unit to the host interface, and is used to decrypt the read data; A key management unit is used to provide encryption and decryption keys for the encryption algorithm module and the decryption algorithm module; and An encryption enable control unit is connected to the command channel of the host interface and is used to control the encryption algorithm module to enable or disable encryption operations on corresponding written data according to commands from the host.
2. The eMMC memory with encryption / decryption function according to claim 1, characterized in that, When the encryption enable control unit determines, according to the command, that the control command in the data to be written is used for internal parsing of the eMMc control unit, it controls the encryption algorithm module to disable the encryption operation on the control command. The encryption enable control unit includes a command parsing subunit and an encryption strategy subunit. The command parsing subunit is used to parse commands from the host to identify whether the control command is included in the data to be written. The encryption strategy subunit generates an encryption enable signal based on the identification result of the command parsing subunit. The encryption algorithm module responds to the encryption enable signal to selectively perform encryption operations on valid data in the data to be written and transmits the control command to the Flash storage unit in plaintext.
3. The eMMC memory with encryption / decryption function according to claim 1, characterized in that: The encryption algorithm used by the encryption algorithm module and the decryption algorithm used by the decryption algorithm module are reversible algorithms, enabling the same key to encrypt and decrypt data. The encryption algorithm and the decryption algorithm are configured as follows: When using the same key, the ciphertext data obtained by encrypting plaintext data with the encryption algorithm can be restored to the plaintext data after being decrypted by the decryption algorithm, and different keys will produce different ciphertext results when encrypting the same data.
4. The eMMC memory with encryption / decryption function according to claim 1, characterized in that: The key management unit receives and stores the key issued by the host through the command channel; The key management unit includes a key storage subunit and a key selection subunit. The key storage subunit stores at least one set of keys issued by the host. The key selection subunit is connected to the command channel and is used to select the key used for the current write or read operation from the key storage subunit according to the key selection command from the host. The encryption algorithm module and the decryption algorithm module perform corresponding encryption or decryption operations based on the key selected by the key selection subunit.
5. The eMMC memory with encryption and decryption functions according to claim 1, characterized in that: The key management unit automatically generates and manages the encryption and decryption keys within the eMMC memory; The key management unit includes a key generation subunit and a key lifecycle management subunit. The key generation subunit is used to automatically generate the encryption and decryption keys when the eMMC memory is powered on and initialized or when an internal trigger instruction is received. The key lifecycle management subunit is used to update, invalidate, and destroy the automatically generated keys, so as to use different keys to encrypt data written in different batches and data in different logical address ranges.
6. The eMMC memory with encryption / decryption function according to claim 1 or 5, characterized in that: The eMMc control unit also includes a decryption enable control unit, which controls the decryption algorithm module to selectively output decrypted plaintext data or ciphertext data directly read from the Flash storage unit according to the configuration or the host command. The decryption enable control unit is connected to the command channel of the host interface. When the decryption enable control unit determines to output ciphertext data according to the preset register configuration value from the host, the decryption algorithm module is configured to bypass the decryption operation and directly output the ciphertext data stored in the Flash storage unit to the host interface. When the decryption enable control unit determines to output plaintext data, the decryption algorithm module is configured to perform a decryption operation on the ciphertext data read from the Flash storage unit before outputting it to the host interface.
7. The eMMC memory with encryption / decryption function according to claim 6, characterized in that: The key management unit automatically generates keys internally, and the decryption enable control unit is configured to control the decryption algorithm module to output decrypted plaintext data by default. In the default plaintext data output mode, the data transmitted between the host interface and the host is in plaintext form. The encryption algorithm module automatically encrypts the plaintext data sent by the host and stores it in the Flash storage unit on the write path. The decryption algorithm module automatically decrypts the ciphertext data read from the Flash storage unit and restores it to plaintext data on the read path, and then transmits it to the host, thus ensuring compatibility with the standard eMMC protocol host.
8. The eMMC memory with encryption / decryption function according to claim 6, characterized in that: The eMMc control unit also includes a key encryption module; the decryption enable control unit is further configured to: When the decryption algorithm module outputs ciphertext data, the key encryption module is simultaneously triggered to encrypt the currently used encryption / decryption key, and the encrypted key is sent to the host through the host interface. The key encryption module employs an encryption algorithm independent of the encryption algorithm module to encrypt and protect the encryption and decryption keys provided by the key management unit. When the decryption enable control unit receives an output ciphertext data command from the host, it generates a key enable signal. In response to the key enable signal, the key encryption module performs encryption operations on the currently used encryption and decryption key and returns the encrypted key to the host through the command channel or data channel, so that the host can obtain the original key used to decrypt the ciphertext data by decrypting the encrypted key.
9. The eMMC memory with encryption / decryption function according to claim 2, characterized in that: The command is the Packed command in the eMMC protocol, and the data to be written includes a Packed Header and valid data; the encryption enable control unit is configured to disable encryption operation for the Packed Header and enable encryption operation for the valid data. The encryption enabling control unit is configured to parse the command type in the Packed command. When a Packed write operation is detected, the data stream transmitted in the data channel is detected. The Packed Header portion with a fixed length is not encrypted, while the valid data portion corresponding to the data length indicated in the Packed Header is encrypted. When a Packed read operation is detected, the encryption enabling control unit also disables encryption for the Packed Header sent through the data channel to ensure that the eMMc control unit can correctly parse the control information in the Packed Header.
10. The eMMC memory with encryption and decryption functions according to claim 2, characterized in that: The encryption enable control unit is also configured to: Based on the address information or logical block address range carried in the command, the storage area attribute corresponding to the data to be written is determined, and the storage area attribute includes an encrypted protection area and a plaintext area; When the storage area attribute is marked as an encrypted protection zone, the encryption algorithm module is forced to perform encryption operations on the written data, and the encrypted data is stored in the corresponding encrypted storage partition in the Flash storage unit. When the storage area attribute is marked as plaintext area, the encryption algorithm module is forcibly disabled from encrypting the written data, and the written data is directly stored in plaintext form to the corresponding plaintext storage partition in the Flash storage unit. Furthermore, the encryption enable control unit is also used to read the partition configuration table from the Flash storage unit when the eMMc memory is powered on and initialized. The partition configuration table is used to define the storage area attributes corresponding to different logical address ranges and to perform encrypted management of the storage space by area.