Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: remove CRYPTO_TFM_RES_BAD_BLOCK_LEN

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
5c925e8b f9d89b85

-3
-1
drivers/crypto/ccree/cc_aead.c
··· 1925 1925 if (validate_data_size(ctx, direct, req)) { 1926 1926 dev_err(dev, "Unsupported crypt/assoc len %d/%d.\n", 1927 1927 req->cryptlen, areq_ctx->assoclen); 1928 - crypto_aead_set_flags(tfm, CRYPTO_TFM_RES_BAD_BLOCK_LEN); 1929 1928 return -EINVAL; 1930 1929 } 1931 1930
-1
drivers/crypto/ccree/cc_cipher.c
··· 837 837 /* TODO: check data length according to mode */ 838 838 if (validate_data_size(ctx_p, nbytes)) { 839 839 dev_err(dev, "Unsupported data size %d.\n", nbytes); 840 - crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_BLOCK_LEN); 841 840 rc = -EINVAL; 842 841 goto exit_process; 843 842 }
-1
include/linux/crypto.h
··· 114 114 #define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400 115 115 #define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 116 116 #define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 117 - #define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 118 117 119 118 /* 120 119 * Miscellaneous stuff.