Rename cc->cipher_mode to cc->cipher_string and store the whole of the cipher
information so it can easily be printed when processing the DM_DEV_STATUS ioctl.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
struct workqueue_struct *crypt_queue;
char *cipher;
struct workqueue_struct *crypt_queue;
char *cipher;
struct crypt_iv_operations *iv_gen_ops;
union {
struct crypt_iv_operations *iv_gen_ops;
union {
dm_put_device(ti, cc->dev);
kzfree(cc->cipher);
dm_put_device(ti, cc->dev);
kzfree(cc->cipher);
- kzfree(cc->cipher_mode);
+ kzfree(cc->cipher_string);
/* Must zero key material before freeing */
kzfree(cc);
/* Must zero key material before freeing */
kzfree(cc);
+ cc->cipher_string = kstrdup(cipher_in, GFP_KERNEL);
+ if (!cc->cipher_string)
+ goto bad_mem;
+
/*
* Legacy dm-crypt cipher specification
* cipher-mode-iv:ivopts
/*
* Legacy dm-crypt cipher specification
* cipher-mode-iv:ivopts
if (!cc->cipher)
goto bad_mem;
if (!cc->cipher)
goto bad_mem;
- if (tmp) {
- cc->cipher_mode = kstrdup(tmp, GFP_KERNEL);
- if (!cc->cipher_mode)
- goto bad_mem;
- }
-
chainmode = strsep(&tmp, "-");
ivopts = strsep(&tmp, "-");
ivmode = strsep(&ivopts, ":");
chainmode = strsep(&tmp, "-");
ivopts = strsep(&tmp, "-");
ivmode = strsep(&ivopts, ":");
if (tmp)
DMWARN("Ignoring unexpected additional cipher options");
if (tmp)
DMWARN("Ignoring unexpected additional cipher options");
- /* Compatibility mode for old dm-crypt mappings */
+ /*
+ * For compatibility with the original dm-crypt mapping format, if
+ * only the cipher name is supplied, use cbc-plain.
+ */
if (!chainmode || (!strcmp(chainmode, "plain") && !ivmode)) {
if (!chainmode || (!strcmp(chainmode, "plain") && !ivmode)) {
- kfree(cc->cipher_mode);
- cc->cipher_mode = kstrdup("cbc-plain", GFP_KERNEL);
chainmode = "cbc";
ivmode = "plain";
}
chainmode = "cbc";
ivmode = "plain";
}
break;
case STATUSTYPE_TABLE:
break;
case STATUSTYPE_TABLE:
- if (cc->cipher_mode)
- DMEMIT("%s-%s ", cc->cipher, cc->cipher_mode);
- else
- DMEMIT("%s ", cc->cipher);
+ DMEMIT("%s ", cc->cipher_string);
if (cc->key_size > 0) {
if ((maxlen - sz) < ((cc->key_size << 1) + 1))
if (cc->key_size > 0) {
if ((maxlen - sz) < ((cc->key_size << 1) + 1))
static struct target_type crypt_target = {
.name = "crypt",
static struct target_type crypt_target = {
.name = "crypt",
.module = THIS_MODULE,
.ctr = crypt_ctr,
.dtr = crypt_dtr,
.module = THIS_MODULE,
.ctr = crypt_ctr,
.dtr = crypt_dtr,