crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN
[linux-block.git] / arch / arm64 / crypto / aes-glue.c
index aa57dc639f77fbef95a1dc3c042fdaa58487c44d..ed5409c6abf4e99183d3a59b19a8f11e766b80ca 100644 (file)
@@ -132,13 +132,8 @@ static int skcipher_aes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
                               unsigned int key_len)
 {
        struct crypto_aes_ctx *ctx = crypto_skcipher_ctx(tfm);
-       int ret;
-
-       ret = aes_expandkey(ctx, in_key, key_len);
-       if (ret)
-               crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
 
-       return ret;
+       return aes_expandkey(ctx, in_key, key_len);
 }
 
 static int __maybe_unused xts_set_key(struct crypto_skcipher *tfm,
@@ -155,11 +150,7 @@ static int __maybe_unused xts_set_key(struct crypto_skcipher *tfm,
        if (!ret)
                ret = aes_expandkey(&ctx->key2, &in_key[key_len / 2],
                                    key_len / 2);
-       if (!ret)
-               return 0;
-
-       crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
-       return -EINVAL;
+       return ret;
 }
 
 static int __maybe_unused essiv_cbc_set_key(struct crypto_skcipher *tfm,
@@ -173,19 +164,12 @@ static int __maybe_unused essiv_cbc_set_key(struct crypto_skcipher *tfm,
 
        ret = aes_expandkey(&ctx->key1, in_key, key_len);
        if (ret)
-               goto out;
+               return ret;
 
        desc->tfm = ctx->hash;
        crypto_shash_digest(desc, in_key, key_len, digest);
 
-       ret = aes_expandkey(&ctx->key2, digest, sizeof(digest));
-       if (ret)
-               goto out;
-
-       return 0;
-out:
-       crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
-       return -EINVAL;
+       return aes_expandkey(&ctx->key2, digest, sizeof(digest));
 }
 
 static int __maybe_unused ecb_encrypt(struct skcipher_request *req)
@@ -791,13 +775,8 @@ static int cbcmac_setkey(struct crypto_shash *tfm, const u8 *in_key,
                         unsigned int key_len)
 {
        struct mac_tfm_ctx *ctx = crypto_shash_ctx(tfm);
-       int err;
 
-       err = aes_expandkey(&ctx->key, in_key, key_len);
-       if (err)
-               crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
-
-       return err;
+       return aes_expandkey(&ctx->key, in_key, key_len);
 }
 
 static void cmac_gf128_mul_by_x(be128 *y, const be128 *x)