Method and apparatus for encrypting and processing data in flash translation layer

A method for preventing a user from interpreting optional stored data information even when the user extracts the optional stored data, and an apparatus thereof. The apparatus for encrypting and processing data in a flash translation layer includes a flash memory and a controller. The flash translation layer searches at least one page of the flash memory storing the data when a write of optional data is requested from the controller, generates, corresponding to respective searched pages, a page key according to a predetermined encrypting function when the searched page supports an encryption, and encrypts and stores the data by the page key in the respective searched pages.

PRIORITY

This application claims priority under 35 U.S.C. §119(a) to an application entitled “Method and Apparatus for Encrypting and Processing Data in Flash Translation Layer” filed in the Korean Industrial Property Office on Jan. 22, 2007 and assigned Serial No. 2007-6593, the contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a flash translation layer, and more particularly to a flash memory for processing optional data and a method thereof.

2. Description of the Related Art

Generally, flash memories are storage devices, which maintain their data even during power-off. Specifically, the flash memories have low power consumption and therefore, retain their stored data, even when their power supplies are interrupted. That is, unlike Dynamic Random Access Memories (DRAMs) the flash memories are non-volatile memory devices and because the flash memories retain their stored data even when their power supplies are interrupted, they are widely used in electronic devices such as digital televisions, digital camcorders, hand-held sets (e.g., cellular phones), digital cameras, Personal Digital Assistants (PDAs), game machines, MP3 players and the like.

However, when optional data are stored in a conventional flash memory, since original data are stored without any processing, a user can extract the data from the flash memory and simply recognize the meanings of the extracted data. In particular, when a code and a debug symbol table are stored in the flash memory, the user can perform reverse engineering by reading the data stored in the flash memory.

SUMMARY OF THE INVENTION

Accordingly, the present invention has been made to solve the above-mentioned problems occurring in the prior art, and an aspect of the present invention is to provide a method for encrypting the optional stored data, such that even when the user extracts the optional stored data, the data is not easily interpreted.

In accordance with the above aspect, there is provided a method for encrypting and processing data in a flash translation layer, the method including searching at least one page of a flash memory when writing data to the memory; generating a page key corresponding to the at least one searched page according to a predetermined encrypting function when the searched page supports an encryption; and encrypting and storing the data by the generated page key in the respective searched pages.

In accordance with another aspect of the present invention, there is provided an apparatus for encrypting and processing data in a flash translation layer, including a flash memory; a controller; and a flash translation layer for searching at least one page of the flash memory when writing optional data to the memory, generating a page key corresponding to respective searched pages according to a predetermined encrypting function when the searched page supports an encryption, and encrypting and storing the data by the page key in the respective searched pages.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings. In the following description, the same elements will be designated by the same reference numerals although they are shown in different drawings. Further, various specific definitions found in the following description, such as specific values of packet identifications, contents of displayed information, etc., are provided only to help general understanding of the present invention, and it should be apparent to those skilled in the art that the present invention can be implemented without such definitions. Further, in the following description of the present invention, a detailed description of known functions and configurations incorporated herein will be omitted when it may make the subject matter of the present invention rather unclear.

Structural elements of the terminal will be described with reference toFIG. 1.

The terminal includes a controller101, a flash translation layer (FTL)105, and a flash memory107. FTL105is connected to controller101. Flash memory107is connected to FTL105.

The Flash memory107can store optional data or load optional written data under the control of controller101. In particular, flash memory107may receive and store encrypted data under the control of controller101or load optional encrypted and stored data.

Referring toFIG. 2A, flash memory107includes data blocks201and a Partition Information Table (PIT)203. Data blocks201include a plurality of blocks, and are an area for storing optional data when a write is requested from a user. Data blocks201may be divided into a plurality of partitions. Data blocks201may be authorized to have different functions according to partition regions. For example, when data blocks201is divided into two partitions, it is authorized to enable one partition region to have a read function, a write function, and an encryption storage function for storing optional encrypted data, and another partition region to have only the read function and the write function.

PIT203includes information about flash memory107. In detail, PIT203includes physical address information and the partition number information of data blocks201, Logical Block Number (LBN) information and authority information of each partition.

Authority information of each partition indicates authority that a corresponding partition region has. For example, when an optional partition region supports a read function R, a write function, and an encryption storage function C, authority information can be generated to include the fact that a corresponding partition region provides the aforementioned functions. Further, a terminal analyzes authority information of PIT203to confirm functions, which an optional partition region provides.

Moreover, in a detailed construction of data blocks201as shown inFIG. 2B, an optional block211includes a plurality of pages209. Each of pages209is divided into a main array205and a spare array207. Main array205is an area for practically storing predetermined data, and spare array207is an area for storing Meta information with respect to main array205.

