Disk encryption theory

Last updated

Disk encryption is a special case of data at rest protection when the storage medium is a sector-addressable device (e.g., a hard disk). This article presents cryptographic aspects of the problem. For an overview, see disk encryption. For discussion of different software packages and hardware devices devoted to this problem, see disk encryption software and disk encryption hardware.

Contents

Problem definition

Disk encryption methods aim to provide three distinct properties:

  1. The data on the disk should remain confidential.
  2. Data retrieval and storage should both be fast operations, no matter where on the disk the data is stored.
  3. The encryption method should not waste disk space (i.e., the amount of storage used for encrypted data should not be significantly larger than the size of plaintext).

The first property requires defining an adversary from whom the data is being kept confidential. The strongest adversaries studied in the field of disk encryption have these abilities:

  1. they can read the raw contents of the disk at any time;
  2. they can request the disk to encrypt and store arbitrary files of their choosing;
  3. and they can modify unused sectors on the disk and then request their decryption.

A method provides good confidentiality if the only information such an adversary can determine over time is whether the data in a sector has or has not changed since the last time they looked.

The second property requires dividing the disk into several sectors, usually 512 bytes (4096 bits) long, which are encrypted and decrypted independently of each other. In turn, if the data is to stay confidential, the encryption method must be tweakable; no two sectors should be processed in exactly the same way. Otherwise, the adversary could decrypt any sector of the disk by copying it to an unused sector of the disk and requesting its decryption. Whereas a purpose of a usual block cipher is to mimic a random permutation for any secret key , the purpose of tweakable encryption is to mimic a random permutation for any secret key and any known tweak .

The third property is generally non-controversial. However, it indirectly prohibits the use of stream ciphers, since stream ciphers require, for their security, that the same initial state not be used twice (which would be the case if a sector is updated with different data); thus this would require an encryption method to store separate initial states for every sector on disk—seemingly a waste of space. The alternative, a block cipher, is limited to a certain block size (usually 128 or 256 bits). Because of this, disk encryption chiefly studies chaining modes, which expand the encryption block length to cover a whole disk sector. The considerations already listed make several well-known chaining modes unsuitable: ECB mode, which cannot be tweaked, and modes that turn block ciphers into stream ciphers, such as the CTR mode.

These three properties do not provide any assurance of disk integrity; that is, they don't tell you whether an adversary has been modifying your ciphertext. In part, this is because an absolute assurance of disk integrity is impossible: no matter what, an adversary could always revert the entire disk to a prior state, circumventing any such checks. If some non-absolute level of disk integrity is desired, it can be achieved within the encrypted disk on a file-by-file basis using message authentication codes.

When taking additional space is acceptable

Although it used to be commonly accepted that disk encryption should be length-preserving, some additional features do justify the use of extra space. One example is authenticated encryption, which takes extra space in exchange for guaranteeing the integrity of the sector. One application of this guarantee would be to prevent an attacker from triggering kernel bugs by breaking the filesystem. [1]

Narrow and wide block

Disk encryption methods are also distinguished into "narrow-block" and "wide-block" methods. For a sector-sized plaintext, narrow-block method encrypts it in multiple blocks, while a wide-block methods does it in just one. Narrow-block methods such as LRW, XES, and XTS allow an attacker to exploit the block granularity to perform traffic analysis and replay. [2] A wide-block cipher ideally makes the entire ciphertext unrecognizable for a change anywhere in the plaintext. [3]

Block cipher-based modes

Like most encryption schemes, block cipher-based disk encryption makes use of modes of operation, which allow encrypting larger amounts of data than the ciphers' block-size (typically 128 bits). Modes are therefore rules on how to repeatedly apply the ciphers' single-block operations.

Cipher-block chaining (CBC)

Cipher-block chaining (CBC) is a common chaining mode in which the previous block's ciphertext is xored with the current block's plaintext before encryption:

Since there isn't a "previous block's ciphertext" for the first block, an initialization vector (IV) must be used as . This, in turn, makes CBC tweakable in some ways.

