Data processing method and data processing system
By using the RPMB hardware encryption and decryption area and controller in the storage device to encrypt and decrypt data, the problem of low access efficiency in the RPMB encryption area is solved, and efficient data reading and writing and security assurance are achieved.
Patent Information
- Application Number
- CN202310391964.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2024-10-15
AI Technical Summary
In storage devices, the encryption verification process when accessing the RPMB encrypted area is complicated, which affects the efficiency of data reading and writing.
The RPMB hardware encryption and decryption area and controller are introduced into the storage device, and the data writing and reading instructions are encrypted and decrypted through the controller. Encryption and decryption operations are performed directly in the storage device, reducing the encryption and decryption verification process on the host side.
It improves data reading and writing efficiency, ensures data security, and reduces the time-consuming encryption verification required to access the RPMB encrypted area, allowing users to access the RPMB hardware encryption and decryption area in plain text.
Smart Images

Figure CN118779892A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a data processing method and a data processing system. Background Art
[0002] In the application process of storage technology, with the upgrade of storage devices and the improvement of users' requirements for data security, when reading and writing data in the RPMB (Replay Protected Memory Block) encryption area of the storage device, a complex encryption verification process is required to improve data security.
[0003] In actual operation, the researchers of this application found that when users use storage devices, they need to encrypt and protect the data in the RPMB encryption area on the host side, and they also need to quickly read and write the corresponding data from it. That is, when current storage devices read and write the RPMB encryption area, they need to undergo complex encryption verification by professionals and professional equipment, which affects the efficiency of reading and writing data. Summary of the invention
[0004] The main technical problem solved by this application is to provide a data processing method and a data processing system, which can reduce the time spent on tedious encryption verification when accessing the RPMB encryption area and improve the efficiency of data reading and writing.
[0005] To solve the above technical problems, a technical solution adopted in the present application is: to provide a data processing method, applied to a storage device, the storage device includes an RPMB hardware encryption and decryption area, a controller and a storage unit, the data processing method includes: the controller responds to a data write instruction from the host side, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit; or, the controller responds to a data read instruction from the host side, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit, obtains the corresponding second target data fed back by the storage unit, decrypts the second target data in the RPMB hardware encryption and decryption area, and sends the decrypted second target data to the host side.
[0006] In one embodiment of the present application, the controller responds to a data write instruction from the host side, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit, including: the controller responds to the data write instruction from the host side, obtains the first target data, and obtains the RPMB hardware count of the storage device; encrypts the first target data and the RPMB hardware count in the RPMB hardware encryption and decryption area to obtain first encryption information; and stores the first encryption information in the storage unit.
[0007] In one embodiment of the present application, after obtaining the first target data, the data processing method also includes: obtaining the number of write bytes corresponding to the first target data; if the number of write bytes is greater than the first preset number of bytes, dividing the first target data into multiple segments of first target sub-data with the first preset number of bytes as the limit; encrypting the first target data and the RPMB hardware count in the RPMB hardware encryption and decryption area to obtain first encrypted information includes: encrypting multiple segments of first target sub-data with the RPMB hardware count respectively in the RPMB hardware encryption and decryption area to obtain multiple first encrypted sub-information corresponding to the first target data; wherein the data amount of each first encrypted sub-information is a second preset number of bytes, and the second preset number of bytes is greater than the first preset number of bytes; storing the first encrypted information in the storage unit includes: storing the multiple first encrypted sub-information in the storage unit.
[0008] In one embodiment of the present application, storing the first encryption information in the storage unit includes: the controller sends the RPMB hardware count and the first encryption information to the storage unit, so that the storage unit verifies the RPMB hardware count and the first encryption information, and stores the first encryption information after successful verification.
[0009] In one embodiment of the present application, the data read instruction is encrypted in the RPMB hardware encryption and decryption area, and the encrypted data read instruction is sent to the storage unit to obtain the corresponding second target data fed back by the storage unit, including: encrypting the data read instruction in the RPMB hardware encryption and decryption area using the key and hardware information corresponding to the storage unit; sending the encrypted data read instruction to the storage unit, so that the storage unit completes the authentication of the encrypted data read instruction based on the key and the hardware information, and returns the corresponding second target data based on the data read instruction.
[0010] In one embodiment of the present application, decrypting the second target data in the RPMB hardware encryption and decryption area includes: decrypting the second target data using the key and hardware information corresponding to the storage unit.
[0011] In one embodiment of the present application, the data read instruction is encrypted in the RPMB hardware encryption and decryption area, and the encrypted data read instruction is sent to the storage unit to obtain the corresponding second target data fed back by the storage unit, including: determining the number of read bytes of the data to be obtained by the data read instruction; if the read number of bytes is greater than the first preset number of bytes, the data read instruction is encrypted in the RPMB hardware encryption and decryption area, and the encrypted data read instruction is sent to the storage unit, and a plurality of second target data corresponding to the data read instruction is obtained from the storage unit, wherein the data amount of the second target data is the second preset number of bytes, and the second preset number of bytes is greater than the first preset number of bytes; the second target data is decrypted in the RPMB hardware encryption and decryption area, and the decrypted second target data is sent to the host end, including: decrypting a plurality of the second target data in the RPMB hardware encryption and decryption area, and integrating the decrypted second target data and sending them to the host end.
[0012] In one embodiment of the present application, before the controller responds to a data write instruction or a data read instruction from the host, the data processing method further includes: in response to powering on the storage device, initializing the storage device to obtain the key and hardware information corresponding to the storage device; encapsulating the key, the hardware information and the write request into the data write and read instruction; or, encapsulating the key, the hardware information and the read request into the data read instruction.
[0013] To solve the above technical problems, another technical solution adopted in the present application is: to provide a data processing method, applied to a host side, the host side is coupled to a storage device, the storage device includes an RPMB hardware encryption and decryption area, a controller and a storage unit, the data processing method includes: the host side sends a data write instruction to the storage device, so that the controller of the storage device responds to the data write instruction of the host side, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit; or, the host side sends a data read instruction to the storage device, so that the controller of the storage device responds to the data read instruction, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit to obtain the corresponding second target data fed back by the storage unit; after the storage device decrypts the second target data in the RPMB hardware encryption and decryption area, the host side receives the decrypted second target data.
[0014] To solve the above technical problems, another technical solution adopted in the present application is: to provide a data processing system, which includes: a host end and a storage device coupled to the host end, the storage device stores a computer program, and the storage device executes the computer program to implement a data processing method applied to the storage device.
[0015] To solve the above technical problems, another technical solution adopted in the present application is: to provide a data processing system, which includes: a host end and a storage device coupled to the host end, a computer program is stored in the host end, and the host end executes the computer program to implement a data processing method applied to the host end.
[0016] Different from the current technology, the data processing method provided by the present application is applied to a storage device, which includes an RPMB hardware encryption and decryption area, a controller and a storage unit. The data processing method includes: the controller responds to a data write instruction from the host side, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit; or, the controller responds to a data read instruction from the host side, encrypts the data read instruction in the RPMB hardware encryption and decryption area, sends the encrypted data read instruction to the storage unit, obtains the corresponding second target data fed back by the storage unit, decrypts the second target data in the RPMB hardware encryption and decryption area, and sends the decrypted second target data to the host side; that is, in the data reading and writing of the storage device of the present application, the controller autonomously encrypts the write data according to the data write instruction, and then stores it in the storage unit; or the controller autonomously decrypts the data in the RPMB hardware encryption and decryption area according to the data read instruction, and returns the decrypted data to the host side, so that the user can access the RPMB hardware encryption and decryption area in plain text form such as UI, while ensuring data security, reducing the cumbersome encryption verification time for accessing the RPMB encryption area, and improving data reading and writing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0018] Figure 1 It is a flowchart of an embodiment of a data processing method applied to a storage device in the present application;
[0019] Figure 2 is a schematic diagram of the structure of an embodiment of a storage device in the present application;
[0020] Figure 3 It is a flow chart of an embodiment of step S1 in the present application;
[0021] Figure 4 is a flow chart of another embodiment of step S1 in the present application;
[0022] Figure 5 It is a flow chart of an embodiment of step S2 in this application;
[0023] Figure 6 is a flow chart of another embodiment of step S2 in the present application;
[0024] Figure 7It is a flow chart of an embodiment of a data processing method applied to a host side in the present application;
[0025] Figure 8 It is a structural diagram of an embodiment of a data processing system in the present application. DETAILED DESCRIPTION
[0026] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only some but not all structures related to the present application are shown in the drawings. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of the present application.
[0027] Reference to "embodiments" in an application means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0028] The steps in the embodiments of the present application do not necessarily have to be processed in the described order of steps. The steps can be selectively rearranged, or the steps in the embodiments can be deleted, or the steps in the embodiments can be added as needed. The step descriptions in the embodiments of the present application are only optional sequence combinations and do not represent all step sequence combinations in the embodiments of the present application. The order of steps in the embodiments cannot be considered as a limitation of the present application.
[0029] The terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0030] The current data processing methods, especially the data reading and writing methods of the RPMB hardware encryption and decryption area of the storage device, generally require complex encryption and decryption verification on the host-side file system to ensure data security before accessing the RPMB hardware encryption and decryption area and then reading and writing data in the area; however, not all users are professionals, and without professional knowledge, they cannot perform encryption and decryption verification on the host side well, which affects the effect of encryption and decryption verification, and further affects the efficiency of data reading and writing.
[0031] Therefore, a data processing method is provided to automatically perform encryption and decryption directly in a storage device, so as to realize fast reading and writing of data in a storage device having an RPMB hardware encryption and decryption area.
[0032] See also Figure 1 , Figure 1 It is a flow chart of the first embodiment of the data processing method of the present application. The data processing method is applied to a storage device, which includes an RPMB hardware encryption and decryption area, a controller and a storage unit.
[0033] Figure 2 is a schematic diagram of the structure of an embodiment of a storage device, such as Figure 2 As shown, the storage device is Figure 2 As shown, it includes a controller, a storage unit and an RPMB hardware encryption and decryption area; wherein, the RPMB hardware encryption and decryption area is an area displayed on the host side when the controller interacts with the host side; for example, the host side itself has disk A and disk B, and the storage device includes a controller and a storage unit. When the storage device interacts with the host side, an RPMB hardware encryption and decryption area will be displayed on the host side, and the RPMB hardware encryption and decryption area is an area belonging to the storage device.
[0034] In some embodiments, after the host side uses the data processing device, the actual capacity of the host side will be smaller than the original capacity, that is, the host side will form an RPMB hardware encryption and decryption area, occupying a part of the capacity.
[0035] like Figure 1 As shown, the data processing method of the present application, when applied to a storage device, includes data writing processing and data reading processing, specifically including the following steps:
[0036] When writing data, it is as follows:
[0037] S1. In response to a data write instruction from the host, the controller encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit.
[0038] Among them, the host side can be a user terminal, such as a computer, etc., which is used for the user to input corresponding data writing instructions or data reading instructions, and has a corresponding file system; the RPMB hardware encryption and decryption area is the RPMB encryption partition of the storage device. When the controller interacts with the file system of the host side, the RPMB hardware encryption and decryption area is displayed in the file system of the host side; the storage unit is used to store data in the device; the first target data is unencrypted data, that is, plaintext data.
[0039] Specifically, when a user sends a data write instruction and the corresponding first target data to the storage device through the host, the controller reads and responds to the data write instruction, encrypts the first target data in the RPMB hardware encryption and decryption area of the storage device, and stores the encrypted first target data in the storage unit of the storage device, so that the first target data is written to the storage device.
[0040] In some embodiments, the first target data may be encrypted based on a communication protocol used by the controller and the storage unit, for example, when the storage device is UFS, the UFS protocol is used; when the storage device is eMMC, the eMMC protocol is used.
[0041] When reading data, it is as follows:
[0042] S2. The controller responds to the data read instruction of the host end, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit to obtain the corresponding second target data fed back by the storage unit;
[0043] The data read instruction is an instruction inputted through the host side and is used to read the data of the storage device; the second target data is the encrypted data in the storage unit.
[0044] Specifically, when a user sends a data read instruction to the storage device through the host, the controller reads and responds to the data read instruction, encrypts the data read instruction in the RPMB hardware encryption and decryption area of the storage device, and sends the encrypted data read instruction to the storage unit of the storage device. After the storage unit obtains the encrypted data read instruction, it returns the second target data corresponding to the data read instruction to the controller.
[0045] S3. The controller decrypts the second target data in the RPMB hardware encryption and decryption area, and sends the decrypted second target data to the host end.
[0046] Among them, because the returned second target data is encrypted data and cannot be directly applied, the controller is required to decrypt the second target data.
[0047] Specifically, after the controller obtains the second target data, the second target data is decrypted in the RPMB hardware encryption and decryption area of the storage device to obtain the decrypted second target data, and the decrypted second target data is sent to the host side so that the host side can obtain the decrypted plaintext data.
[0048] In some embodiments, the storage device can also be an external storage device; that is, when the user needs to access the RPMB encrypted partition inside the host side, the storage device is connected and interacted with the host side, and the storage device performs the above-mentioned data processing process, so that the user can encrypt and decrypt the corresponding data of the RPMB encrypted partition inside the host side through the storage device, and then the user can access the RPMB encrypted partition inside the host side in the form of plain text data on the host side.
[0049] In this embodiment, the controller automatically encrypts and decrypts the corresponding data in the RPMB hardware encryption and decryption area, so that the data written to the storage device is encrypted, ensuring the data security of the storage device; or the data read from the storage device is decrypted and sent to the host side, allowing users to read the data in the storage device more conveniently, thereby improving data reading and writing efficiency.
[0050] See also Figure 3 , Figure 3 It is a flowchart of an embodiment of step S1 in the present application.
[0051] like Figure 3 As shown, step S1 includes:
[0052] S11. The controller obtains first target data and an RPMB hardware count of the storage device in response to a data write instruction from the host.
[0053] The RPMB hardware count is data recorded by the RPMB hardware counter of the storage device, and is used to mark each data written into the storage device.
[0054] S12. Encrypt the first target data and the RPMB hardware count in the RPMB hardware encryption and decryption area to obtain first encrypted information.
[0055] Among them, due to the limitations of the RPMB encryption protocol and storage device encryption, plaintext data cannot be directly stored in a storage device with an RPMB hardware encryption and decryption area. Therefore, the first target data and the RPMB hardware calculation need to be encrypted.
[0056] Specifically, after the controller obtains the first target data to be written and the RPMB hardware count corresponding to the RPMB hardware counter of the storage device, the first target data and the RPMB hardware count are encapsulated and encrypted together to obtain corresponding first encrypted information.
[0057] In some embodiments, before the controller responds to a data write instruction or a data read instruction from the host, the controller further includes:
[0058] In response to the storage device being powered on, initializing the storage device to obtain a key and hardware information corresponding to the storage device;
[0059] When writing data, the key, the hardware information and the data writing instruction are encrypted together and sent to the storage medium; or, when reading data, the key, the hardware information and the data reading instruction are encrypted together and sent to the storage medium.
[0060] In some other embodiments, in response to the storage device being powered on, the storage device is initialized to obtain a key and hardware information corresponding to the storage device;
[0061] The key, the hardware information and the write request are packaged into the data write read instruction; or the key, the hardware information and the read request are packaged into the data read instruction.
[0062] S13: Store the first encrypted information in a storage unit.
[0063] Specifically, after the encrypted first encrypted information is obtained, the first encrypted information may be stored in a storage unit to complete the writing of data to the storage device based on the data writing instruction.
[0064] In some embodiments, the controller sends the RPMB hardware count and the first encryption information to the storage unit, so that the storage unit verifies the RPMB hardware count and the first encryption information, and stores the first encryption information after successful verification; if the verification fails, it means that the RPMB hardware count does not have the corresponding first encryption information, and returns to the encryption step.
[0065] Each first encrypted information corresponds to a unique RPMB hardware count, so the first encrypted information can be verified through the RPMB hardware count.
[0066] In this embodiment, each data write is marked by the RPMB hardware count, and the written data and the RPMB hardware count are packaged and encrypted and stored in the storage unit of the storage device, so that each data write has a corresponding identifier to facilitate subsequent data reading; and all data written to the storage device are encrypted to ensure the data security of the storage device.
[0067] See also Figure 4 , Figure 4 It is a flow chart of another embodiment of S1 in the present application.
[0068] like Figure 4 As shown, the following steps are included:
[0069] S14. The controller obtains the first target data and the number of write bytes corresponding to the first target data in response to the data write instruction from the host.
[0070] Each written data has a corresponding number of bytes, which is used to indicate the size of the written data; that is, when acquiring the first target data, the size of the first target data is determined, that is, the number of written bytes corresponding to the first target data is determined.
[0071] S15. If the number of bytes to be written is greater than the first preset number of bytes, the first target data is divided into a plurality of first target sub-data with the first preset number of bytes as a limit.
[0072] According to the limitation of the RPMB hardware encryption and decryption area, each written data is required not to exceed a preset number of bytes. Therefore, a first preset number of bytes is set to limit the size of the written data.
[0073] Specifically, after obtaining the number of write bytes corresponding to the first target data, the number of write bytes is compared with the first preset number of bytes. If the number of write bytes is greater than the first preset number of bytes, the first target data is divided according to the first preset number of bytes to obtain multiple segments of first target sub-data corresponding to the first target data; if the number of write bytes is less than or equal to the first preset number of bytes, the first target data and the corresponding RPMB hardware count are directly encrypted and stored.
[0074] S16. In the RPMB hardware encryption and decryption area, multiple segments of first target sub-data are respectively encrypted with the RPMB hardware count to obtain multiple first encrypted sub-information corresponding to the first target data; wherein the data volume of each first encrypted sub-information is the second preset number of bytes, and the second preset number of bytes is greater than the first preset number of bytes.
[0075] Among them, because the first target data is divided into multiple segments of first target sub-data, when writing to the storage device, each write data has a corresponding RPMB hardware count. Therefore, it is necessary to encrypt the multiple segments of first target sub-data and the corresponding RPMB hardware counts respectively; the second preset byte number refers to the number of bytes after the first preset byte number is encrypted for the first target sub-data.
[0076] Specifically, after the controller divides the first target data into multiple segments of first target sub-data, the controller encrypts the multiple segments of first target sub-data and the corresponding RPMB hardware counts in the RPMB hardware encryption and decryption area, and then obtains the corresponding multiple first encrypted sub-information of the first target data divisions.
[0077] In some embodiments, if the data volume of the last first target sub-data of the first target data divided is less than the first preset number of bytes, then after the first target sub-data and the RPMB hardware count are encrypted, the data volume of the obtained first encrypted sub-information is greater than the first preset number of bytes and less than the second preset number of bytes.
[0078] S17: Store the plurality of first encrypted sub-information into a storage unit.
[0079] Specifically, after acquiring the plurality of first encrypted sub-information, the controller stores the plurality of first encrypted sub-information one by one into the storage unit to complete the encrypted storage of the first target data.
[0080] For example: when the first target data requested to be written by the host is 1200Byte, the controller divides the write data into 4 256Bytes and 1 176Byte in sequence, and then encapsulates and encrypts each divided first target sub-data and the corresponding RPMB hardware count to form the first encrypted sub-information of the corresponding RPMB access data format frame, wherein the 256Byte first target sub-data is encapsulated and encrypted into the 512Byte first encrypted sub-information, and the 176Byte first target sub-data is encapsulated and encrypted into the 352Byte first encrypted sub-information; and then the 5 encrypted first encrypted sub-information are stored in the storage unit of the storage device through the RPMB write sequence command.
[0081] In this embodiment, by obtaining the number of write bytes corresponding to the first target data, the first target data exceeding the first preset number of bytes is divided so that the write data has a uniform number of bytes, thereby ensuring a uniform format of the write data, facilitating subsequent read operations, and improving read and write efficiency.
[0082] See also Figure 5 , Figure 5 It is a flow chart of an embodiment of step S2 of the present application.
[0083] like Figure 5 As shown, the following steps are included:
[0084] S21. Encrypt the data read instruction in the RPMB hardware encryption and decryption area using the key and hardware information corresponding to the storage unit.
[0085] In order to read the data in the storage unit, the key corresponding to the storage unit and the related hardware information are needed to decrypt the data to be read. The key and the corresponding hardware information are plain text data and cannot be directly stored in the storage unit. They need to be encrypted before being sent to the storage unit.
[0086] Specifically, when a user sends a data read instruction to the storage device through the host, in response to the data read instruction, the controller encrypts the data read instruction in the RPMB hardware encryption and decryption area of the storage device using the key and hardware information corresponding to the storage unit, so that the key and hardware information are encapsulated and encrypted to form corresponding encrypted data, which can then be stored in the storage unit.
[0087] S22. Send the encrypted data read instruction to the storage unit, so that the storage unit completes the authentication of the encrypted data read instruction based on the key and the hardware information, and returns the corresponding second target data based on the data read instruction.
[0088] Among them, the hardware information includes relevant information corresponding to the storage unit, such as RPMB hardware count, the size of the RPMB hardware encryption and decryption area, the size of the access area, the size of the allowed reading area, etc., and when the data reading instruction is encrypted and packaged and sent to the storage unit, it contains the corresponding key and hardware information. Therefore, the authentication of the encrypted data reading instruction can be completed based on the key and hardware information.
[0089] Specifically, after encrypting the data read instruction, the controller sends the encrypted data read instruction to the storage unit, and the storage unit authenticates the encrypted data read instruction based on the key and hardware information. When the authentication is successful, the storage unit returns the corresponding second target data based on the request of the data read instruction; at this time, the returned second target data is encrypted data.
[0090] Therefore, in order for the host to obtain the plaintext data, the controller is also required to decrypt the second target data.
[0091] In some embodiments, the controller decrypts the second target data using the key and hardware information corresponding to the storage unit to obtain the decrypted second target data, and then sends the decrypted second target data to the host end.
[0092] In this embodiment, the controller automatically decrypts the data to be obtained in the RPMB hardware encryption and decryption area, so that the host side can obtain the corresponding decrypted plaintext data, which facilitates users to read the encrypted data in the storage device and improves the reading and writing efficiency.
[0093] See also Figure 6 , Figure 6 It is a flowchart of another embodiment of step S2 of the present application.
[0094] like Figure 6 As shown, the following steps are included:
[0095] S23, determining the number of bytes to be read by the data read instruction;
[0096] When a data read instruction is sent from the host to the storage device, the controller obtains the data read instruction and determines the number of read bytes of the data to be obtained by the data read instruction to determine the size of the data to be obtained.
[0097] S24. If the number of bytes to be read is greater than the first preset number of bytes, the data read instruction is encrypted in the RPMB hardware encryption and decryption area, and the encrypted data read instruction is sent to the storage unit, and multiple second target data corresponding to the data read instruction are obtained from the storage unit, wherein the data volume of the second target data is the second preset number of bytes, and the second preset number of bytes is greater than the first preset number of bytes.
[0098] Among them, since the data reading instruction has corresponding restrictions, such as the RPMB read command has a maximum data frame limit, it is necessary to set a first preset number of bytes to limit the size of data read each time.
[0099] Specifically, after the controller determines the number of read bytes of data to be obtained by the data read instruction, the controller judges the number of read bytes based on the first preset byte number. If the number of read bytes is greater than the first preset byte number, the controller encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit, and obtains multiple second target data corresponding to the data read instruction from the storage unit; in the data writing stage, the plaintext data corresponding to the first preset byte number is encrypted to form encrypted data corresponding to the second preset byte number, and the second preset byte number is greater than the first preset byte number. Therefore, when the number of read bytes is greater than the first preset byte number, the data read instruction corresponds to multiple second target data, and the data volume of the second target data is the second preset byte number.
[0100] In some embodiments, according to different read byte numbers of the data read instruction, among the corresponding plurality of second target data, there may be second target data with a data volume smaller than the second preset byte number.
[0101] S25. Decrypt multiple second target data in the RPMB hardware encryption and decryption area, and integrate the decrypted second target data and send them to the host end.
[0102] The acquired second target data is encrypted data, which needs to be decrypted by the controller to obtain the corresponding decrypted data, and then sent to the host end, so that the user can directly read the decrypted data that forms plain text data.
[0103] Specifically, after the controller obtains multiple second target data corresponding to the data read instruction from the storage unit, the controller decrypts the multiple second target data respectively in the RPMB hardware encryption and decryption area to obtain multiple corresponding decrypted second target data, and then integrates the multiple corresponding decrypted second target data and sends them to the host side, so that the user can obtain the complete required data.
[0104] For example: when the data read instruction on the host side requests to read 1200Byte of data, 1200Byte is greater than the first preset byte number of 256Byte. The plaintext data of the first preset byte number of 256Byte is encrypted to form encrypted data of the second preset byte number of 512Byte. Therefore, the controller encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit, and obtains 4 512Byte second target data and 1 352Byte second target data corresponding to the data read instruction from the storage unit; the controller decrypts the 4 512Byte second target data and 1 352Byte second target data in the RPMB hardware encryption and decryption area to obtain 4 256Byte decrypted second target data and 1 176Byte decrypted second target data, and integrates the decrypted second target data to obtain 1200Byte of plaintext data, and then sends it to the host side.
[0105] In some embodiments, when the host initiates a data read instruction corresponding to a number of read bytes greater than N 512 bytes, the controller will execute a read operation N times, each time reading 512 bytes of data, to satisfy the data read request corresponding to the data read instruction of the host; if the number of read bytes is greater than 32 512 bytes, the controller will execute a read operation 32 times, each time reading 512 bytes of data.
[0106] In this embodiment, by obtaining the number of read bytes corresponding to the data read instruction, at least one corresponding second target data is obtained based on the number of read bytes, and the data volume of each second target data does not exceed the second preset number of bytes, so that the data volume of the decrypted second target data does not exceed the first preset number of bytes, thereby ensuring a unified format for the written data, facilitating subsequent read operations, and improving read and write efficiency.
[0107] See also Figure 7 , Figure 7 It is a flow chart of an embodiment of a data processing method applied to a host side in the present application.
[0108] like Figure 7As shown, the data processing method is applied to the host side, the host side is coupled to the storage device, the storage device includes the RPMB hardware encryption and decryption area, the controller and the storage unit, and the data processing method includes the following steps:
[0109] In the data writing process, as follows:
[0110] Y1. The host sends a data write instruction to the storage device, so that the controller of the storage device responds to the data write instruction of the host, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data to the storage unit.
[0111] Specifically, when the user needs to write data, the user sends a data write instruction to the storage device through the host side, so that the controller of the storage device encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area based on the data write instruction from the host side, thereby encrypting the write data sent by the host side in the storage device and storing it in the storage unit, avoiding complex data encryption and decryption on the host side.
[0112] In the data reading process, as follows:
[0113] Y2. The host sends a data read instruction to the storage device, so that the controller of the storage device responds to the data read instruction, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit to obtain the corresponding second target data fed back by the storage unit;
[0114] Y3. After the storage device decrypts the second target data in the RPMB hardware encryption and decryption area, the host receives the decrypted second target data.
[0115] Specifically, when a user needs to read data, the user sends a data read instruction to the storage device through the host side, so that the controller of the storage device responds to the data read instruction, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit. After the storage device obtains the corresponding second target data fed back by the storage unit, the storage device decrypts the second target data in the RPMB hardware encryption and decryption area, and the host side receives the decrypted second target data, so that the user can read the decrypted data directly through the host side without the need to decrypt it on the host side.
[0116] In this embodiment, the user only needs to send a data read instruction or a data write instruction on the host side to access the RPMB hardware encryption and decryption area of the storage device, and can directly receive the decrypted data on the host side, avoiding the complex verification process of encryption and decryption on the host side and improving data reading and writing efficiency.
[0117] See also Figure 8 , Figure 8 It is a structural diagram of an embodiment of a data processing system in the present application. The data processing system 400 includes: a host end 410 and a storage device 420 coupled to the host end 410. A computer program is stored in the storage device 420. The storage device 420 executes the computer program to implement a data processing method applied to the storage device 420.
[0118] In another embodiment, the data processing system includes: a host end and a storage device coupled to the host end, the host end stores a computer program, and the host end executes the computer program to implement a data processing method applied to the host end.
[0119] The above technical scheme provides a data processing method, which is applied to a storage device, wherein the storage device includes a RPMB hardware encryption and decryption area, a controller and a storage unit, and the data processing method includes: the controller responds to a data write instruction of the host side, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit; or, the controller responds to a data read instruction of the host side, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit, obtains the corresponding second target data fed back by the storage unit, and decrypts the second target data in the RPMB hardware encryption and decryption area, and sends the decrypted second target data to the host side. That is, in the data reading and writing of the storage device of the present application, the controller autonomously encrypts the write data according to the data write instruction, and then stores it in the storage unit; or the controller autonomously decrypts the data in the RPMB hardware encryption and decryption area according to the data read instruction, and returns the decrypted data to the host side, so that the user can access the RPMB hardware encryption and decryption area based on the UI and other plain text forms, while ensuring data security, reducing the time-consuming tedious encryption verification of accessing the RPMB encryption area on the host side, and improving the efficiency of data reading and writing.
[0120] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the system implementation described above is only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0122] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0123] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment 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), disk or optical disk and other media that can store program code.
[0124] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data processing method, characterized in that: Applied to a storage device, the storage device includes an RPMB hardware encryption and decryption area, a controller and a storage unit, and the data processing method includes: The controller responds to a data write instruction from the host side, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit; Or, the controller responds to a data read instruction from the host side, encrypts the data read instruction in the RPMB hardware encryption and decryption area, sends the encrypted data read instruction to the storage unit, obtains the corresponding second target data fed back by the storage unit, decrypts the second target data in the RPMB hardware encryption and decryption area, and sends the decrypted second target data to the host side.
2. The data processing method according to claim 1, characterized in that: The controller, in response to a data write instruction from the host, encrypts first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data in the storage unit, including: The controller obtains the first target data and the RPMB hardware count of the storage device in response to a data write instruction from the host; Encrypting the first target data and the RPMB hardware count in the RPMB hardware encryption and decryption area to obtain first encrypted information; The first encrypted information is stored in the storage unit.
3. The data processing method according to claim 2, characterized in that: After acquiring the first target data, the data processing method further includes: Obtaining the number of written bytes corresponding to the first target data; If the number of bytes to be written is greater than a first preset number of bytes, the first target data is divided into a plurality of first target sub-data segments with the first preset number of bytes as a limit; The first target data and the RPMB hardware count are encrypted in the RPMB hardware encryption and decryption area to obtain first encrypted information, including: In the RPMB hardware encryption and decryption area, multiple segments of first target sub-data are respectively encrypted with the RPMB hardware count to obtain multiple first encrypted sub-information corresponding to the first target data; wherein the data amount of each first encrypted sub-information is a second preset number of bytes, and the second preset number of bytes is greater than the first preset number of bytes; The step of storing the first encrypted information in the storage unit comprises: The plurality of first encrypted sub-information are stored in the storage unit.
4. The data processing method according to claim 2, characterized in that: The step of storing the first encrypted information in the storage unit comprises: The controller sends the RPMB hardware count and the first encryption information to the storage unit, so that the storage unit verifies the RPMB hardware count and the first encryption information, and stores the first encryption information after the verification is successful.
5. The data processing method according to claim 1, characterized in that: The step of encrypting the data read instruction in the RPMB hardware encryption and decryption area, and sending the encrypted data read instruction to the storage unit, to obtain the corresponding second target data fed back by the storage unit, comprises: Encrypt the data read instruction in the RPMB hardware encryption and decryption area using the key and hardware information corresponding to the storage unit; The encrypted data read instruction is sent to the storage unit, so that the storage unit completes the authentication of the encrypted data read instruction based on the key and the hardware information, and returns the corresponding second target data based on the data read instruction.
6. The data processing method according to claim 5, characterized in that: Decrypting the second target data in the RPMB hardware encryption and decryption area includes: The second target data is decrypted using the key and hardware information corresponding to the storage unit.
7. The data processing method according to claim 1, characterized in that: The step of encrypting the data read instruction in the RPMB hardware encryption and decryption area, and sending the encrypted data read instruction to the storage unit, to obtain the corresponding second target data fed back by the storage unit, comprises: Determine the number of bytes to be read for the data read instruction; If the read byte number is greater than the first preset byte number, encrypt the data read instruction in the RPMB hardware encryption and decryption area, send the encrypted data read instruction to the storage unit, and obtain a plurality of the second target data corresponding to the data read instruction from the storage unit, wherein the data volume of the second target data is the second preset byte number, and the second preset byte number is greater than the first preset byte number; Decrypting the second target data in the RPMB hardware encryption and decryption area, and sending the decrypted second target data to the host end, includes: The plurality of second target data are decrypted in the RPMB hardware encryption and decryption area, and the decrypted second target data are integrated and sent to the host end.
8. The data processing method according to claim 1, characterized in that: Before the controller responds to a data write instruction or a data read instruction from the host, the data processing method further includes: In response to the storage device being powered on, initializing the storage device to obtain a key and hardware information corresponding to the storage device; Encapsulating the key, the hardware information and the write request into the data write / read instruction; or, The key, the hardware information and the read request are packaged into the data read instruction.
9. A data processing method, characterized in that: Applied to a host side, the host side is coupled to a storage device, the storage device includes an RPMB hardware encryption and decryption area, a controller and a storage unit, and the data processing method includes: The host sends a data write instruction to the storage device, so that the controller of the storage device responds to the data write instruction of the host, encrypts the first target data corresponding to the data write instruction in the RPMB hardware encryption and decryption area, and stores the encrypted first target data to the storage unit; Or, the host sends a data read instruction to the storage device, so that the controller of the storage device responds to the data read instruction, encrypts the data read instruction in the RPMB hardware encryption and decryption area, and sends the encrypted data read instruction to the storage unit to obtain the corresponding second target data fed back by the storage unit; after the storage device decrypts the second target data in the RPMB hardware encryption and decryption area, the host receives the decrypted second target data.
10. A data processing system, characterized in that: The data processing system includes: a host end and a storage device coupled to the host end, wherein a computer program is stored in the storage device, and the storage device executes the computer program to implement the data processing method according to any one of claims 1-8.
11. A data processing system, characterized in that: The data processing system comprises: a host end and a storage device coupled to the host end, wherein a computer program is stored in the host end, and the host end executes the computer program to implement the data processing method according to claim 9.
