Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: algapi - remove crypto_template::{alloc,free}()

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>

authored by

Eric Biggers and committed by
Herbert Xu
a24a1fd7 a39c66cc

+1 -33
-5
crypto/aead.c
··· 185 185 { 186 186 struct aead_instance *aead = aead_instance(inst); 187 187 188 - if (!aead->free) { 189 - inst->tmpl->free(inst); 190 - return; 191 - } 192 - 193 188 aead->free(aead); 194 189 } 195 190
-5
crypto/ahash.c
··· 515 515 { 516 516 struct ahash_instance *ahash = ahash_instance(inst); 517 517 518 - if (!ahash->free) { 519 - inst->tmpl->free(inst); 520 - return; 521 - } 522 - 523 518 ahash->free(ahash); 524 519 } 525 520
-5
crypto/algapi.c
··· 65 65 66 66 static void crypto_free_instance(struct crypto_instance *inst) 67 67 { 68 - if (!inst->alg.cra_type->free) { 69 - inst->tmpl->free(inst); 70 - return; 71 - } 72 - 73 68 inst->alg.cra_type->free(inst); 74 69 } 75 70
+1 -11
crypto/algboss.c
··· 58 58 { 59 59 struct cryptomgr_param *param = data; 60 60 struct crypto_template *tmpl; 61 - struct crypto_instance *inst; 62 61 int err; 63 62 64 63 tmpl = crypto_lookup_template(param->template); ··· 65 66 goto out; 66 67 67 68 do { 68 - if (tmpl->create) { 69 - err = tmpl->create(tmpl, param->tb); 70 - continue; 71 - } 72 - 73 - inst = tmpl->alloc(param->tb); 74 - if (IS_ERR(inst)) 75 - err = PTR_ERR(inst); 76 - else if ((err = crypto_register_instance(tmpl, inst))) 77 - tmpl->free(inst); 69 + err = tmpl->create(tmpl, param->tb); 78 70 } while (err == -EAGAIN && !signal_pending(current)); 79 71 80 72 crypto_tmpl_put(tmpl);
-5
crypto/shash.c
··· 427 427 { 428 428 struct shash_instance *shash = shash_instance(inst); 429 429 430 - if (!shash->free) { 431 - inst->tmpl->free(inst); 432 - return; 433 - } 434 - 435 430 shash->free(shash); 436 431 } 437 432
-2
include/crypto/algapi.h
··· 63 63 struct hlist_head instances; 64 64 struct module *module; 65 65 66 - struct crypto_instance *(*alloc)(struct rtattr **tb); 67 - void (*free)(struct crypto_instance *inst); 68 66 int (*create)(struct crypto_template *tmpl, struct rtattr **tb); 69 67 70 68 char name[CRYPTO_MAX_ALG_NAME];