mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-14 04:10:06 +01:00
Fix disk wipe (during keyslot removal) if used on 4k hw block device.
The "Gutmann" metod uses various offset, direct-io need to even read device when working with buffer... Fixes Issue 129.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2012-05-09 Milan Broz <gmazyland@gmail.com>
|
||||
* Fix keyslot removal (wipe keyslot) for device with 4k hw block (1.4.0).
|
||||
|
||||
2012-05-02 Milan Broz <gmazyland@gmail.com>
|
||||
* Fix loop mapping on readonly file.
|
||||
* Relax --shared test, allow mapping even for overlapping segments.
|
||||
|
||||
@@ -133,7 +133,7 @@ int crypt_wipe(const char *device,
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
flags = O_WRONLY | O_DIRECT | O_SYNC;
|
||||
flags = O_RDWR | O_DIRECT | O_SYNC;
|
||||
|
||||
/* use O_EXCL only for block devices */
|
||||
if (exclusive && S_ISBLK(st.st_mode))
|
||||
|
||||
@@ -58,6 +58,19 @@ format() # key_bits expected [forced]
|
||||
echo "FAIL"
|
||||
fail "Expected alignment differs: expected $2 != detected $ALIGN"
|
||||
fi
|
||||
|
||||
# test some operation, just in case
|
||||
echo -e "xxx\naaa" | $CRYPTSETUP luksAddKey $DEV -i1 --key-slot 1
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "FAIL"
|
||||
fail "Keyslot add failed."
|
||||
fi
|
||||
$CRYPTSETUP -q luksKillSlot $DEV 1
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "FAIL"
|
||||
fail "Keyslot removal failed."
|
||||
fi
|
||||
|
||||
echo "PASSED"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user