Skip to content

Commit

Permalink
crypto: ccp - Add a call to xts_check_key()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gary R Hook authored and Herbert Xu committed Aug 4, 2017
1 parent e652399 commit 47f27f1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/crypto/ccp/ccp-crypto-aes-xts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47f27f1

Please sign in to comment.