diff options
author | Ludwig Nussel <ludwig.nussel@suse.de> | 2007-05-09 05:32:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:46 -0400 |
commit | 46b477306afcd0516924b26792c7a42f4dbfa9f0 (patch) | |
tree | 76534c0ca2fed486e453292fdd0bbfdd83d104ca /drivers/md | |
parent | f97380bcadd6bd2e368727de4061aaba4989c426 (diff) |
dm crypt: add null iv
Add a new IV generation method 'null' to read old filesystem images created
with SuSE's loop_fish2 module.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Acked-By: Christophe Saout <christophe@saout.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-crypt.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 1ecee5e1c548..7b0fcfc9eaa5 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -121,6 +121,9 @@ static void clone_init(struct crypt_io *, struct bio *); | |||
121 | * benbi: the 64-bit "big-endian 'narrow block'-count", starting at 1 | 121 | * benbi: the 64-bit "big-endian 'narrow block'-count", starting at 1 |
122 | * (needed for LRW-32-AES and possible other narrow block modes) | 122 | * (needed for LRW-32-AES and possible other narrow block modes) |
123 | * | 123 | * |
124 | * null: the initial vector is always zero. Provides compatibility with | ||
125 | * obsolete loop_fish2 devices. Do not use for new devices. | ||
126 | * | ||
124 | * plumb: unimplemented, see: | 127 | * plumb: unimplemented, see: |
125 | * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 | 128 | * http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/454 |
126 | */ | 129 | */ |
@@ -257,6 +260,13 @@ static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | |||
257 | return 0; | 260 | return 0; |
258 | } | 261 | } |
259 | 262 | ||
263 | static int crypt_iv_null_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | ||
264 | { | ||
265 | memset(iv, 0, cc->iv_size); | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
260 | static struct crypt_iv_operations crypt_iv_plain_ops = { | 270 | static struct crypt_iv_operations crypt_iv_plain_ops = { |
261 | .generator = crypt_iv_plain_gen | 271 | .generator = crypt_iv_plain_gen |
262 | }; | 272 | }; |
@@ -273,6 +283,10 @@ static struct crypt_iv_operations crypt_iv_benbi_ops = { | |||
273 | .generator = crypt_iv_benbi_gen | 283 | .generator = crypt_iv_benbi_gen |
274 | }; | 284 | }; |
275 | 285 | ||
286 | static struct crypt_iv_operations crypt_iv_null_ops = { | ||
287 | .generator = crypt_iv_null_gen | ||
288 | }; | ||
289 | |||
276 | static int | 290 | static int |
277 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, | 291 | crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out, |
278 | struct scatterlist *in, unsigned int length, | 292 | struct scatterlist *in, unsigned int length, |
@@ -803,6 +817,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
803 | cc->iv_gen_ops = &crypt_iv_essiv_ops; | 817 | cc->iv_gen_ops = &crypt_iv_essiv_ops; |
804 | else if (strcmp(ivmode, "benbi") == 0) | 818 | else if (strcmp(ivmode, "benbi") == 0) |
805 | cc->iv_gen_ops = &crypt_iv_benbi_ops; | 819 | cc->iv_gen_ops = &crypt_iv_benbi_ops; |
820 | else if (strcmp(ivmode, "null") == 0) | ||
821 | cc->iv_gen_ops = &crypt_iv_null_ops; | ||
806 | else { | 822 | else { |
807 | ti->error = "Invalid IV mode"; | 823 | ti->error = "Invalid IV mode"; |
808 | goto bad2; | 824 | goto bad2; |
@@ -1030,7 +1046,7 @@ error: | |||
1030 | 1046 | ||
1031 | static struct target_type crypt_target = { | 1047 | static struct target_type crypt_target = { |
1032 | .name = "crypt", | 1048 | .name = "crypt", |
1033 | .version= {1, 3, 0}, | 1049 | .version= {1, 5, 0}, |
1034 | .module = THIS_MODULE, | 1050 | .module = THIS_MODULE, |
1035 | .ctr = crypt_ctr, | 1051 | .ctr = crypt_ctr, |
1036 | .dtr = crypt_dtr, | 1052 | .dtr = crypt_dtr, |