]> git.ipfire.org Git - thirdparty/util-linux.git/commit
Revert "libblkid: luks: add checksum support"
authorKarel Zak <kzak@redhat.com>
Mon, 19 Sep 2022 09:39:09 +0000 (11:39 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 19 Sep 2022 09:39:09 +0000 (11:39 +0200)
commitdac8edb710d09d8e20a3bf74a0d564133250f503
treed24126c73719776a729a96588ece0ef425445d2d
parent3443cea28263e0ec554ca0e7317e40c9166c48fd
Revert "libblkid: luks: add checksum support"

See discussion at https://github.com/util-linux/util-linux/pull/1801

The change is unwanted by LUKS upstream developers, the checksum
functionality is designed for libcryptsetup internal use only.
Issues:

* introduces security issue (allocated buffer is not checked agaisnt
  maximal value) - inserting LUKS2 device with header faking oversized
  header size will cause allocating of huge amount of memory (perhaps
  crash of blkid)
* we support JSON area up to 4MB in size (checksum covers also this part
  that was not intended to be read by blkid) - calculating SHA256 for
  such area is really not fast operation; readin of 4MB of data is waste
  of resources either (that's why there is smaill 4k binary header)
* even if checksum check is disabled, it is calculated (complete waste
  of time here)
* it does not support anything else that SHA256 (we can switch to different
  hash or other algorithm later); blkid should not introduce such limits.
* checksum for the second heder is not calculated at all

This reverts commit eca0d8b8b1360f745131158bf6b5b5c1c04d98c9.

Signed-off-by: Karel Zak <kzak@redhat.com>
Addresses: https://github.com/util-linux/util-linux/pull/1801
libblkid/src/superblocks/luks.c
tests/ts/blkid/images-fs/luks2.img.xz