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

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>

authored by

Gary R Hook and committed by
Herbert Xu
47f27f16 e652399e

+8 -1
+8 -1
drivers/crypto/ccp/ccp-crypto-aes-xts.c
··· 16 16 #include <linux/delay.h> 17 17 #include <linux/scatterlist.h> 18 18 #include <crypto/aes.h> 19 + #include <crypto/xts.h> 19 20 #include <crypto/internal/skcipher.h> 20 21 #include <crypto/scatterwalk.h> 21 22 ··· 98 97 static int ccp_aes_xts_setkey(struct crypto_ablkcipher *tfm, const u8 *key, 99 98 unsigned int key_len) 100 99 { 101 - struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ablkcipher_tfm(tfm)); 100 + struct crypto_tfm *xfm = crypto_ablkcipher_tfm(tfm); 101 + struct ccp_ctx *ctx = crypto_tfm_ctx(xfm); 102 + int ret; 103 + 104 + ret = xts_check_key(xfm, key, key_len); 105 + if (ret) 106 + return ret; 102 107 103 108 /* Only support 128-bit AES key with a 128-bit Tweak key, 104 109 * otherwise use the fallback