Skip to content

Commit 92b9876

Browse files
committed
crypto: cryptd - Add setkey/setauthsize functions for AEAD
This patch adds setkey and setauthsize for cryptd AEAD. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 0496f56 commit 92b9876

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

‎crypto/cryptd.c‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,24 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
664664
return err;
665665
}
666666

667+
static int cryptd_aead_setkey(struct crypto_aead *parent,
668+
const u8 *key, unsigned int keylen)
669+
{
670+
struct cryptd_aead_ctx *ctx = crypto_aead_ctx(parent);
671+
struct crypto_aead *child = ctx->child;
672+
673+
return crypto_aead_setkey(child, key, keylen);
674+
}
675+
676+
static int cryptd_aead_setauthsize(struct crypto_aead *parent,
677+
unsigned int authsize)
678+
{
679+
struct cryptd_aead_ctx *ctx = crypto_aead_ctx(parent);
680+
struct crypto_aead *child = ctx->child;
681+
682+
return crypto_aead_setauthsize(child, authsize);
683+
}
684+
667685
static void cryptd_aead_crypt(struct aead_request *req,
668686
struct crypto_aead *child,
669687
int err,
@@ -793,8 +811,8 @@ static int cryptd_create_aead(struct crypto_template *tmpl,
793811
inst->alg.cra_ctxsize = sizeof(struct cryptd_aead_ctx);
794812
inst->alg.cra_init = cryptd_aead_init_tfm;
795813
inst->alg.cra_exit = cryptd_aead_exit_tfm;
796-
inst->alg.cra_aead.setkey = alg->cra_aead.setkey;
797-
inst->alg.cra_aead.setauthsize = alg->cra_aead.setauthsize;
814+
inst->alg.cra_aead.setkey = cryptd_aead_setkey;
815+
inst->alg.cra_aead.setauthsize = cryptd_aead_setauthsize;
798816
inst->alg.cra_aead.geniv = alg->cra_aead.geniv;
799817
inst->alg.cra_aead.ivsize = alg->cra_aead.ivsize;
800818
inst->alg.cra_aead.maxauthsize = alg->cra_aead.maxauthsize;

0 commit comments

Comments
 (0)