A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
The invention relates to securing data, and correcting errors in memory devices, especially flash memory devices in portable electronic equipment.
As portable electronic devices become more popular, securing data is necessary. That is, these devices may contain personal and confidential information and they are easily lost or stolen. To protect data, users may employ encryption and decryption techniques. These techniques encrypt data prior to storing them and decrypt data after accessing them. A key enables secure data handling.
“Plaintext” is data before encryption, while “ciphertext” is data after encryption. Various encryption algorithms (known collectively as “ciphers”) protect sensitive information stored in various memory devices. These encryption methods may be divided into two categories, symmetric key algorithms and asymmetric key algorithms. A user of a symmetric key algorithm keeps an encryption key secret (“private key”).while a user of an asymmetric key algorithm employs two different keys. Of the two asymmetric keys, one enables any sender to encrypt data (“public key”) and the other key, only known to a receiver, allows decryption of data (“private key”).
A symmetric key algorithm can be further categorized into two types called block ciphers and stream ciphers. Block ciphering involves dividing data into various blocks and encrypting each block, while stream ciphering involves encrypting continuous streams of data. Block ciphering can be implemented using various ciphering techniques such as but not limited to Electronic Code Book mode (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), and Output Feedback (OFB). The ECB technique involves dividing data into blocks and encrypting each block with the same encryption key. However if identical plaintext blocks are encrypted using the ECB method, identical ciphertext blocks are generated making the encrypted data vulnerable to security attacks. The CBC method involves an initialization vector (IV) to encrypt (XOR) a first block. This generates a first ciphertext which in turn is used to encrypt the second block. Then the second ciphertext is used to encrypt the third block and so on to the end of the plaintext.
Cipher Feedback (CFB) is similar to Cipher Block Chaining (CBC), but instead of encrypting the XORed block, it starts by encrypting a seeded value, and then XORing the encrypted seeded value with the first block. The first block of cipher text generated is encrypted and XORed with the second block. This process is repeated until all data are encrypted. Output Feedback is similar to Cipher Feedback. OFB begins by encrypting the seed and XORing that value with the first block of clear text to obtain the first block of cipher text. The encrypted seed is then encrypted again, and then that value is used to XOR with the second block. This process is repeated until all the blocks are encrypted.
Data security may be enhanced by using a unique IV to encrypt each chain (n number of blocks can be called a chain). Initialization vector n bits long can provide 2n different IV values; however the odds of two IVs being the same would be square root of 2n. For example, four bytes of data would provide 232 (4,294,967,296) different values, the odds of two IVs being the same in the scenario is 216 (65,536). If each unique IV value is used to encrypt a segment (assuming 512 bytes of memory), the IV would repeat itself at 512* 65,536 bytes (32 MB). As current data storage technology, such as flash memory, may hold gigabytes of data, the chance of an IV repeating itself is high. Prior art systems address this problem by increasing the size of the IV, thus reducing the probability of repetition. Prior art systems stored the IV used to encrypt data in an external memory device, fetching the IV as needed to decrypt data. This technique has performance limitations. The existing encryption techniques are not efficient because of, among other things, loss of performance, reduced error correction capability, and reduction of available storage space. This invention has been made to address these failings in the prior art. This invention provides a mechanism to encrypt and decrypt data stored in memory devices, especially flash memory devices, without compromising error correction capability.
As described in U.S. Pat. No. 7,137,011, the functions of encryption and decryption may involve a host computer and a daughter memory card. The host often is a personal computer. The daughter card, in many cases incorporating non-volatile flash memory, is removeably connected to a mother card on the host computer. This allows the daughter card to be moved among different mother cards, thus allowing data to be transferred between different host computers. Because of the possibility of theft or loss of the daughter card, data may need to be encrypted. To encrypt or decrypt data, it is necessary to store keys and algorithms. In the '011 patent, storage of a decryption algorithm is on the daughter card. Not described in the '011 patent is any detail on how encryption and decryption is performed.
U.S. Pat. No. 6,618,789 describes how an encryption algorithm can be stored on the daughter memory card. A data processing unit and the memory card each have an encrypting function allowing data processing unit and memory card to be mutually authenticated. The memory card has processing circuitry to allow data encryption and authentication.
The '789 patent further describes how to employ the encryption function according to Data Encryption Standard (DES): “The DES is a block encrypting system in which text is block-segmented and each block segment is encrypted. With DES, input data of 64 bits is encrypted with a key of 64 bits (in reality, a key of 56 bits and a parity of 8 bits) and encrypted data of 64 bits is output. The DES has four use modes, one of which is a Cipher Block Chaining mode. The [Cipher Block Chaining] mode is a feedback type mode in which text of 64 bits and the preceding encrypted data (of 64 bits) are XORed and the result is input to the DES unit. In the initial state, since there is no encrypted data, an initialization vector is used. In addition, as data are being exchanged between the set and the memory card, random numbers may be generated and added to the data.”
A drawback of the prior art described in the '789 patent is that it is limited to DES; the invention in this patent application discloses the use of Advanced Encryption Standard (AES) in place of DES. One difference between AES and DES is that AES supports a larger range of block and key sizes; AES has a fixed block size of 128 bits and a key size of 128, 192 or 256 bits. Another difference is that DES has been compromised by brute force computer attacks while AES is resistant. It is not a simple matter of substituting AES for DES encryption in an application; implementing AES in an architecture is beyond the ability of someone of ordinary skill in the art of implementing DES.
A method and apparatus of configuring the byte structure of a memory device, including a flash memory device, to enhance the security and error correction capability is described. In one embodiment, the method includes increasing the security of data stored in the memory device by encrypting data by a unique initialization vector and storing the initialization vector in the memory device. The method also includes using a unique initialization vector for encrypting data, to be stored in each datablock, each time data are encrypted.
In one embodiment, the apparatus includes an AES controller that includes encryption and decryption modules to encrypt and decrypt data prior to writing data to or reading from a storage device. The apparatus also includes encoder module and decoder circuits to encode and decode data prior to writing or reading from memory devices. The apparatus optionally includes a state machine that generates, selects, or retrieves, and provides the initialization vector and also activates different components of AES controller and ECC module depending on the operation of the device.
For the purposes of this application, references to “storage device” and “flash memory” include memory devices in general including but not limited to, flash memory, RAM, non-volatile memory, hard drive, and equivalents including data transmitted over communications media. Likewise, references to RAM include equivalents such as but not limited to non-volatile memory.
The details of the present invention, both as to its structure and operation, and many of the attendant advantages of this invention, can best be understood in reference to the following detailed description, when taken in conjunction with the accompanying drawings, in which like reference numerals refer to like parts throughout the various views unless otherwise specified, and in which:
a illustrates a configuration byte structure of flash memory device at datablock level.
FIG's 3b, 3c, and 3d illustrate alternative configuration byte structure of flash memory device at datablock level.
FIG's 7a, 7b, and 7c illustrate the operation of state machine during write process.
FIG's 8a, 8b, 8c, and 8d illustrate the operation of state machine during read process.
The AES controller 125 encrypts or decrypts data that is being the written to or read from a target storage device. ECC controller 130 encodes and decodes data prior to being written or read from target storage devices to detect and correct the errors. Processing system 115 is used to generate the control signals required to activate the AES controller 125 and ECC controller 130.
Device Interface 120
In one embodiment, host controller 105 transfers data to RAM module 110 using data signal 250 and initiates a write cycle using the control signal 260. Host interface 105 notifies the state machine 205 utilizing the control signal cntrl_sig1260 to notify that data are available in the RAM module 110. The state machine 205 activates the encryption module 225 to encrypt data stored in the RAM module 110 using the control signal cntrl_sig2265 and provides the IV stored in the processing system interface registers 220 utilizing the IV signal 270. AES controller 125 stores data encrypted by the encryption module 225 in the RAM module 110 using data signal 275. State machine 205 activates the encoder module 235 of ECC controller 130 to encode the encrypted data, IV, and status/firmware bits by activating the control signal cntrl_sig3280. Encoder module 235 encodes data and generates the parity bits and provides the parity using signal data/parity 285. State machine 205 commands the device interface 120 using control signal cntrl_sig4245 to transfer data and parity to the target flash memory device.
In one embodiment, host controller 105 requests the device interface module 120 to read data from the target flash memory device using the control signal rd/wr 255. State machine 205 commands device interface module 120 using control signal cntrl_sig4245 to read data from the flash memory device and write to the RAM module 110. RAM module 110 notifies state machine 205 that data are available to read using control signal 265. The state machine 205 on receiving data generates a control signal cntrl_sig3280 to activate the decoder module 240 of ECC controller 130. Decoder module 240 decodes data to detect and correct errors in data stored in the flash memory device. If no errors are present in the decoded data, the state machine 205 activates the decryption module 230 of the AES controller 125 using the control signal cntrl_sig2265. In case, where the decoder module 240 detects the errors that can be fixed, the decoder corrects the errors in data and the corrected data are provided to the decoder module 240. If the detected errors are not correctable, state machine 205 employs error measures such as but not limited to notifying the host interface 105 that data are corrupt. The decryption module 230 decrypts data and provides the decrypted data using data signal 275. The host interface 105 reads the decrypted data from the RAM module 110.
a illustrates flash memory device having m datablocks, datablock-1 to datablock-m 3051-305m. Datablocks datablock-1 to datablock-m 3051-305m are designed to store an IV, status/firmware bits, data and parity bits. Each datablock datablock-1 to datablock-m 3051-305m utilizes unique IV initialization vector-1 to initialization vector-m 3101-310m and firmware/status bits 3151-315m to encrypt data respectively. Each type of datablock, datablock 1, datablock m, and datablock n (3051, 305m, and 305n), can be further divided into n segments (referred to as chain), such as segment 1x1, segment 1x2 to segment 1xn ((32O1x1, 3301x2 to 3401xn), to store encrypted data and ECC blocks, ECC 1x1, ECC 1x2 to ECC 1xn ((3251x1, 3351x2 to 3451xn)n)) to store ECC parity bits. The present invention configures each datablock to store an efficient IV in a storage device without affecting the performance, and ability to detect or correct errors of data stored in the flash memory.
Table 1 illustrates how the present invention enhances the error correction capability of the flash memory by increasing the size of segments.
It may be assumed that 4K datablock bytes of flash memory has 128 bits of redundant data space available per 512 bytes of data. Based on the assumptions there would 128 bytes (128*8 bits) of redundant data space available. The 4K datablock of flash memory can be divided into eight segments of 512 bytes or four segments of 1024 bytes. In the scenario, where the datablock is divided into eight segments of 512 bytes, 128 bytes of redundant space available is used for 4 bytes for IV, 2 bytes for firmware/status bytes and 120 bytes (15 bytes for each segment) for storing parity bits. The fifteen bytes of ECC for each segment may be able to correct up to 8 bits of errors. Whereas, if 4K datablock of flash memory is divided into four segments of 1024 bytes, 128 bytes of redundant data available for the datablock is utilized for 14 bytes of IV, two bytes for firmware or status bytes and 28 bytes of ECC data for each segment. The 28 bytes of ECC data may be able to correct up to 16 bits errors in data stored in the flash memory. Thus by organizing the 4K datablocks into bigger segments, the present invention provides an efficient solution to enhance security and the error correction capability.
Table 2 illustrates the byte structure of the 4K datablocks of flash memory depending on the redundant data space available.
For example, a 4K datablock having a redundant space of 128 bits for every 512 bytes can be configured to include 14 bytes of IV and 2 bytes of firmware status and four segments, each segment having 1024 bytes of storage space and 4 ECC blocks of 28 bytes. On the other hand, a 4K datablock having redundant space of 218 bits for every 512 bytes can be configured to include 16 bytes of IV and 2 byte of firmware status and four segments, each segment having 1024 bytes of storage space and 4 ECC blocks having 49 bytes. The redundant data space available thus increases the error correction capability of data stored in segments.
FIG's 3b and 3c depict how datablocks datablock-1 to datablock-m 3051-305m can be alternately organized to achieve similar results as configuration shown in
In
d illustrates another embodiment of the invention in which each segment segment-1, segment-2 to segment-n (3201x1, 3301x2-3401xn) uses the initialization vector, initialization vector-13101, with different offsets to encrypt data. Offset can be introduced by adding one or more bits to the initialization vector-13101.
FIG's 7a, 7b, and 7c illustrate the operation of the state machine 205 on detecting write command from the host interface 105. State machine 205 may initially operate in an idle state (step 805). The state machine 205 verifies if a write cycle is initiated by the host interface 105 on predetermined intervals and if the write cycle is not initiated it returns to idle state (step 810). (Alternately, the state machine 205 may wait for an interrupt signal from the host interface.) If the write cycle is initiated by the host interface 105, the state machine 205 verifies if target location is first segment of a datablock (step 815). If the target location is the first segment, state machine 205 updates the IV and provides the IV to the encryption module 225 of the AES controller (step 820). State machine 205 checks if data are ready for the encryption module to read and encrypt (step 825). If data are ready, the encryption module 225 obtains data and encrypts data by performing the encryption method shown in
If the state machine 205 determines that the target location in the flash memory device is anything other than that the first segment, the state machine 205 determines the target segment that needs to be updated (step 850). Prior to writing to the target segments, the state machine reads data from segment and the successive segments (step 855). Data read from the successive segments are decrypted (step 860). Data are read from the preceding segment and data of last AES block of the preceding segment is extracted (step 865). Data of the preceding segment's last AES block is used to encrypt data that needs to be written to the target segment. Data of the successive segments are encrypted again by using the encrypted data of the last AES block of the updated target segment. Once data are encrypted, the state machine returns to step 835 to encode data (step 870).
a,
If no errors are detected, the decryption module 230 of the AES controller decrypts data (step 955). State machine 205 verifies if data are read from the last segment of the chain of segments in the datablock (step 960). In case data are not read from the last segment of chain of segments of the datablock, the state machine returns to step 925. If data are read from the last segment of the chain of segments of the datablock, state machine 205 verifies if more data needs to be read from a different chain of segments of another datablock and if more data needs to be read, the state machine 205 returns to step 915 otherwise returns to idle state (step 965). If more data needs to be read from another datablock, it returns to idle state, otherwise state machine 205 returns to step 920 (step 970).
If data needs to be read from a segment other than the first segment, the state machine identifies the location of the target segment (step 975). State machine reads data of the preceding segment and extracts the preceding segment's last AES block and returns to step 925.
While the particular method and apparatus as herein shown and described in detail is fully capable of attaining the above-described objects of the invention, it is to be understood that it is the presently preferred embodiment of the present invention and is thus representative of the subject matter which is broadly contemplated by the present invention, that the scope of the present invention fully encompasses other embodiments which may become obvious to those skilled in the art, and that the scope of the present invention is accordingly to be limited by nothing other than the appended claims, in which reference to an element in the singular means “at least one”. All structural and functional equivalents to the elements of the above-described preferred embodiment that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the present claims. Moreover, it is not necessary for a device or method to address each and every problem sought to be solved by the present invention, for it to be encompassed by the present claims. Furthermore, no element, component, or method step in the present disclosure is intended to be dedicated to the public regardless of whether the element, component, or method step is explicitly recited in the claims.
This application claims the benefit of U.S. Provisional Application No. 60/988,050 filed Nov. 14, 2007.
Number | Date | Country | |
---|---|---|---|
60988050 | Nov 2007 | US |