CBC suffers from some problems. For example, if the IVs are predictable, then an adversary may leave a "watermark" on the disk, i.e., store a specially created file or combination of files identifiable even after encryption. The exact method of constructing the watermark depends on the exact function providing the IVs, but the general recipe is to create two encrypted sectors with identical first blocks and ; these two are then related to each other by . Thus the encryption of is identical to the encryption of , leaving a watermark on the disk. The exact pattern of "same-different-same-different" on disk can then be altered to make the watermark unique to a given file.

To protect against the watermarking attack, a cipher or a hash function is used to generate the IVs from the key and the current sector number, so that an adversary cannot predict the IVs. In particular, the ESSIV approach uses a block cipher in CTR mode to generate the IVs.

Encrypted salt-sector initialization vector (ESSIV)

ESSIV is a method for generating initialization vectors for block encryption to use in disk encryption. The usual methods for generating IVs are predictable sequences of numbers based on, for example, time stamp or sector number, and permit certain attacks such as a watermarking attack. ESSIV prevents such attacks by generating IVs from a combination of the sector number SN with the hash of the key. It is the combination with the key in form of a hash that makes the IV unpredictable. [4] [5]

ESSIV was designed by Clemens Fruhwirth and has been integrated into the Linux kernel since version 2.6.10, though a similar scheme has been used to generate IVs for OpenBSD's swap encryption since 2000. [6]

ESSIV is supported as an option by the dm-crypt [7] and FreeOTFE disk encryption systems.

Malleability attack

While CBC (with or without ESSIV) ensures confidentiality, it does not ensure integrity of the encrypted data. If the plaintext is known to the adversary, it is possible to change every second plaintext block to a value chosen by the attacker, while the blocks in between are changed to random values. This can be used for practical attacks on disk encryption in CBC or CBC-ESSIV mode. [8]

Liskov, Rivest, and Wagner (LRW)

The tweakable narrow-block encryption (LRW) [9] is an instantiation of the mode of operations introduced by Liskov, Rivest, and Wagner [10] (see Theorem 2). This mode uses two keys: is the key for the block cipher and is an additional key of the same size as block. For example, for AES with a 256-bit key, is a 256-bit number and is a 128-bit number. Encrypting block with logical index (tweak) uses the following formula:

Here multiplication and addition are performed in the finite field ( for AES). With some precomputation, only a single multiplication per sector is required (note that addition in a binary finite field is a simple bitwise addition, also known as xor): , where are precomputed for all possible values of . This mode of operation needs only a single encryption per block and protects against all the above attacks except a minor leak: if the user changes a single plaintext block in a sector then only a single ciphertext block changes. (Note that this is not the same leak the ECB mode has: with LRW mode equal plaintexts in different positions are encrypted to different ciphertexts.)

Some security concerns exist with LRW, and this mode of operation has now been replaced by XTS.

LRW is employed by BestCrypt and supported as an option for dm-crypt and FreeOTFE disk encryption systems.

Xor–encrypt–xor (XEX)

Another tweakable encryption mode, XEX (xor–encrypt–xor), was designed by Rogaway [11] to allow efficient processing of consecutive blocks (with respect to the cipher used) within one data unit (e.g., a disk sector). The tweak is represented as a combination of the sector address and index of the block within the sector (the original XEX mode proposed by Rogaway [11] allows several indices). The ciphertext, , is obtained using:

where:

is the plaintext,
is the number of the sector,
is the primitive element of defined by polynomial ; i.e., the number 2,
is the number of the block within the sector. XEX uses ; XTS uses .

The basic operations of the LRW mode (AES cipher and Galois field multiplication) are the same as the ones used in the Galois/Counter Mode (GCM), thus permitting a compact implementation of the universal LRW/XEX/GCM hardware.

XEX mode encryption.svg

The original XEX has a weakness. [12]

XEX-based tweaked-codebook mode with ciphertext stealing (XTS)

