0
$\begingroup$

I have read about AES and different modes of operation (CBC, ECB etc) and have 2 questions related to disk encryption:

-AES data block is 16 bytes - how does it relate to sector sizes on the drive which is typically 512 bytes? Also who or what is responsible for dividing disk sectors into data blocks?

-disk encryption software lets me configure AES key size (128/256) and is stored somewhere on the disk. Does it mean that I will use the same key to encrypt all sectors? Or maybe this key is used to calculate/derive sectors keys/block keys?

$\endgroup$
1

1 Answer 1

0
$\begingroup$

To better understand the below concrete answers, a short background on how disk encryption is usually performed with AES. The most tools will use one of the following two modes:

  • CBC-ESSIV, which is just standard CBC encryption where each sector is one "message" and the IV is derived deterministically from the index of the sector to be encrypted as $\text{IV}=E_{\operatorname{Hash}(K)}(\text{SID})$ where $K$ is the AES key.
  • XTS which is the more modern choice because it doesn't suffer from CBC's malleability essentially turns AES into a tweakable block cipher and using a different tweak for data block to hide equal blocks.

[How] does it relate to sector sizes on the drive which is typically 512 bytes?

The sector size usually must be a multiple of the block size of the underlying cipher so no space is wasted to padding and stream modes don't have to be used (which break even more horribly than CBC under chosen-ciphertext attacks).

[Who] or what is responsible for dividing disk sectors into data blocks?

The disk encryption software will usually divide the 512-byte blocks into 32x 16-byte blocks for the AES encryption.

Does it mean that I will use the same key to encrypt all sectors?

Yes.

Or maybe this key is used to calculate/derive sectors keys/block keys?

No. However in ESSIV mode (see above) a hash of the key is used to generate CBC IVs.

$\endgroup$
4
  • $\begingroup$ Thank you @SEJPM♦. 2 more questions: 1) in CBC mode where IV is used. Do we add it to the first sector of the disk only or first block of each sector? I understand that in CBC in later blocks we XOR the plaintext with ciphertext. But where exactly the IV is added? 2) if we select 256bit key size and the block is always 128bit how do we encrypt these blocks (XOR those values). $\endgroup$
    – Crypto_dxb
    Sep 23, 2019 at 12:29
  • $\begingroup$ @Crypto_dxb as each sector needs to be treatable independently, the IV is calculated for each sector. The AES key is never used as data input, so it being longer than one block doesn't matter. $\endgroup$
    – SEJPM
    Sep 23, 2019 at 12:34
  • $\begingroup$ the reason I am asking is that I red that AES key is always 128bit size regardless of its size 128/192/256. in this thread: security.stackexchange.com/questions/6047/… . So does AES key size has 3 sizes or only 1 size with different number of rounds? $\endgroup$
    – Crypto_dxb
    Sep 23, 2019 at 17:04
  • $\begingroup$ @Crypto_dxb indeed AES uses the variable-length main key to extract several block-sized intermediate keys which are only used internally. You don't have to worry about them (unless you explicitly want to study AES internals). $\endgroup$
    – SEJPM
    Sep 23, 2019 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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