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>
This commit is contained in:
Giovanni Cabiddu 2020-06-29 18:16:18 +01:00 committed by Herbert Xu
parent 528f776df6
commit b185a68710
1 changed files with 6 additions and 0 deletions

View File

@ -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, static int qat_alg_skcipher_xts_setkey(struct crypto_skcipher *tfm,
const u8 *key, unsigned int keylen) 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, return qat_alg_skcipher_setkey(tfm, key, keylen,
ICP_QAT_HW_CIPHER_XTS_MODE); ICP_QAT_HW_CIPHER_XTS_MODE);
} }