diff options
author | Gary R Hook <gary.hook@amd.com> | 2017-07-25 22:21:23 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-08-04 04:27:42 +0300 |
commit | 47f27f160be6d26d61d3e75923e635e4e6c099fb (patch) | |
tree | 7a54a32dabd26730b0bf3a640c1417393fcf3924 /drivers/crypto | |
parent | e652399edba99a5497f0d80f240c9075d3b43493 (diff) | |
download | linux-47f27f160be6d26d61d3e75923e635e4e6c099fb.tar.xz |
crypto: ccp - Add a call to xts_check_key()
Vet the key using the available standard function
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/ccp/ccp-crypto-aes-xts.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-xts.c b/drivers/crypto/ccp/ccp-crypto-aes-xts.c index 3f26a415ef44..2b5d3a62fad9 100644 --- a/drivers/crypto/ccp/ccp-crypto-aes-xts.c +++ b/drivers/crypto/ccp/ccp-crypto-aes-xts.c @@ -16,6 +16,7 @@ #include <linux/delay.h> #include <linux/scatterlist.h> #include <crypto/aes.h> +#include <crypto/xts.h> #include <crypto/internal/skcipher.h> #include <crypto/scatterwalk.h> @@ -97,7 +98,13 @@ static int ccp_aes_xts_complete(struct crypto_async_request *async_req, int ret) static int ccp_aes_xts_setkey(struct crypto_ablkcipher *tfm, const u8 *key, unsigned int key_len) { - struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ablkcipher_tfm(tfm)); + struct crypto_tfm *xfm = crypto_ablkcipher_tfm(tfm); + struct ccp_ctx *ctx = crypto_tfm_ctx(xfm); + int ret; + + ret = xts_check_key(xfm, key, key_len); + if (ret) + return ret; /* Only support 128-bit AES key with a 128-bit Tweak key, * otherwise use the fallback |