2012-05-09 Milan Broz <gmazyland@gmail.com>
* Fix keyslot removal (wipe keyslot) for device with 4k hw block (1.4.0).
+ * Allow empty cipher (cipher_null) for testing.
2012-05-02 Milan Broz <gmazyland@gmail.com>
* Fix loop mapping on readonly file.
static char *get_params(struct crypt_dm_active_device *dmd)
{
- int r, max_size;
+ int r, max_size, null_cipher = 0;
char *params, *hexkey;
const char *features = "";
log_dbg("Discard/TRIM is not supported by the kernel.");
}
- hexkey = crypt_safe_alloc(dmd->vk->keylength * 2 + 1);
+ if (!strncmp(dmd->cipher, "cipher_null-", 12))
+ null_cipher = 1;
+
+ hexkey = crypt_safe_alloc(null_cipher ? 2 : (dmd->vk->keylength * 2 + 1));
if (!hexkey)
return NULL;
- hex_key(hexkey, dmd->vk->keylength, dmd->vk->key);
+ if (null_cipher)
+ strncpy(hexkey, "-", 2);
+ else
+ hex_key(hexkey, dmd->vk->keylength, dmd->vk->key);
max_size = strlen(hexkey) + strlen(dmd->cipher) +
strlen(dmd->device) + strlen(features) + 64;
return 0;
}
+ /* Short version for "empty" cipher */
+ if (!strcmp(s, "null")) {
+ strncpy(cipher, "cipher_null", MAX_CIPHER_LEN);
+ strncpy(cipher_mode, "ecb-null", 9);
+ if (key_nums)
+ *key_nums = 0;
+ return 0;
+ }
+
if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]", cipher) == 1) {
strncpy(cipher_mode, "cbc-plain", 10);
if (key_nums)
fail
fi
- X=$($CRYPTSETUP status $1 | grep cipher | sed s/\.\*cipher:\\s*//)
+ X=$($CRYPTSETUP status $1 | grep cipher: | sed s/\.\*cipher:\\s*//)
if [ $X = $2 ] ; then
echo -n "[status OK]"
else
dmcrypt aes aes-cbc-plain
dmcrypt aes-plain aes-cbc-plain
+# empty cipher
+dmcrypt null cipher_null-ecb-null
+dmcrypt cipher_null cipher_null-cbc-plain
+dmcrypt cipher_null-ecb-null
+
# codebook doesn't support IV at all
for cipher in $CIPHERS ; do
dmcrypt "$cipher-ecb"