The Meta information stored in spare array207will be explained with reference toFIG. 2C. The Meta information includes logical block number information213and the number information215(ECNT0-ECNT3) of cancel times. The logical block number information213(LBN0-LBN3) indicates a logical block number of a block including a current page. Number information215of cancel times indicates the number of cancel times of a block including a current page. Spare array207includes a Main array Error Checking and Correction (MECC)217and a Spare array Error Checking and Correction (SECC)219. MECC217is used to check and correct an error of a main array included in a current page. SECC219is used to check and correct an error of a spare array included in the current page. Spare array207includes bad Block Information (BI)221and Allocation Information AI223. BI221functions to indicate whether or not a block included in the current page is bad. The AI functions to indicate a state of the current page. Further, spare array207may include a reserved area RSV for storing additional information.

Where storage areas of BI221and AI223have 1 byte, and when BI221is 0xFF, it is indicated that the block is normal. In contrast to this, when BI221is not 0xFF, it is indicated that the block is abnormal. Further, when the AI223is 0xFF, it may indicate that the current page is not used, and also, when the AI223is 0xFF, it may indicate that optional data are stored in the current page. When AI223is 0x00, it may indicate that storage of the optional data in the current page is terminated.

The internal construction of flash memory107has been described with reference toFIG. 2AtoFIG. 2C.FIG. 2AtoFIG. 2Crefer to one embodiment. An area in which information about flash memory107is disposed can be changed according to how flash memory107is constructed.

Returning toFIG. 1, flash translation layer105provides an interface to a file system and an application program so that flash memory107can be used as a block device such as a Hard Disk Drive (HDD) or a Random Access Memory (RAM). In other words, flash translation layer105causes controller101to recognize flash memory107as an HDD or RAM. That is, flash translation layer105causes controller101to access flash memory107in the same manner as that of the HDD or the RAM. Flash translation layer105has a logical address-physical address event information management function, a bad block management function, and a data wear leveling function.

In particular, flash translation layer105according to the present invention includes an encryption/decryption unit103. When controller101requests a write command from flash translation layer105, flash translation layer105receives, encrypts, and stores optional data in flash memory107. Here, the write command is a command to store the optional data in flash memory107. When controller101request a read command from flash translation layer105, flash translation layer105loads, decodes, and outputs optional encrypted data from flash memory107to controller101. Here, the read command is a command to load the optional data previously stored in flash memory107.

Encryption/decryption unit103of flash translation layer105provides an encrypting function to perform an encryption/decryption, and can encrypt or decode optional data using the encrypting function. Encryption/decryption unit103cannot encrypt the optional data by a root key, and input a root key and optional data in the encrypting function to generate a processed root key. Further, encryption/decryption unit103may encrypt the optional data by the processed root key, and decode optional encrypted data.

For example, encryption/decryption unit103may provide a one-way hash function as the encrypting function. The one-way hash function indicates an equation in which a reverse operation is impossible. Specifically, the one-way hash function outputs a corresponding value to only one way as optional input value. Here, one way means that anyone can calculate a hash value for one way but cannot analogize an input value with respect to the hash value.

In particular, flash translation layer105receives a write command from controller101; it searches a page209in which optional data are stored among pages included in flash memory107. Further, flash translation layer105calculates a physical address corresponding to the searched page. Moreover, flash translation layer105analyzes spare array107included in searched page209to search logical block number information213and number information215of cancel times. Flash translation layer105calculates a logical block number corresponding to a current page and the number of cancel times of a block included in the current page. Flash translation layer105inputs a root key in the encrypting function together with the calculated physical address, logical block number, and the number of cancel times to generate a processed root key. The processed root key is referred to as the ‘page key’.

For example, when a one-way hash function is used as the encrypting function, flash translation layer105inputs the calculated physical address, logical block number, the number of cancel times, and root key in the one-way hash function to generate a processed root key hash value. The hash value can be also referred to as the ‘page key’.

Flash translation layer105encrypts optional data by the page key, and stores the optional encrypted data in searched page209.

Further, when flash translation layer105receives a read command from controller101, it searches a page including data for which a read is requested among the pages included in flash memory107. Next, flash translation layer105calculates a physical address corresponding to searched page209. Also, flash translation layer105analyzes a spare array207included in searched page209to search logical number information213and number information215of cancel times in a current page. Then, flash translation layer105calculates a logical block number corresponding to the current page and the number of cancel times of a block including the current page using the searched logical number information213and number information215of cancel times. Subsequently, flash translation layer105inputs the calculated physical address, logical block number, and the number of cancel times in the encrypting function to generate a processed root key.

Furthermore, flash translation layer105loads optical data included in searched page201, and decodes and outputs the optional loaded data by a page key to controller101.

Controller101controls respective structural elements of a terminal so as to provide various functions of the terminal. In particular, controller101of the present invention controls flash translation layer105to encrypt and store optional data in flash memory107. Otherwise, controller101controls flash translation layer105to load and decode optional data encrypted and stored in flash memory107, and to receive, change, and output corresponding data.

So far, the structural elements of the terminal according to the present invention have been explained with reference toFIG. 1toFIG. 2C. Hereinafter, the following is a procedure of storing or loading data by the terminal according to the present invention.

