Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

For example with Truecrypt or bitlocker, when my hard disk contains 500 GB encrypted data and 256 MB Free RAM, how is the data decrypted/disk mounted when I turn on my computer?

If the entire disk is encrypted with the same decryption key, does it require the same amount of RAM to process the data? Or is encryption applied on small blocks and decryption applied by just decrypting those blocks?

share|improve this question

1 Answer 1

In block ciphers (e.g. AES), the data is split into small blocks, and each block of data is processed in sequence. This allows a huge amount of data to be encrypted or decrypted without consuming much RAM.

  1. Load one block of plaintext into memory.
  2. Encrypt it.
  3. Save it.
  4. Move to the next block and start again.

And to decrypt:

  1. Load one block of ciphertext into memory.
  2. Decrypt it.
  3. Use / save it.
  4. Move to the next block and start again.

In this scheme, it is easy to encrypt or decrypt blocks at random. Unfortunately, this is insecure.

Block ciphers run in a particular mode of operation. The simplest mode (the one I just described) is called ECB, or Electronic Code Book. Each block is processed completely independantly, allowing for each block to be decrypted independantly, as we saw above. Unfortunately, this leads to some serious problems with security, where patterns in the plaintext show up in the ciphertext.

The first image is plaintext, the second is encrypted with a block cipher in ECB mode:

Plaintext ECB Ciphertext

Other modes solve this problem by chaining blocks together using certain operations. This causes the patterns to be dispersed:

Non-ECB Ciphertext

Most modes of operation (e.g. Cipher-Block Chaining) will require the previous block to remain in memory. However, since a normal block size is only 32 bytes (256 bits) it doesn't require much memory at all to keep it. However, it does mean that every block up until the required block has to be processed first. This is obviously not practical for disk encryption, because to read disk sector 100,001, we'd have to read and decrypt all 100,000 previous blocks.

TrueCrypt uses XTS, a special mode of operation designed specifically for storage devices. This allows blocks (or short sequences of them) to be decrypted entirely separately, without losing the security that non-ECB modes such as CBC provide. This means that you can easily decrypt files on the disk without having to decrypt everything else, whilst avoiding the security problems that ECB has.

share|improve this answer
    
That's the exact question I received on my networking exam, with the same pictures :O –  Lucas Kauffman Aug 4 '12 at 9:14
    
@LucasKauffman They're from the Wikipedia article. Surprise, surprise, academics steal things too! :o –  Polynomial Aug 4 '12 at 9:19
    
Those bastards, not even a proper source recognition! –  Lucas Kauffman Aug 4 '12 at 9:19
3  
For full system disk encryption TC includes a bootloader that decrypts the boot sector and loads the OS. From there, it provides an abstraction layer that transparently encrypts and decrypts all data going to and from the disk. –  Polynomial Aug 4 '12 at 9:46
1  
"This allows blocks (or short sequences of them) to be decrypted entirely separately, without losing the security that non-ECB modes such as CBC provide." You have now larger blocks, called "data unit" in TC description, and there is no chaining between data units. An attacker with read access to the disk at different times can gain more information about the amount of modified blocks than he could with chaining between blocks. Not all the security properties that pure CBC provides are achieved in this mode. –  curiousguy Aug 4 '12 at 18:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.