diff options
author | Giovanni Cabiddu <giovanni.cabiddu@intel.com> | 2020-06-29 18:16:18 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-07-09 18:25:15 +1000 |
commit | b185a68710e074eeaffb595a31f9bb617c2aa890 (patch) | |
tree | e5891f17ca017245bf87e6468f99cd83aea56f2d | |
parent | 528f776df67c440361b2847b4da400d8754bf030 (diff) |
crypto: qat - validate xts key
Validate AES-XTS key using the function xts_verify_key() to prevent
malformed keys.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/qat/qat_common/qat_algs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 6bea6f868395..11f36eafda0c 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -995,6 +995,12 @@ static int qat_alg_skcipher_ctr_setkey(struct crypto_skcipher *tfm, static int qat_alg_skcipher_xts_setkey(struct crypto_skcipher *tfm, const u8 *key, unsigned int keylen) { + int ret; + + ret = xts_verify_key(tfm, key, keylen); + if (ret) + return ret; + return qat_alg_skcipher_setkey(tfm, key, keylen, ICP_QAT_HW_CIPHER_XTS_MODE); } |