1. Field
The present invention relates generally to performing a message integrity check in a file system of small sectors.
2. Background
As the storage capability of storage devices increases, an execution time for an integrity check based on calculating a hash value for an entire storage device also increases. As a result, when a target file is accessed, an integrity check is preferred to apply only at the target file to avoid unnecessary delays from accessing its adjacent area. A typical integrity check on a file may use an inline integrity check based on a hash chain. In the inline integrity check, a hash value may be calculated initially for each sector or block (usually 4 KB) of the storage device, and these hash values may be stored in a chain (or tree structure). The whole chain (or tree) of hash values is then hashed to compute an overall hash value. Prior to performing an inline integrity check on a file, the hashes of all sectors are verified first by matching the overall hash value to a previously stored hash value.
After a subsequent access to a file, an integrity check only needs to be performed on the affected sectors, i.e., the sectors storing the accessed file. This causes an efficiency issue for small sectors, e.g., 4 KB sectors, because most hash algorithms, such as SHA-1 and SHA-256, are fast for long messages but the overhead for initialization and completion is costly. For example, the driver for a hardware-based SHA-256 crypto engine usually has three functions to call: init( ), update( ), and final( ). For a short message, the communication overhead between the driver and the crypto engine takes longer than the hardware hash operation. Accordingly, a major delay due to algorithm setup and final processing may result when hashing a small sector. Thus, a hash chain based integrity check may not be efficient for a storage device using a file system of small sectors.
There is therefore a need for a technique for efficiently performing a message integrity check in a file system using small sectors.
An aspect of the invention may reside in a method for performing a message integrity check. In the method, a processor reads a message from a storage device. The message comprises a plurality of first level sections. The processor determines one or more second level sections from the plurality of first level sections. Each second level section comprises a fixed number of first level sections. A crypto engine calculates a hash value for each second level section to generate a respective calculated hash value, and a hash value for each first level section not included in a second level section to generate a respective calculated hash value. The processor compares each of the respective calculated hash values with a corresponding stored hash value. The processor provides an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
In more detailed aspects of the invention, the crypto engine may be a hardware crypto engine. Each second level section may comprise eight first level sections. The message may comprise a file.
Another aspect of the invention may reside in an apparatus, comprising: means for reading a message from a storage device, wherein the message comprises a plurality of first level sections; means for determining one or more second level sections from the plurality of first level sections, wherein each second level section comprises a fixed number of first level sections; means for calculating a hash value for each second level section to generate a respective calculated hash value; means for calculating a hash value for each first level section not included in a second level section to generate a respective calculated hash value; means for comparing each of the respective calculated hash values with a corresponding stored hash value; and means for providing an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
Another aspect of the invention may reside in an apparatus, comprising: a memory configured to store a message comprising a plurality of first level sections; a crypto engine configured to calculate a hash value for a level section; and a processor configured to: determine one or more third level sections from the plurality of first level sections, wherein each third level section comprises a first fixed number of first level sections; determine whether one or more second level sections may be formed from first level sections not included in a third level section, wherein each second level section comprises a second fixed number of first level sections, and the first fixed number is an integer multiple of the second fixed number; compare each respective calculated hash value calculated for each third level section with a corresponding stored hash value; compare each respective calculated hash value calculated for each second level section with a corresponding stored hash value; compare each respective calculated hash value calculated for each first level section, not included in a second level section or a third level section, with a corresponding stored hash value; and provide an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
In more detailed aspects of the invention, the each third level section may comprise 256 first level sections, and each second level section may comprise 8 first level sections.
Another aspect of the invention may reside in a computer-readable medium, comprising: code for causing a computer to read a message from a storage device, wherein the message comprises a plurality of first level sections; code for causing a computer to determine one or more second level sections from the plurality of first level sections, wherein each second level section comprises a fixed number of first level sections; code for causing the computer to calculate a hash value for each second level section to generate a respective calculated hash value; code for causing the computer to calculate a hash value for each first level section not included in a second level section to generate a respective calculated hash value; code for causing the computer to compare each of the respective calculated hash values with a corresponding stored hash value; and code for causing the computer to provide an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
The word “exemplary” is used herein to mean “serving as an example, instance, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
With reference to
Alternatively, the integrity check may skip per-hash verification by only checking the final hash chain's integrity. After the hash chain is verified, a subsequent random access to a given level section may perform an integrity check only on the corresponding hash value, which has been verified initially.
In more detailed aspects of the invention, the storage device 230 may comprises a flash memory, or a disk drive. The crypto engine 240 may be a hardware crypto engine, or a software implementation with a crypto API. Each second level section 2ndL(N) may comprise eight first level sections S(M). The message may comprise a file.
An advantage of the invention may include the use of multiple levels of hash chains with different section lengths for the same storage device 230. As shown in
Thus, an inline integrity check may be performed using hash chains based on adaptive section lengths. Multiple level hash chains based on hashes on differing adjacent sector section lengths provides for efficiency in file systems using small sectors.
Another aspect of the invention may reside in an apparatus, comprising: means (e.g., processor 220) for reading a message from a storage device 230, wherein the message comprises a plurality of first level sections; means (e.g., processor 220) for determining one or more second level sections from the plurality of first level sections, wherein each second level section comprises a fixed number of first level sections; means (e.g., crypto engine 240) for calculating a hash value for each second level section to generate a respective calculated hash value; means (e.g., crypto engine 240) for calculating a hash value for each first level section not included in a second level section to generate a respective calculated hash value; means (e.g., processor 220) for comparing each of the respective calculated hash values with a corresponding stored hash value; and means (e.g., processor 220) for providing an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
Another aspect of the invention may reside in an apparatus 200, comprising: a memory 230 configured to store a message comprising a plurality of first level sections; a crypto engine 240 configured to calculate a hash value for a level section; and a processor 220 configured to: determine one or more second level sections from the plurality of first level sections, wherein each second level section comprises a fixed number of first level sections; compare each respective calculated hash value calculated for each second level section with a corresponding stored hash value; compare each respective calculated hash value calculated for each first level section not included in a second level section with a corresponding stored hash value; and provide an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value:
Another aspect of the invention may reside in a computer-readable medium 230, comprising: code for causing a computer 210 to read a stored message, wherein the message comprises a plurality of first level sections; code for causing the computer 210 to determine one or more second level sections from the plurality of first level sections, wherein each second level section comprises a fixed number of first level sections; code for causing the computer 210 to calculate a hash value for each second level section to generate a respective calculated hash value; code for causing the computer 210 to calculate a hash value for each first level section not included in a second level section to generate a respective calculated hash value; code for causing the computer 210 to compare each of the respective calculated hash values with a corresponding stored hash value; and code for causing the computer 210 to provide an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
More levels may be used as shown in
Another aspect of the invention may reside in an apparatus 200, comprising: a memory 230 configured to store a message comprises a plurality of first level sections; a crypto engine 240 configured to calculate a hash value for a level section; and a processor 220 configured to: determine one or more third level sections from the plurality of first level sections, wherein each third level section comprises a first fixed number of first level sections; determine whether one or more second level sections may be formed from first level sections not included in a third level section, wherein each second level section comprises a second fixed number of first level sections, and the first fixed number is an integer multiple of the second fixed number; compare each respective calculated hash value calculated for each third level section with a corresponding stored hash value; compare each respective calculated hash value calculated for each second level section with a corresponding stored hash value; compare each respective calculated hash value calculated for each first level section, not included in a second level section or a third level section, with a corresponding stored hash value; and provide an integrity check indication if each respective calculated hash value is equal to the corresponding stored hash value.
In more detailed aspects of the invention, the each third level section may comprise 256 first level sections, and each second level section may comprise 8 first level sections.
The apparatus 200 (or a station) may be a computer 210 that includes a processor 220, memory 230 (and/or disk drives), a crypto engine 240, a display 250, and keypad or keyboard 260. The computer may also include a microphone, speaker(s), camera, and the like. Further, the device may also include USB, Ethernet and similar interfaces, for communicating over a network 270, such as the internet, with other devices and/or servers.
With reference to
Those of skill in the art would understand that information and signals may be represented using any of a variety of different technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that may be referenced throughout the above description may be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functions may be stored on as one or more instructions or code on a computer-readable medium. Computer-readable media includes computer storage media that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired program code in the form of instructions or data structures and that can be accessed by a computer. Disk and disc, as used herein, includes compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media. The computer-readable medium may be non-transitory such that it does not include a transitory, propagating signal.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.