crypto: xts - consolidate sanity check for keys
[deliverable/linux.git] / arch / x86 / crypto / cast6_avx_glue.c
index fca459578c355d8104654bad9d06e88c136e2f61..50e684768c555e95e57023ee781bc64418af93ef 100644 (file)
@@ -329,13 +329,9 @@ static int xts_cast6_setkey(struct crypto_tfm *tfm, const u8 *key,
        u32 *flags = &tfm->crt_flags;
        int err;
 
-       /* key consists of keys of equal size concatenated, therefore
-        * the length must be even
-        */
-       if (keylen % 2) {
-               *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
-               return -EINVAL;
-       }
+       err = xts_check_key(tfm, key, keylen);
+       if (err)
+               return err;
 
        /* first half of xts-key is for crypt */
        err = __cast6_setkey(&ctx->crypt_ctx, key, keylen / 2, flags);
This page took 0.024851 seconds and 5 git commands to generate.