Skip to content

Commit

Permalink
crypto: ccm - Use crypto_aead_set_reqsize helper
Browse files Browse the repository at this point in the history
This patch uses the crypto_aead_set_reqsize helper to avoid directly
touching the internals of aead.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed May 13, 2015
1 parent 6650d09 commit 2c221ad
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crypto/ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ static int crypto_ccm_init_tfm(struct crypto_tfm *tfm)

align = crypto_tfm_alg_alignmask(tfm);
align &= ~(crypto_tfm_ctx_alignment() - 1);
tfm->crt_aead.reqsize = align +
sizeof(struct crypto_ccm_req_priv_ctx) +
crypto_ablkcipher_reqsize(ctr);
crypto_aead_set_reqsize(__crypto_aead_cast(tfm),
align + sizeof(struct crypto_ccm_req_priv_ctx) +
crypto_ablkcipher_reqsize(ctr));

return 0;

Expand Down Expand Up @@ -729,10 +729,10 @@ static int crypto_rfc4309_init_tfm(struct crypto_tfm *tfm)

align = crypto_aead_alignmask(aead);
align &= ~(crypto_tfm_ctx_alignment() - 1);
tfm->crt_aead.reqsize = sizeof(struct aead_request) +
ALIGN(crypto_aead_reqsize(aead),
crypto_tfm_ctx_alignment()) +
align + 16;
crypto_aead_set_reqsize(__crypto_aead_cast(tfm),
sizeof(struct aead_request) +
ALIGN(crypto_aead_reqsize(aead), crypto_tfm_ctx_alignment()) +
align + 16);

return 0;
}
Expand Down

0 comments on commit 2c221ad

Please sign in to comment.