Skip to content

Commit

Permalink
crypto: api - Add new template create function
Browse files Browse the repository at this point in the history
This patch introduces the template->create function intended
to replace the existing alloc function.  The intention is for
create to handle the registration directly, whereas currently
the caller of alloc has to handle the registration.

This allows type-specific code to be run prior to registration.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jul 7, 2009
1 parent fd09d7f commit f2ac72e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crypto/algboss.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ static int cryptomgr_probe(void *data)
goto err;

do {
if (tmpl->create) {
err = tmpl->create(tmpl, param->tb);
continue;
}

inst = tmpl->alloc(param->tb);
if (IS_ERR(inst))
err = PTR_ERR(inst);
Expand Down
1 change: 1 addition & 0 deletions include/crypto/algapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct crypto_template {

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];
};
Expand Down

0 comments on commit f2ac72e

Please sign in to comment.