Ciphertext stealing provides support for sectors with size not divisible by block size, for example, 520-byte sectors and 16-byte blocks. XTS-AES was standardized on December 19, 2007 [13] as IEEE P1619. [14] The XTS standard requires using a different key for the IV encryption than for the block encryption; this differs from XEX which uses only a single key. [11] [15] :1–4 As a result, users wanting AES-256 and AES-128 encryption must supply 512 bits and 256 bits of key respectively. The two keys (i.e., both halves of the XTS key) must be distinct for XTS to be CCA-secure, since XTS computes the sequence starting at ; this differs from XEX which starts at . [11] :7 [15] :6

XTS mode encryption.svg

On January 27, 2010, NIST released Special Publication (SP) 800-38E [16] in final form. SP 800-38E is a recommendation for the XTS-AES mode of operation, as standardized by IEEE Std 1619-2007, for cryptographic modules. The publication approves the XTS-AES mode of the AES algorithm by reference to the IEEE Std 1619-2007, subject to one additional requirement, which limits the maximum size of each encrypted data unit (typically a sector or disk block) to 220 AES blocks. According to SP 800-38E, "In the absence of authentication or access control, XTS-AES provides more protection than the other approved confidentiality-only modes against unauthorized manipulation of the encrypted data."

XTS is supported by BestCrypt, Botan, NetBSD's cgd, [17] dm-crypt, FreeOTFE, TrueCrypt, VeraCrypt, [18] DiskCryptor, FreeBSD's geli, OpenBSD softraid disk encryption software, OpenSSL, Mac OS X Lion's FileVault 2, Windows 10's BitLocker [19] and wolfCrypt.

XTS weaknesses

XTS mode is susceptible to data manipulation and tampering, and applications must employ measures to detect modifications of data if manipulation and tampering is a concern: "...since there are no authentication tags then any ciphertext (original or modified by attacker) will be decrypted as some plaintext and there is no built-in mechanism to detect alterations. The best that can be done is to ensure that any alteration of the ciphertext will completely randomize the plaintext, and rely on the application that uses this transform to include sufficient redundancy in its plaintext to detect and discard such random plaintexts." This would require maintaining checksums for all data and metadata on disk, as done in ZFS or Btrfs. However, in commonly used file systems such as ext4 and NTFS only metadata is protected against tampering, while the detection of data tampering is non-existent. [20]

The mode is susceptible to traffic analysis, replay and randomization attacks on sectors and 16-byte blocks. As a given sector is rewritten, attackers can collect fine-grained (16 byte) ciphertexts, which can be used for analysis or replay attacks (at a 16-byte granularity). It would be possible to define sector-wide block ciphers, unfortunately with degraded performance (see below). [2]

CBC–mask–CBC (CMC) and ECB–mask–ECB (EME)

CMC and EME protect even against the minor leak mentioned above for LRW. Unfortunately, the price is a twofold degradation of performance: each block must be encrypted twice; many consider this to be too high a cost, since the same leak on a sector level is unavoidable anyway.

CMC, introduced by Halevi and Rogaway, stands for CBC–mask–CBC: the whole sector encrypted in CBC mode (with ), the ciphertext is masked by xoring with , and re-encrypted in CBC mode starting from the last block. When the underlying block cipher is a strong pseudorandom permutation (PRP) then on the sector level the scheme is a tweakable PRP. One problem is that in order to decrypt one must sequentially pass over all the data twice.

In order to solve this problem, Halevi and Rogaway introduced a parallelizable variant called EME (ECB–mask–ECB). It works in the following way:

Note that unlike LRW and CMC there is only a single key .

CMC and EME were considered for standardization by SISWG. EME is patented, and so is not favored to be a primary supported mode. [21]

HCTR and HCTR2

HCTR (2005) is mode of operation for block ciphers that is length-preserving, wide-block, and tweakable. [22] It, however, has a bug in the specification and another in its security proof, rendering its claimed security level invalid. HCTR2 (2021) is a variant that fixes these issues and improves on security, performance, and flexibility. [23] HCTR2 is available in the Linux kernel since version 6.0.

