]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - crypto/ctr.c
nvmet: release the sq ref on rdma read errors
[karo-tx-linux.git] / crypto / ctr.c
index a4f4a8983169b0a6293aa28ca557cc7adfb84333..477d9226ccaac99c087bf0df5f51597a34518100 100644 (file)
@@ -181,15 +181,24 @@ static void crypto_ctr_exit_tfm(struct crypto_tfm *tfm)
 static struct crypto_instance *crypto_ctr_alloc(struct rtattr **tb)
 {
        struct crypto_instance *inst;
+       struct crypto_attr_type *algt;
        struct crypto_alg *alg;
+       u32 mask;
        int err;
 
        err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER);
        if (err)
                return ERR_PTR(err);
 
-       alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER,
-                                 CRYPTO_ALG_TYPE_MASK);
+       algt = crypto_get_attr_type(tb);
+       if (IS_ERR(algt))
+               return ERR_CAST(algt);
+
+       mask = CRYPTO_ALG_TYPE_MASK |
+               crypto_requires_off(algt->type, algt->mask,
+                                   CRYPTO_ALG_NEED_FALLBACK);
+
+       alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER, mask);
        if (IS_ERR(alg))
                return ERR_CAST(alg);
 
@@ -350,6 +359,8 @@ static int crypto_rfc3686_create(struct crypto_template *tmpl,
        struct skcipher_alg *alg;
        struct crypto_skcipher_spawn *spawn;
        const char *cipher_name;
+       u32 mask;
+
        int err;
 
        algt = crypto_get_attr_type(tb);
@@ -367,12 +378,14 @@ static int crypto_rfc3686_create(struct crypto_template *tmpl,
        if (!inst)
                return -ENOMEM;
 
+       mask = crypto_requires_sync(algt->type, algt->mask) |
+               crypto_requires_off(algt->type, algt->mask,
+                                   CRYPTO_ALG_NEED_FALLBACK);
+
        spawn = skcipher_instance_ctx(inst);
 
        crypto_set_skcipher_spawn(spawn, skcipher_crypto_instance(inst));
-       err = crypto_grab_skcipher(spawn, cipher_name, 0,
-                                  crypto_requires_sync(algt->type,
-                                                       algt->mask));
+       err = crypto_grab_skcipher(spawn, cipher_name, 0, mask);
        if (err)
                goto err_free_inst;