Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: qat - fix parameter order used in ICP_QAT_FW_COMN_FLAGS_BUILD

The macro ICP_QAT_FW_COMN_FLAGS_BUILD sets flags in the firmware
descriptor to indicate:

* Whether the content descriptor is a pointer or contains embedded
data.
* Whether the source and destination buffers are scatter-gather lists
or flat buffers.

The correct parameter order is:

* First: content descriptor type
* Second: source/destination pointer type

In the asymmetric crypto code, the macro was used with the parameters
swapped. Although this does not cause functional issues, since both
macros currently evaluate to 0, it is incorrect.

Fix the parameter order in the Diffie-Hellman and RSA code paths.

Fixes: a990532023b9 ("crypto: qat - Add support for RSA algorithm")
Fixes: c9839143ebbf ("crypto: qat - Add DH support")
Reported-by: Qihua Dai <qihua.dai@intel.com> # off-list
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Giovanni Cabiddu and committed by
Herbert Xu
e3d036fe b74fd80d

+6 -6
+6 -6
drivers/crypto/intel/qat/qat_common/qat_asym_algs.c
··· 255 255 qat_req->areq.dh = req; 256 256 msg->pke_hdr.service_type = ICP_QAT_FW_COMN_REQ_CPM_FW_PKE; 257 257 msg->pke_hdr.comn_req_flags = 258 - ICP_QAT_FW_COMN_FLAGS_BUILD(QAT_COMN_PTR_TYPE_FLAT, 259 - QAT_COMN_CD_FLD_TYPE_64BIT_ADR); 258 + ICP_QAT_FW_COMN_FLAGS_BUILD(QAT_COMN_CD_FLD_TYPE_64BIT_ADR, 259 + QAT_COMN_PTR_TYPE_FLAT); 260 260 261 261 /* 262 262 * If no source is provided use g as base ··· 731 731 qat_req->areq.rsa = req; 732 732 msg->pke_hdr.service_type = ICP_QAT_FW_COMN_REQ_CPM_FW_PKE; 733 733 msg->pke_hdr.comn_req_flags = 734 - ICP_QAT_FW_COMN_FLAGS_BUILD(QAT_COMN_PTR_TYPE_FLAT, 735 - QAT_COMN_CD_FLD_TYPE_64BIT_ADR); 734 + ICP_QAT_FW_COMN_FLAGS_BUILD(QAT_COMN_CD_FLD_TYPE_64BIT_ADR, 735 + QAT_COMN_PTR_TYPE_FLAT); 736 736 737 737 qat_req->in.rsa.enc.e = ctx->dma_e; 738 738 qat_req->in.rsa.enc.n = ctx->dma_n; ··· 867 867 qat_req->areq.rsa = req; 868 868 msg->pke_hdr.service_type = ICP_QAT_FW_COMN_REQ_CPM_FW_PKE; 869 869 msg->pke_hdr.comn_req_flags = 870 - ICP_QAT_FW_COMN_FLAGS_BUILD(QAT_COMN_PTR_TYPE_FLAT, 871 - QAT_COMN_CD_FLD_TYPE_64BIT_ADR); 870 + ICP_QAT_FW_COMN_FLAGS_BUILD(QAT_COMN_CD_FLD_TYPE_64BIT_ADR, 871 + QAT_COMN_PTR_TYPE_FLAT); 872 872 873 873 if (ctx->crt_mode) { 874 874 qat_req->in.rsa.dec_crt.p = ctx->dma_p;