HCTR and HCTR2 uses a custom block cipher mode of operation called XCTR; AES-128-XCTR is usually used for HCTR2. HCTR2 uses a polynomial hash function called POLYVAL. HCTR2 is efficient on modern processors with an AES instructions and carry-less multiplication instructions. [23]

Stream cipher modes

The HBSH (hash, block cipher, stream cipher, hash) construction, published by Google employees in 2018, allows a fast stream cipher to be used in disk encryption. The Adiantum scheme used in low-end Android devices specifically chooses NH, 256-bit Advanced Encryption Standard (AES-256), ChaCha12, and Poly1305. The construction is tweakable and wide-block. It requires three passes over the data, but is still faster than AES-128-XTS on a ARM Cortex-A7 (which has no AES instruction set). [24] It is available in the Linux kernel since version 5.0.

In 2023, Aldo Gunsing, Joan Daemen and Bart Mennink presented the "double-decker" construction, which also uses a stream cipher. It is again tweakable and wide-block. [3]

Patents

While the authenticated encryption scheme IAPM provides encryption as well as an authentication tag, the encryption component of the IAPM mode completely describes the LRW and XEX schemes above, and hence XTS without the ciphertext stealing aspect. This is described in detail in Figures 8 and 5 of the US patent 6,963,976. [25]

See also

Related Research Articles

In cryptography, a block cipher is a deterministic algorithm that operates on fixed-length groups of bits, called blocks. Block ciphers are the elementary building blocks of many cryptographic protocols. They are ubiquitous in the storage and exchange of data, where such data is secured and authenticated via encryption.

In cryptography, linear cryptanalysis is a general form of cryptanalysis based on finding affine approximations to the action of a cipher. Attacks have been developed for block ciphers and stream ciphers. Linear cryptanalysis is one of the two most widely used attacks on block ciphers; the other being differential cryptanalysis.

Malleability is a property of some cryptographic algorithms. An encryption algorithm is "malleable" if it is possible to transform a ciphertext into another ciphertext which decrypts to a related plaintext. That is, given an encryption of a plaintext , it is possible to generate another ciphertext which decrypts to , for a known function , without necessarily knowing or learning .

In cryptography, an initialization vector (IV) or starting variable is an input to a cryptographic primitive being used to provide the initial state. The IV is typically required to be random or pseudorandom, but sometimes an IV only needs to be unpredictable or unique. Randomization is crucial for some encryption schemes to achieve semantic security, a property whereby repeated usage of the scheme under the same key does not allow an attacker to infer relationships between segments of the encrypted message. For block ciphers, the use of an IV is described by the modes of operation.

<span class="mw-page-title-main">Block cipher mode of operation</span> Cryptography algorithm

In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide information security such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transformation of one fixed-length group of bits called a block. A mode of operation describes how to repeatedly apply a cipher's single-block operation to securely transform amounts of data larger than a block.

<span class="mw-page-title-main">Ciphertext</span> Encrypted information

In cryptography, ciphertext or cyphertext is the result of encryption performed on plaintext using an algorithm, called a cipher. Ciphertext is also known as encrypted or encoded information because it contains a form of the original plaintext that is unreadable by a human or computer without the proper cipher to decrypt it. This process prevents the loss of sensitive information via hacking. Decryption, the inverse of encryption, is the process of turning ciphertext into readable plaintext. Ciphertext is not to be confused with codetext because the latter is a result of a code, not a cipher.

<span class="mw-page-title-main">Feistel cipher</span> Cryptography construction

In cryptography, a Feistel cipher is a symmetric structure used in the construction of block ciphers, named after the German-born physicist and cryptographer Horst Feistel, who did pioneering research while working for IBM; it is also commonly known as a Feistel network. A large number of block ciphers use the scheme, including the US Data Encryption Standard, the Soviet/Russian GOST and the more recent Blowfish and Twofish ciphers. In a Feistel cipher, encryption and decryption are very similar operations, and both consist of iteratively running a function called a "round function" a fixed number of times.

