Skip to content

Commit 2acbb87

Browse files
gcabidduherbertx
authored andcommitted
crypto: qat - add param check for DH
Reject requests with a source buffer that is bigger than the size of the key. This is to prevent a possible integer underflow that might happen when copying the source scatterlist into a linear buffer. Cc: stable@vger.kernel.org Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Adam Guerin <adam.guerin@intel.com> Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 9714061 commit 2acbb87

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/crypto/qat/qat_common/qat_asym_algs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ static int qat_dh_compute_value(struct kpp_request *req)
235235
req->dst_len = ctx->p_size;
236236
return -EOVERFLOW;
237237
}
238+
239+
if (req->src_len > ctx->p_size)
240+
return -EINVAL;
241+
238242
memset(msg, '\0', sizeof(*msg));
239243
ICP_QAT_FW_PKE_HDR_VALID_FLAG_SET(msg->pke_hdr,
240244
ICP_QAT_FW_COMN_REQ_FLAG_SET);

0 commit comments

Comments
 (0)