Commit b185a687 authored by Giovanni Cabiddu's avatar Giovanni Cabiddu Committed by Herbert Xu
Browse files

crypto: qat - validate xts key



Validate AES-XTS key using the function xts_verify_key() to prevent
malformed keys.

Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 528f776d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);
}