Skip to content

Commit

Permalink
crypto: cryptd - Add setkey/setauthsize functions for AEAD
Browse files Browse the repository at this point in the history
This patch adds setkey and setauthsize for cryptd AEAD.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
herbertx committed Jun 3, 2015
1 parent 0496f56 commit 92b9876
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions crypto/cryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,24 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
return err;
}

static int cryptd_aead_setkey(struct crypto_aead *parent,
const u8 *key, unsigned int keylen)
{
struct cryptd_aead_ctx *ctx = crypto_aead_ctx(parent);
struct crypto_aead *child = ctx->child;

return crypto_aead_setkey(child, key, keylen);
}

static int cryptd_aead_setauthsize(struct crypto_aead *parent,
unsigned int authsize)
{
struct cryptd_aead_ctx *ctx = crypto_aead_ctx(parent);
struct crypto_aead *child = ctx->child;

return crypto_aead_setauthsize(child, authsize);
}

static void cryptd_aead_crypt(struct aead_request *req,
struct crypto_aead *child,
int err,
Expand Down Expand Up @@ -793,8 +811,8 @@ static int cryptd_create_aead(struct crypto_template *tmpl,
inst->alg.cra_ctxsize = sizeof(struct cryptd_aead_ctx);
inst->alg.cra_init = cryptd_aead_init_tfm;
inst->alg.cra_exit = cryptd_aead_exit_tfm;
inst->alg.cra_aead.setkey = alg->cra_aead.setkey;
inst->alg.cra_aead.setauthsize = alg->cra_aead.setauthsize;
inst->alg.cra_aead.setkey = cryptd_aead_setkey;
inst->alg.cra_aead.setauthsize = cryptd_aead_setauthsize;
inst->alg.cra_aead.geniv = alg->cra_aead.geniv;
inst->alg.cra_aead.ivsize = alg->cra_aead.ivsize;
inst->alg.cra_aead.maxauthsize = alg->cra_aead.maxauthsize;
Expand Down

0 comments on commit 92b9876

Please sign in to comment.