Skip to content

Commit

Permalink
crypto: qat - Use helper to set reqsize
Browse files Browse the repository at this point in the history
[ Upstream commit 80e62ad ]

The value of reqsize must only be changed through the helper.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Stable-dep-of: eb7713f ("crypto: qat - unmap buffer before free for DH")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
herbertx authored and gregkh committed Jul 19, 2023
1 parent 2db4999 commit da1729e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/crypto/qat/qat_common/qat_asym_algs.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ static int qat_dh_init_tfm(struct crypto_kpp *tfm)
if (!inst)
return -EINVAL;

kpp_set_reqsize(tfm, sizeof(struct qat_asym_request) + 64);

ctx->p_size = 0;
ctx->g2 = false;
ctx->inst = inst;
Expand Down Expand Up @@ -1230,6 +1232,8 @@ static int qat_rsa_init_tfm(struct crypto_akcipher *tfm)
if (!inst)
return -EINVAL;

akcipher_set_reqsize(tfm, sizeof(struct qat_asym_request) + 64);

ctx->key_sz = 0;
ctx->inst = inst;
return 0;
Expand All @@ -1252,7 +1256,6 @@ static struct akcipher_alg rsa = {
.max_size = qat_rsa_max_size,
.init = qat_rsa_init_tfm,
.exit = qat_rsa_exit_tfm,
.reqsize = sizeof(struct qat_asym_request) + 64,
.base = {
.cra_name = "rsa",
.cra_driver_name = "qat-rsa",
Expand All @@ -1269,7 +1272,6 @@ static struct kpp_alg dh = {
.max_size = qat_dh_max_size,
.init = qat_dh_init_tfm,
.exit = qat_dh_exit_tfm,
.reqsize = sizeof(struct qat_asym_request) + 64,
.base = {
.cra_name = "dh",
.cra_driver_name = "qat-dh",
Expand Down

0 comments on commit da1729e

Please sign in to comment.