In cryptography and steganography, plausibly deniable encryption describes encryption techniques where the existence of an encrypted file or message is deniable in the sense that an adversary cannot prove that the plaintext data exists.

Authenticated Encryption (AE) is an encryption scheme which simultaneously assures the data confidentiality and authenticity. Examples of encryption modes that provide AE are GCM, CCM.

<span class="mw-page-title-main">CBC-MAC</span> Message authentication code algorithm

In cryptography, a cipher block chaining message authentication code (CBC-MAC) is a technique for constructing a message authentication code (MAC) from a block cipher. The message is encrypted with some block cipher algorithm in cipher block chaining (CBC) mode to create a chain of blocks such that each block depends on the proper encryption of the previous block. This interdependence ensures that a change to any of the plaintext bits will cause the final encrypted block to change in a way that cannot be predicted or counteracted without knowing the key to the block cipher.

<span class="mw-page-title-main">FreeOTFE</span> Disk encryption software application

FreeOTFE is a discontinued open source computer program for on-the-fly disk encryption (OTFE). On Microsoft Windows, and Windows Mobile, it can create a virtual drive within a file or partition, to which anything written is automatically encrypted before being stored on a computer's hard or USB drive. It is similar in function to other disk encryption programs including TrueCrypt and Microsoft's BitLocker.

In cryptography, Galois/Counter Mode (GCM) is a mode of operation for symmetric-key cryptographic block ciphers which is widely adopted for its performance. GCM throughput rates for state-of-the-art, high-speed communication channels can be achieved with inexpensive hardware resources.

Institute of Electrical and Electronics Engineers (IEEE) standardization project for encryption of stored data, but more generically refers to the Security in Storage Working Group (SISWG), which includes a family of standards for protection of stored data and for the corresponding cryptographic key management.

In cryptography, a watermarking attack is an attack on disk encryption methods where the presence of a specially crafted piece of data can be detected by an attacker without knowing the encryption key.

<span class="mw-page-title-main">BestCrypt</span> Commercial disk encryption app available for Windows, Linux, macOS and Android

BestCrypt, developed by Jetico, is a commercial disk encryption app available for Windows, Linux, macOS and Android.

This is a technical feature comparison of different disk encryption software.

dm-crypt is a transparent block device encryption subsystem in Linux kernel versions 2.6 and later and in DragonFly BSD. It is part of the device mapper (dm) infrastructure, and uses cryptographic routines from the kernel's Crypto API. Unlike its predecessor cryptoloop, dm-crypt was designed to support advanced modes of operation, such as XTS, LRW and ESSIV, in order to avoid watermarking attacks. In addition to that, dm-crypt addresses some reliability problems of cryptoloop.

In cryptography, format-preserving encryption (FPE), refers to encrypting in such a way that the output is in the same format as the input. The meaning of "format" varies. Typically only finite sets of characters are used; numeric, alphabetic or alphanumeric. For example:

There are various implementations of the Advanced Encryption Standard, also known as Rijndael.

<span class="mw-page-title-main">Xor–encrypt–xor</span> Block cypher operating mode

The xor–encrypt–xor (XEX) is a (tweakable) mode of operation of a block cipher. In tweaked-codebook mode with ciphertext stealing, it is one of the more popular modes of operation for whole-disk encryption. XEX is also a common form of key whitening, and part of some smart card proposals.

