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?