]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
crypto: algapi - remove crypto_template::{alloc,free}()
authorEric Biggers <ebiggers@google.com>
Fri, 3 Jan 2020 04:04:39 +0000 (20:04 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 9 Jan 2020 03:30:58 +0000 (11:30 +0800)
Now that all templates provide a ->create() method which creates an
instance, installs a strongly-typed ->free() method directly to it, and
registers it, the older ->alloc() and ->free() methods in
'struct crypto_template' are no longer used.  Remove them.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/aead.c
crypto/ahash.c
crypto/algapi.c
crypto/algboss.c
crypto/shash.c
include/crypto/algapi.h

index 02a0db076d7ebb7a259f9ad60738520014a51a39..7707d322310171bed8a21c4aaa025dfc0935ed0b 100644 (file)
@@ -185,11 +185,6 @@ static void crypto_aead_free_instance(struct crypto_instance *inst)
 {
        struct aead_instance *aead = aead_instance(inst);
 
-       if (!aead->free) {
-               inst->tmpl->free(inst);
-               return;
-       }
-
        aead->free(aead);
 }
 
index 61e374d76b044ea2f580630613eac5bd692ec83a..cd5d9847d513a7751cf6c82fa837ef61c35f3c55 100644 (file)
@@ -515,11 +515,6 @@ static void crypto_ahash_free_instance(struct crypto_instance *inst)
 {
        struct ahash_instance *ahash = ahash_instance(inst);
 
-       if (!ahash->free) {
-               inst->tmpl->free(inst);
-               return;
-       }
-
        ahash->free(ahash);
 }
 
index 72592795c7e71be38a0445ffb78b43f0c6eab126..69605e21af92278181fb879d3c2d6fdd5d90f771 100644 (file)
@@ -65,11 +65,6 @@ static int crypto_check_alg(struct crypto_alg *alg)
 
 static void crypto_free_instance(struct crypto_instance *inst)
 {
-       if (!inst->alg.cra_type->free) {
-               inst->tmpl->free(inst);
-               return;
-       }
-
        inst->alg.cra_type->free(inst);
 }
 
index a62149d6c839f506df4971d781e80e308178471f..535f1f87e6c1d5760fa987ef6f273dc5cd0c3729 100644 (file)
@@ -58,7 +58,6 @@ static int cryptomgr_probe(void *data)
 {
        struct cryptomgr_param *param = data;
        struct crypto_template *tmpl;
-       struct crypto_instance *inst;
        int err;
 
        tmpl = crypto_lookup_template(param->template);
@@ -66,16 +65,7 @@ static int cryptomgr_probe(void *data)
                goto out;
 
        do {
-               if (tmpl->create) {
-                       err = tmpl->create(tmpl, param->tb);
-                       continue;
-               }
-
-               inst = tmpl->alloc(param->tb);
-               if (IS_ERR(inst))
-                       err = PTR_ERR(inst);
-               else if ((err = crypto_register_instance(tmpl, inst)))
-                       tmpl->free(inst);
+               err = tmpl->create(tmpl, param->tb);
        } while (err == -EAGAIN && !signal_pending(current));
 
        crypto_tmpl_put(tmpl);
index e05e75b0f402cad3373399edd4094dd1f66d76b8..70faf28b2d14adaa8d3ee32b6fff6483e4ce4de9 100644 (file)
@@ -427,11 +427,6 @@ static void crypto_shash_free_instance(struct crypto_instance *inst)
 {
        struct shash_instance *shash = shash_instance(inst);
 
-       if (!shash->free) {
-               inst->tmpl->free(inst);
-               return;
-       }
-
        shash->free(shash);
 }
 
index c16c50f8dac10e2fb99ce21bcbef4b40000a989f..e115f9215ed57455b0a60ab060247c79e9d25b8a 100644 (file)
@@ -63,8 +63,6 @@ struct crypto_template {
        struct hlist_head instances;
        struct module *module;
 
-       struct crypto_instance *(*alloc)(struct rtattr **tb);
-       void (*free)(struct crypto_instance *inst);
        int (*create)(struct crypto_template *tmpl, struct rtattr **tb);
 
        char name[CRYPTO_MAX_ALG_NAME];