diff options
author | Stephan Mueller <smueller@chronox.de> | 2016-02-09 15:37:47 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-02-17 04:07:51 +0800 |
commit | 28856a9e52c7cac712af6c143de04766617535dc (patch) | |
tree | 4ee6c79e76f8eadc0148bfeb09fd146c9d53fabf /arch/powerpc/crypto | |
parent | 730d02e27670fa5b6a55778d11023c5897d87d57 (diff) | |
download | linux-28856a9e52c7cac712af6c143de04766617535dc.tar.gz linux-28856a9e52c7cac712af6c143de04766617535dc.tar.bz2 linux-28856a9e52c7cac712af6c143de04766617535dc.zip |
crypto: xts - consolidate sanity check for keys
The patch centralizes the XTS key check logic into the service function
xts_check_key which is invoked from the different XTS implementations.
With this, the XTS implementations in ARM, ARM64, PPC and S390 have now
a sanity check for the XTS keys similar to the other arches.
In addition, this service function received a check to ensure that the
key != the tweak key which is mandated by FIPS 140-2 IG A.9. As the
check is not present in the standards defining XTS, it is only enforced
in FIPS mode of the kernel.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/powerpc/crypto')
-rw-r--r-- | arch/powerpc/crypto/aes-spe-glue.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/crypto/aes-spe-glue.c b/arch/powerpc/crypto/aes-spe-glue.c index 93ee046d12cd..160807977abe 100644 --- a/arch/powerpc/crypto/aes-spe-glue.c +++ b/arch/powerpc/crypto/aes-spe-glue.c @@ -126,6 +126,11 @@ static int ppc_xts_setkey(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) { struct ppc_xts_ctx *ctx = crypto_tfm_ctx(tfm); + int err; + + err = xts_check_key(tfm, in_key, key_len); + if (err) + return err; key_len >>= 1; |