aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r--drivers/md/dm-crypt.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 357387fa10ca..00725d1863d5 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -56,7 +56,7 @@ struct crypt_config;
56 56
57struct crypt_iv_operations { 57struct crypt_iv_operations {
58 int (*ctr)(struct crypt_config *cc, struct dm_target *ti, 58 int (*ctr)(struct crypt_config *cc, struct dm_target *ti,
59 const char *opts); 59 const char *opts);
60 void (*dtr)(struct crypt_config *cc); 60 void (*dtr)(struct crypt_config *cc);
61 const char *(*status)(struct crypt_config *cc); 61 const char *(*status)(struct crypt_config *cc);
62 int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector); 62 int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector);
@@ -138,7 +138,7 @@ static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
138} 138}
139 139
140static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, 140static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
141 const char *opts) 141 const char *opts)
142{ 142{
143 struct crypto_cipher *essiv_tfm; 143 struct crypto_cipher *essiv_tfm;
144 struct crypto_hash *hash_tfm; 144 struct crypto_hash *hash_tfm;
@@ -190,7 +190,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
190 if (crypto_cipher_blocksize(essiv_tfm) != 190 if (crypto_cipher_blocksize(essiv_tfm) !=
191 crypto_blkcipher_ivsize(cc->tfm)) { 191 crypto_blkcipher_ivsize(cc->tfm)) {
192 ti->error = "Block size of ESSIV cipher does " 192 ti->error = "Block size of ESSIV cipher does "
193 "not match IV size of block cipher"; 193 "not match IV size of block cipher";
194 crypto_free_cipher(essiv_tfm); 194 crypto_free_cipher(essiv_tfm);
195 kfree(salt); 195 kfree(salt);
196 return -EINVAL; 196 return -EINVAL;
@@ -321,10 +321,10 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out,
321 return r; 321 return r;
322} 322}
323 323
324static void 324static void crypt_convert_init(struct crypt_config *cc,
325crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx, 325 struct convert_context *ctx,
326 struct bio *bio_out, struct bio *bio_in, 326 struct bio *bio_out, struct bio *bio_in,
327 sector_t sector, int write) 327 sector_t sector, int write)
328{ 328{
329 ctx->bio_in = bio_in; 329 ctx->bio_in = bio_in;
330 ctx->bio_out = bio_out; 330 ctx->bio_out = bio_out;
@@ -340,7 +340,7 @@ crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx,
340 * Encrypt / decrypt data from one bio to another one (can be the same one) 340 * Encrypt / decrypt data from one bio to another one (can be the same one)
341 */ 341 */
342static int crypt_convert(struct crypt_config *cc, 342static int crypt_convert(struct crypt_config *cc,
343 struct convert_context *ctx) 343 struct convert_context *ctx)
344{ 344{
345 int r = 0; 345 int r = 0;
346 346
@@ -372,7 +372,7 @@ static int crypt_convert(struct crypt_config *cc,
372 } 372 }
373 373
374 r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, 374 r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length,
375 ctx->write, ctx->sector); 375 ctx->write, ctx->sector);
376 if (r < 0) 376 if (r < 0)
377 break; 377 break;
378 378
@@ -382,13 +382,13 @@ static int crypt_convert(struct crypt_config *cc,
382 return r; 382 return r;
383} 383}
384 384
385 static void dm_crypt_bio_destructor(struct bio *bio) 385static void dm_crypt_bio_destructor(struct bio *bio)
386 { 386{
387 struct dm_crypt_io *io = bio->bi_private; 387 struct dm_crypt_io *io = bio->bi_private;
388 struct crypt_config *cc = io->target->private; 388 struct crypt_config *cc = io->target->private;
389 389
390 bio_free(bio, cc->bs); 390 bio_free(bio, cc->bs);
391 } 391}
392 392
393/* 393/*
394 * Generate a new unfragmented bio with the given size 394 * Generate a new unfragmented bio with the given size
@@ -715,7 +715,7 @@ static int crypt_set_key(struct crypt_config *cc, char *key)
715 cc->key_size = key_size; /* initial settings */ 715 cc->key_size = key_size; /* initial settings */
716 716
717 if ((!key_size && strcmp(key, "-")) || 717 if ((!key_size && strcmp(key, "-")) ||
718 (key_size && crypt_decode_key(cc->key, key, key_size) < 0)) 718 (key_size && crypt_decode_key(cc->key, key, key_size) < 0))
719 return -EINVAL; 719 return -EINVAL;
720 720
721 set_bit(DM_CRYPT_KEY_VALID, &cc->flags); 721 set_bit(DM_CRYPT_KEY_VALID, &cc->flags);
@@ -785,8 +785,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
785 goto bad1; 785 goto bad1;
786 } 786 }
787 787
788 if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", chainmode, 788 if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)",
789 cipher) >= CRYPTO_MAX_ALG_NAME) { 789 chainmode, cipher) >= CRYPTO_MAX_ALG_NAME) {
790 ti->error = "Chain mode + cipher name is too long"; 790 ti->error = "Chain mode + cipher name is too long";
791 goto bad1; 791 goto bad1;
792 } 792 }
@@ -829,7 +829,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
829 if (cc->iv_size) 829 if (cc->iv_size)
830 /* at least a 64 bit sector number should fit in our buffer */ 830 /* at least a 64 bit sector number should fit in our buffer */
831 cc->iv_size = max(cc->iv_size, 831 cc->iv_size = max(cc->iv_size,
832 (unsigned int)(sizeof(u64) / sizeof(u8))); 832 (unsigned int)(sizeof(u64) / sizeof(u8)));
833 else { 833 else {
834 if (cc->iv_gen_ops) { 834 if (cc->iv_gen_ops) {
835 DMWARN("Selected cipher does not support IVs"); 835 DMWARN("Selected cipher does not support IVs");
@@ -875,7 +875,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
875 cc->start = tmpll; 875 cc->start = tmpll;
876 876
877 if (dm_get_device(ti, argv[3], cc->start, ti->len, 877 if (dm_get_device(ti, argv[3], cc->start, ti->len,
878 dm_table_get_mode(ti->table), &cc->dev)) { 878 dm_table_get_mode(ti->table), &cc->dev)) {
879 ti->error = "Device lookup failed"; 879 ti->error = "Device lookup failed";
880 goto bad5; 880 goto bad5;
881 } 881 }