I am having some problems encrypting disk using AES-256 in CTR mode, with ESSIV iv generation (I am aware of couple of flaws, although this mode is enough for now). What I have here is:

S = SHA256(K), result 32 bytes
K = original key, 32 bytes
SN = sector number, 16 bytes
E = AES-256 CTR
IV2 = generated iv, 16 bytes

What I am doing with it:

IV2 = E(data=SN, key=S, iv=SN)
decrypted_data = E(data=encrypted_data, key=K, iv=IV2)

In couple of sources (e.g. here: https://is.muni.cz/th/vesfr/final.pdf) I got that for ESSIV generation I should use the exact same block cipher as for main de/encryption. However, I am getting wrong results. Is this the correct approach?


  • $\begingroup$ I will perform some tests tomorrow, but it seems that ESSIV generation encryption was supposed to be performed in ECB mode. $\endgroup$ – wtdmn Jun 14 '20 at 20:47

It seems in my case IV was supposed to be generated using AES-256 in ECB mode.

ESSIV_IV = E(data=SN, key=HMAC(KEY))

where E is AES-256 ECB, SN is sector number of disk data, extended to 16B (padded with zeros) and KEY is 32B long encryption key (HMAC = SHA-256).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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