References

  1. Poettering, Lennart. "The Strange State of Authenticated Boot and Disk Encryption on Generic Linux Distributions". 0pointer.net.
  2. 1 2 Thomas Ptacek; Erin Ptacek (2014-04-30). "You Don't Want XTS".
  3. 1 2 Aldo Gunsing; Joan Daemen; Bart Mennink. Deck-Based Wide Block Cipher Modes (PDF). The Third NIST Workshop on Block Cipher Modes of Operation 2023.
  4. Fruhwirth, Clemens; Schuster, Markus (December 2005). "Secret Messages: Hard disk encryption with DM-Crypt, LUKS, and cryptsetup" (PDF). Linux Magazine . No. 61. pp. 65–71. Retrieved 22 August 2024.
  5. Fruhwirth, Clemens (18 July 2005). "New Methods in Hard Disk Encryption" (PDF). Vienna University of Technology . Retrieved 22 August 2024.
  6. Provos, Niels (2000). Encrypting Virtual Memory (PDF). 9th USENIX Security Symposium. Denver, Colorado.
  7. Milan Broz. "DMCrypt dm-crypt: Linux kernel device-mapper crypto target". gitlab.com. Retrieved April 5, 2015.
  8. Jakob Lell (2013-12-22). "Practical malleability attack against CBC-encrypted LUKS partitions".
  9. Latest SISWG and IEEE P1619 drafts and meeting information are on the P1619 home page .
  10. M. Liskov, R. Rivest, and D. Wagner. Tweakable block ciphers Archived 2008-12-05 at the Wayback Machine , CRYPTO '02 (LNCS, volume 2442), 2002.
  11. 1 2 3 4 Rogaway, Phillip (2004-09-24). "Efficient Instantiations of Tweakable Blockciphers and Refinements to Modes OCB and PMAC" (PDF). Dept. Of Computer Science (PDF). University of California, Davis.
  12. Minematsu, Kazuhiko (2007). "Improved Security Analysis of XEX and LRW Modes" (PDF). Selected Areas in Cryptography. Lecture Notes in Computer Science. Vol. 4356. pp. 96–113. doi:10.1007/978-3-540-74462-7_8. ISBN   978-3-540-74461-0.
  13. Karen McCabe (19 December 2007). "IEEE Approves Standards for Data Encryption". IEEE Standards Association. Archived from the original on 2008-03-06.
  14. IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices. April 18, 2008. pp. 1–40. doi:10.1109/IEEESTD.2008.4493450. ISBN   978-0-7381-5363-6.{{cite book}}: |journal= ignored (help)
  15. 1 2 Liskov, Moses; Minematsu, Kazuhiko (2008-09-02). "Comments on XTS-AES" (PDF).
  16. Morris Dworkin (January 2010). "Recommendation for Block Cipher Modes of Operation: The XTS-AES Mode for Confidentiality on Storage Devices" (PDF). NIST Special Publication 800-38E. National Institute of Standards and Technology. doi:10.6028/NIST.SP.800-38E.{{cite journal}}: Cite journal requires |journal= (help)
  17. "NetBSD cryptographic disk driver". Archived from the original on 2019-01-08. Retrieved 2019-01-07.
  18. "Modes of Operation". VeraCrypt Documentation. IDRIX. Retrieved 2017-10-13.
  19. "What's new in BitLocker?". November 12, 2015. Retrieved 2015-11-15.
  20. Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices (PDF), IEEE P1619/D16, 2007, p. 34, archived from the original (PDF) on 14 April 2016, retrieved 14 September 2012
  21. P. Rogaway, Block cipher mode of operation for constructing a wide-blocksize block cipher from a conventional block cipher, US Patent Application 20040131182 A1.
  22. Wang, Peng; Feng, Dengguo; Wu, Wenling (2005). "HCTR: A Variable-Input-Length Enciphering Mode". Information Security and Cryptology. Lecture Notes in Computer Science. Vol. 3822. pp. 175–188. doi:10.1007/11599548_15. ISBN   978-3-540-30855-3.
  23. 1 2 "Length-preserving encryption with HCTR2". 2021.
  24. Crowley, Paul; Biggers, Eric (13 December 2018). "Adiantum: length-preserving encryption for entry-level processors". IACR Transactions on Symmetric Cryptology: 39–61. doi: 10.13154/tosc.v2018.i4.39-61 .
    • U.S. Patent 6,963,976, "Symmetric Key Authenticated Encryption Schemes" (filed Nov. 2000, issued Nov. 2005, expires 25 Nov. 2022) Archived 2018-08-11 at the Wayback Machine .

Further reading