Skip to content

Commit

Permalink
crypto: remove CRYPTO_TFM_RES_BAD_BLOCK_LEN
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
ebiggers authored and herbertx committed Jan 9, 2020
1 parent f9d89b8 commit 5c925e8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion drivers/crypto/ccree/cc_aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion drivers/crypto/ccree/cc_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion include/linux/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5c925e8

Please sign in to comment.