aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-09-01 20:43:25 -0400
committerDavid S. Miller <davem@davemloft.net>2005-09-01 20:43:25 -0400
commiteb6f1160ddb2fdadf50f350da79d0796c37f17e2 (patch)
treee7b048b089b4b0ec9f121eea9a7f5864999dbac3 /drivers/md/dm-crypt.c
parent64baf3cfea974d2b9e671ccfdbc03e030ea5ebc6 (diff)
[CRYPTO]: Use CRYPTO_TFM_REQ_MAY_SLEEP where appropriate
This patch goes through the current users of the crypto layer and sets CRYPTO_TFM_REQ_MAY_SLEEP at crypto_alloc_tfm() where all crypto operations are performed in process context. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r--drivers/md/dm-crypt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index d0a4bab220e5..b82bc3150476 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -144,7 +144,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
144 } 144 }
145 145
146 /* Hash the cipher key with the given hash algorithm */ 146 /* Hash the cipher key with the given hash algorithm */
147 hash_tfm = crypto_alloc_tfm(opts, 0); 147 hash_tfm = crypto_alloc_tfm(opts, CRYPTO_TFM_REQ_MAY_SLEEP);
148 if (hash_tfm == NULL) { 148 if (hash_tfm == NULL) {
149 ti->error = PFX "Error initializing ESSIV hash"; 149 ti->error = PFX "Error initializing ESSIV hash";
150 return -EINVAL; 150 return -EINVAL;
@@ -172,7 +172,8 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
172 172
173 /* Setup the essiv_tfm with the given salt */ 173 /* Setup the essiv_tfm with the given salt */
174 essiv_tfm = crypto_alloc_tfm(crypto_tfm_alg_name(cc->tfm), 174 essiv_tfm = crypto_alloc_tfm(crypto_tfm_alg_name(cc->tfm),
175 CRYPTO_TFM_MODE_ECB); 175 CRYPTO_TFM_MODE_ECB |
176 CRYPTO_TFM_REQ_MAY_SLEEP);
176 if (essiv_tfm == NULL) { 177 if (essiv_tfm == NULL) {
177 ti->error = PFX "Error allocating crypto tfm for ESSIV"; 178 ti->error = PFX "Error allocating crypto tfm for ESSIV";
178 kfree(salt); 179 kfree(salt);
@@ -587,7 +588,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
587 goto bad1; 588 goto bad1;
588 } 589 }
589 590
590 tfm = crypto_alloc_tfm(cipher, crypto_flags); 591 tfm = crypto_alloc_tfm(cipher, crypto_flags | CRYPTO_TFM_REQ_MAY_SLEEP);
591 if (!tfm) { 592 if (!tfm) {
592 ti->error = PFX "Error allocating crypto tfm"; 593 ti->error = PFX "Error allocating crypto tfm";
593 goto bad1; 594 goto bad1;