An operation of encrypting and storing optional data when storing the optional data in flash memory107will be now explained with reference toFIG. 3.

In order to simply explain the present invention, it is assumed that the size of optional data and the size of optional encrypted data are not greater than that of a page region, and there is an authority for performing a write function in a partition including a block having a page for storing the optional data.

In step301, flash translation layer105confirms whether a write command is inputted from controller101. Here, the write command is a command to store optional data in flash memory107. When the write command is not input, step301is repeatedly performed until the write command is input. When the write command is inputted, the routine goes to step303.

At step303, flash translation layer105searches a page in which optional data are stored among pages of flash memory107.

Specifically, flash translation layer105receives a Logical Page Number (LPN) from controller101, which is a page number in which optional data are stored. Flash translation layer105searches a page209corresponding to the received logical page number, and receives data included in main array205and spare array207of searched page209. Next, flash translation layer105confirms a logical block number by logical block number information included in spare array207, and calculates a physical address of a current page in the confirmed logical block number. A method for calculating the physical address by flash translation layer105can be changed according to sizes of a block area and a page area in flash memory107.

In step305, a decision is made to determine if the data will be encrypted. For example, flash translation layer105analyzes a partition information table203to confirm authority information of a partition including a current page. If the optional data should be stored without the encryption, the process goes to step313. When it is confirmed that encryption is necessary when storing optional data in a partition according to the authority information, flash translation layer105goes to step307.

When the process goes to step313, flash translation layer105receives optional data from controller101, and stores the optional received data in a main array of a current page209.

When the process goes to step307, flash translation layer105generates a page key for encrypting optional data.

Specifically, flash translation layer105detects the number information of cancel times included in spare array209, and calculates the number of cancel times of a block including the current page209. Further, flash translation layer105inputs the physical address, logical block number, the number of cancel times calculated in step303, and a predetermined root key in the encrypting function to generate a page key, and the process goes to step309.

Next, in step309, flash translation layer105receives optional data from the controller101, and encrypts the optional received data by the page key generated in step307, and the process goes to step311.

Subsequently, in step311, flash translation layer105stores the optional data encrypted in step309in a page201of flash memory107searched in step301.

Through the aforementioned operation, when the terminal stores optional data in flash memory107, it can encrypt and store the optional data.

Referring toFIG. 4, a description of an operation of detecting and decoding optional encrypted data when optional data are loaded from the flash memory107follows.

In order to simply explain the present invention, it is assumed that the size of optional data and the size of optional encrypted data are not greater than that of a page region, and there is an authority for performing a write function in a partition including a block having a page for storing the optional data.

In step401, flash translation layer105confirms whether a read command is inputted from controller101. Here, the read command is a command to load optional data stored in a flash memory107from controller101. When the read command is not input, the flash translation layer105repeats step401until the read command is input. When the read command is inputted, flash translation layer105goes to step403.

In step403, flash translation layer105searches a page storing optional data for which a read is currently requested among pages of flash memory107.

Specifically, flash translation layer105receives a Logical Page Number (LPN) from controller101. Here, the LPN is a page number in which optional data are stored. Next, flash translation layer105searches a page209corresponding to the received logical page number, and receives data included in a main array205and a spare array207of searched page209. Further, flash translation layer105confirms a logical block number as logical block number information included in spare array207, and calculates a physical address of a current page in the confirmed logical block number. A method for calculating the physical address by flash translation layer105can be changed according to a size of a block area and of a page area in flash memory107.

Subsequently, in step405, flash translation layer105confirms whether the optional data are encrypted. When the optional data are not encrypted, flash translation layer105goes to step413. When the optional data are encrypted, flash translation layer105goes to step407.

For example, flash translation layer105analyzes partition information table203to confirm authority information of a partition to which current page209belongs. When it is confirmed that the optional data stored in current page209are encrypted according to the authority information, flash translation layer105goes to step407. When the process goes to step413, flash translation layer105outputs optional data received from main array205of a corresponding page209to controller101.

When the process goes to step407, flash translation layer105generates a page key for decoding the optional data.

Specifically, flash translation layer105detects the number of cancel times included in spare array209, and calculates the number of cancel times of a block including a current page209according to the number information of cancel times detected. Next, flash translation layer105inputs the physical address, the logical block number, and the number of cancel times calculated in step403and a predetermined root key in the encrypting function to generate a page key, and goes to step409.

Subsequently, in step409, the flash translation layer105decodes the optional data received from the main array205of a corresponding page209in step401by a page key generated in step407, and goes to step411.

In step411, flash translation layer105outputs the optional data decoded in step409to controller101, so that controller101can perform a corresponding function.

Through the aforementioned operation, the terminal can decode and load the optional data, which are encrypted and stored from flash memory107.

For example, in the embodiment of the present invention, the flash memory included in the terminal can be attachable/detachable flash memory.

As is clear from the foregoing description, the present invention prevents a user from interpreting information in optional data stored in a flash memory even when the user extracts the optional data.