public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: [PATCH 5/8] crypto: remove CRYPTO_TFM_RES_BAD_BLOCK_LEN
Date: Mon, 30 Dec 2019 21:19:35 -0600	[thread overview]
Message-ID: <20191231031938.241705-6-ebiggers@kernel.org> (raw)
In-Reply-To: <20191231031938.241705-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

The flag CRYPTO_TFM_RES_BAD_BLOCK_LEN is never checked for, and it's
only set by one driver.  And even that single driver's use is wrong
because the driver is setting the flag from ->encrypt() and ->decrypt()
with no locking, which is unsafe because ->encrypt() and ->decrypt() can
be executed by many threads in parallel on the same tfm.

Just remove this flag.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 drivers/crypto/ccree/cc_aead.c   | 1 -
 drivers/crypto/ccree/cc_cipher.c | 1 -
 include/linux/crypto.h           | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c
index 64d318dc0d47..b0085db7e211 100644
--- a/drivers/crypto/ccree/cc_aead.c
+++ b/drivers/crypto/ccree/cc_aead.c
@@ -1925,7 +1925,6 @@ static int cc_proc_aead(struct aead_request *req,
 	if (validate_data_size(ctx, direct, req)) {
 		dev_err(dev, "Unsupported crypt/assoc len %d/%d.\n",
 			req->cryptlen, areq_ctx->assoclen);
-		crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_BLOCK_LEN);
 		return -EINVAL;
 	}
 
diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
index 3112b58d0bb1..61b9dcaa0c05 100644
--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -837,7 +837,6 @@ static int cc_cipher_process(struct skcipher_request *req,
 	/* TODO: check data length according to mode */
 	if (validate_data_size(ctx_p, nbytes)) {
 		dev_err(dev, "Unsupported data size %d.\n", nbytes);
-		crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_BLOCK_LEN);
 		rc = -EINVAL;
 		goto exit_process;
 	}
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 950b592947b2..719a301af3f2 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -114,7 +114,6 @@
 #define CRYPTO_TFM_REQ_MAY_BACKLOG	0x00000400
 #define CRYPTO_TFM_RES_WEAK_KEY		0x00100000
 #define CRYPTO_TFM_RES_BAD_KEY_LEN   	0x00200000
-#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 	0x00800000
 
 /*
  * Miscellaneous stuff.
-- 
2.24.1


  parent reply	other threads:[~2019-12-31  3:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-31  3:19 [PATCH 0/8] crypto: remove the CRYPTO_TFM_RES_* flags Eric Biggers
2019-12-31  3:19 ` [PATCH 1/8] crypto: chelsio - fix writing tfm flags to wrong place Eric Biggers
2019-12-31  4:42   ` Eric Biggers
2019-12-31  3:19 ` [PATCH 2/8] crypto: artpec6 - return correct error code for failed setkey() Eric Biggers
2019-12-31  4:43   ` Eric Biggers
2020-01-01 16:04     ` Lars Persson
2019-12-31  3:19 ` [PATCH 3/8] crypto: atmel-sha - fix error handling when setting hmac key Eric Biggers
2019-12-31  4:45   ` Eric Biggers
2020-01-08 16:06   ` Tudor.Ambarus
2019-12-31  3:19 ` [PATCH 4/8] crypto: remove unused tfm result flags Eric Biggers
2019-12-31  3:19 ` Eric Biggers [this message]
2019-12-31  3:19 ` [PATCH 6/8] crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN Eric Biggers
2020-01-06 15:00   ` Horia Geanta
2019-12-31  3:19 ` [PATCH 7/8] crypto: remove CRYPTO_TFM_RES_WEAK_KEY Eric Biggers
2019-12-31  3:19 ` [PATCH 8/8] crypto: remove propagation of CRYPTO_TFM_RES_* flags Eric Biggers
2019-12-31  8:14 ` [PATCH 0/8] crypto: remove the " Ard Biesheuvel
2020-01-09  5:14 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191231031938.241705-6-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox