diff options
author | Milan Broz <gmazyland@gmail.com> | 2011-08-26 19:46:17 +0000 |
---|---|---|
committer | Milan Broz <gmazyland@gmail.com> | 2011-08-26 19:46:17 +0000 |
commit | d5e48fcb00e3ea81cf802074422dc3e44a50f1fa (patch) | |
tree | fc0808b059a5fcf147180bd79f75ec06e71711ab /tests | |
parent | 4d99773009fc5d644cfffd4ef84ed5f80372672d (diff) | |
download | cryptsetup-d5e48fcb00e3ea81cf802074422dc3e44a50f1fa.tar.gz cryptsetup-d5e48fcb00e3ea81cf802074422dc3e44a50f1fa.tar.bz2 cryptsetup-d5e48fcb00e3ea81cf802074422dc3e44a50f1fa.zip |
Enhance check of device size before writing LUKS header.
(Thanks to okozina@redhat.com)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@607 36d66b0a-2a48-0410-832c-cd162a569da5
Diffstat (limited to 'tests')
-rw-r--r-- | tests/api-test.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/api-test.c b/tests/api-test.c index 9d17d00..d7dc795 100644 --- a/tests/api-test.c +++ b/tests/api-test.c @@ -923,16 +923,16 @@ static void AddDeviceLuks(void) OK_(create_dmdevice_over_loop(H_DEVICE_WRONG, r_header_size - 1)); // format -// OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG)); -// params.data_alignment = 0; -// FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, ¶ms), "Not enough space for keyslots material"); -// crypt_free(cd); + OK_(crypt_init(&cd, DMDIR H_DEVICE_WRONG)); + params.data_alignment = 0; + FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, ¶ms), "Not enough space for keyslots material"); + crypt_free(cd); // test payload_offset = 0 for encrypted device with external header device -// OK_(crypt_init(&cd, DMDIR H_DEVICE)); -// OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, ¶ms)); -// EQ_(crypt_get_data_offset(cd), 0); -// crypt_free(cd); + OK_(crypt_init(&cd, DMDIR H_DEVICE)); + OK_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, ¶ms)); + EQ_(crypt_get_data_offset(cd), 0); + crypt_free(cd); params.data_alignment = 0; params.data_device = NULL; @@ -953,9 +953,9 @@ static void AddDeviceLuks(void) OK_(create_dmdevice_over_loop(L_DEVICE_WRONG, r_payload_offset - 1)); // 1 sector less than required -// OK_(crypt_init(&cd, DMDIR L_DEVICE_WRONG)); -// FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, ¶ms), "Device too small"); -// crypt_free(cd); + OK_(crypt_init(&cd, DMDIR L_DEVICE_WRONG)); + FAIL_(crypt_format(cd, CRYPT_LUKS1, cipher, cipher_mode, NULL, key, key_size, ¶ms), "Device too small"); + crypt_free(cd); // 0 sectors for encrypted area OK_(crypt_init(&cd, DMDIR L_DEVICE_0S)); |