| From b1c40d4a8e7a651f6a0ec1e4041bb04b79b7793d Mon Sep 17 00:00:00 2001 |
| From: "David S. Miller" <davem@davemloft.net> |
| Date: Wed, 19 Dec 2012 15:43:38 -0800 |
| Subject: sparc64: Set CRYPTO_TFM_REQ_MAY_SLEEP consistently in DES code. |
| |
| |
| From: "David S. Miller" <davem@davemloft.net> |
| |
| [ Upstream commit b3a37947074fa0a488d6c7ede58125b2278ab4e8 ] |
| |
| We use the FPU and therefore cannot sleep during the crypto |
| loops. |
| |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| arch/sparc/crypto/des_glue.c | 6 ++++++ |
| 1 file changed, 6 insertions(+) |
| |
| --- a/arch/sparc/crypto/des_glue.c |
| +++ b/arch/sparc/crypto/des_glue.c |
| @@ -100,6 +100,7 @@ static int __ecb_crypt(struct blkcipher_ |
| |
| blkcipher_walk_init(&walk, dst, src, nbytes); |
| err = blkcipher_walk_virt(desc, &walk); |
| + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
| |
| if (encrypt) |
| des_sparc64_load_keys(&ctx->encrypt_expkey[0]); |
| @@ -147,6 +148,7 @@ static int cbc_encrypt(struct blkcipher_ |
| |
| blkcipher_walk_init(&walk, dst, src, nbytes); |
| err = blkcipher_walk_virt(desc, &walk); |
| + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
| |
| des_sparc64_load_keys(&ctx->encrypt_expkey[0]); |
| while ((nbytes = walk.nbytes)) { |
| @@ -177,6 +179,7 @@ static int cbc_decrypt(struct blkcipher_ |
| |
| blkcipher_walk_init(&walk, dst, src, nbytes); |
| err = blkcipher_walk_virt(desc, &walk); |
| + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
| |
| des_sparc64_load_keys(&ctx->decrypt_expkey[0]); |
| while ((nbytes = walk.nbytes)) { |
| @@ -266,6 +269,7 @@ static int __ecb3_crypt(struct blkcipher |
| |
| blkcipher_walk_init(&walk, dst, src, nbytes); |
| err = blkcipher_walk_virt(desc, &walk); |
| + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
| |
| if (encrypt) |
| K = &ctx->encrypt_expkey[0]; |
| @@ -317,6 +321,7 @@ static int cbc3_encrypt(struct blkcipher |
| |
| blkcipher_walk_init(&walk, dst, src, nbytes); |
| err = blkcipher_walk_virt(desc, &walk); |
| + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
| |
| K = &ctx->encrypt_expkey[0]; |
| des3_ede_sparc64_load_keys(K); |
| @@ -352,6 +357,7 @@ static int cbc3_decrypt(struct blkcipher |
| |
| blkcipher_walk_init(&walk, dst, src, nbytes); |
| err = blkcipher_walk_virt(desc, &walk); |
| + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; |
| |
| K = &ctx->decrypt_expkey[0]; |
| des3_ede_sparc64_load_keys(K); |