Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[cascardo/linux.git] / arch / arm / crypto / aes-ce-glue.c
index 89a3a3e..da3c042 100644 (file)
@@ -15,6 +15,7 @@
 #include <crypto/ablk_helper.h>
 #include <crypto/algapi.h>
 #include <linux/module.h>
+#include <crypto/xts.h>
 
 MODULE_DESCRIPTION("AES-ECB/CBC/CTR/XTS using ARMv8 Crypto Extensions");
 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@linaro.org>");
@@ -152,6 +153,10 @@ static int xts_set_key(struct crypto_tfm *tfm, const u8 *in_key,
        struct crypto_aes_xts_ctx *ctx = crypto_tfm_ctx(tfm);
        int ret;
 
+       ret = xts_check_key(tfm, in_key, key_len);
+       if (ret)
+               return ret;
+
        ret = ce_aes_expandkey(&ctx->key1, in_key, key_len / 2);
        if (!ret)
                ret = ce_aes_expandkey(&ctx->key2, &in_key[key_len / 2],