crypto/ipsec_mb: fix usage of untrusted value
PATCH 1/1 crypto/ipsec_mb: fix usage of untrusted value
This patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)
Coverity issue: CID 375828
--- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c +3 -0
@@ -206,6 +206,9 @@ post_process_gcm_crypto_op(struct ipsec_mb_qp *qp, op->status =RTE_CRYPTO_OP_STATUS_AUTH_FAILED ; }else {if (session->req_digest_length != session->gen_digest_length) { + session->req_digest_length = +RTE_MIN (session->req_digest_length, +DIGEST_LENGTH_MAX );if (session->op ==IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT ) memcpy(op->sym->aead.digest.data,
Signature · 13 lines
2.30.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH v2 1/1 crypto/ipsec_mb: fix usage of untrusted value
This patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)
Coverity issue: CID 375828
---
v2: use a different logic to check digest length
--- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c +8 -4
@@ -96,7 +96,9 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, sess->iv.length = auth_xform->auth.iv.length; key_length = auth_xform->auth.key.length; key = auth_xform->auth.key.data; - sess->req_digest_length = auth_xform->auth.digest_length; + sess->req_digest_length = +RTE_MIN (auth_xform->auth.digest_length, +DIGEST_LENGTH_MAX );break ;case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT :case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT :
@@ -116,7 +118,9 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, key_length = aead_xform->aead.key.length; key = aead_xform->aead.key.data; sess->aad_length = aead_xform->aead.aad_length; - sess->req_digest_length = aead_xform->aead.digest_length; + sess->req_digest_length = +RTE_MIN (aead_xform->aead.digest_length, +DIGEST_LENGTH_MAX );break ;default : IPSEC_MB_LOG(
@@ -146,7 +150,7 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, }/* Digest check */ -if (sess->req_digest_length >16 ) { +if (sess->req_digest_length >DIGEST_LENGTH_MAX ) {IPSEC_MB_LOG (ERR ,"Invalid digest length" ); ret = -EINVAL ; goto error_exit;
@@ -157,7 +161,7 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session,* the requested number of bytes. */ if (sess->req_digest_length <4 ) - sess->gen_digest_length =16 ; + sess->gen_digest_length =DIGEST_LENGTH_MAX ;else sess->gen_digest_length = sess->req_digest_length;
Signature · 13 lines
2.30.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Quoted 16 lines
-----Original Message-----
From: Bronowski, PiotrX <[email protected]>
Sent: Monday, March 7, 2022 3:33 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty, Declan <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Subject: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueThis patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)Coverity issue: CID 375828
Fixes 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
Quoted 7 lines
Signed-off-by Piotr Bronowski <[email protected]>---
v2: use a different logic to check digest length
---
Ji, Kai
Acked-byQuoted 16 lines
Quoted 16 lines
-----Original Message-----
From: Bronowski, PiotrX <[email protected]>
Sent: Monday, March 7, 2022 3:33 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty, Declan <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Subject: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueThis patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)Coverity issue: CID 375828
Fixes 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
Quoted 8 lines
Quoted 7 lines
Signed-off-by Piotr Bronowski <[email protected]>---
v2: use a different logic to check digest length
---Acked-by Fan Zhang <[email protected]>
Hi Piotr,
Quoted 26 lines
-----Original Message-----
From: Zhang, Roy Fan <[email protected]>
Sent: Monday, March 7, 2022 4:27 PM
To: Bronowski, PiotrX <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty, Declan <[email protected]>; [email protected]
Subject: RE: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueQuoted 6 lines
-----Original Message-----
From: Bronowski, PiotrX <[email protected]>
Sent: Monday, March 7, 2022 3:33 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty,Declan
Quoted 10 lines
<[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Subject: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueThis patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)Coverity issue: CID 375828
Fixes 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
Quoted 8 lines
Quoted 7 lines
Signed-off-by Piotr Bronowski <[email protected]>---
v2: use a different logic to check digest length
---Acked-by Fan Zhang <[email protected]>
Sorry I missed a point in your change and thanks for Ciara pointing this out. You are changing the gen_digest_size to 64 which is wrong.
Please send v3.
Also instead of ack - Nack this patch.
Hi Piotr,
Quoted 45 lines
-----Original Message-----
From: Zhang, Roy Fan <[email protected]>
Sent: Wednesday 9 March 2022 14:35
To: Zhang, Roy Fan <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty, Declan <[email protected]>; [email protected]; Power, Ciara <[email protected]>
Subject: RE: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueHi Piotr,
Quoted 33 lines
-----Original Message-----
From: Zhang, Roy Fan <[email protected]>
Sent: Monday, March 7, 2022 4:27 PM
To: Bronowski, PiotrX <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty, Declan <[email protected]>; [email protected]
Subject: RE: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueQuoted 6 lines
-----Original Message-----
From: Bronowski, PiotrX <[email protected]>
Sent: Monday, March 7, 2022 3:33 PM
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty,Declan
Quoted 17 lines
<[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Subject: [PATCH v2]crypto/ipsec_mb: fix usage of untrusted valueThis patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)Coverity issue: CID 375828
Fixes 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")Signed-off-by Piotr Bronowski <[email protected]>---
v2: use a different logic to check digest length
---
Quoted 6 lines
Quoted 1 line
Acked-by Fan Zhang <[email protected]>Sorry I missed a point in your change and thanks for Ciara pointing this out. You are changing the
gen_digest_sizeto 64 which is wrong.
Please send v3.
Also instead of ack - Nack this patch.
[CP]
In the v3 I think Fixes line should also be updated to either:
Or
(The second one seems to be where the code was introduced before being moved into the consolidated ipsec_mb PMD in 21.11)
Thanks,
Ciara
PATCH v3 1/1 crypto/ipsec_mb: fix coverity issue
In reply to Piotr BronowskiThis patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)
Coverity issue: CID 375828
---
v3: use a different logic to check digest length
--- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c +6 -2
@@ -96,7 +96,9 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, sess->iv.length = auth_xform->auth.iv.length; key_length = auth_xform->auth.key.length; key = auth_xform->auth.key.data; - sess->req_digest_length = auth_xform->auth.digest_length; + sess->req_digest_length = +RTE_MIN (auth_xform->auth.digest_length, +DIGEST_LENGTH_MAX );break ;case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT :case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT :
@@ -116,7 +118,9 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, key_length = aead_xform->aead.key.length; key = aead_xform->aead.key.data; sess->aad_length = aead_xform->aead.aad_length; - sess->req_digest_length = aead_xform->aead.digest_length; + sess->req_digest_length = +RTE_MIN (aead_xform->aead.digest_length, +DIGEST_LENGTH_MAX );break ;default : IPSEC_MB_LOG(
Signature · 13 lines
2.30.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
PATCH v4 1/1 crypto/ipsec_mb: fix coverity issue
This patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)
Coverity issue: CID 375828
---
v4: commit message corrected
--- drivers/crypto/ipsec_mb/pmd_aesni_gcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/ipsec_mb/pmd_aesni_gcm.c +6 -2
@@ -96,7 +96,9 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, sess->iv.length = auth_xform->auth.iv.length; key_length = auth_xform->auth.key.length; key = auth_xform->auth.key.data; - sess->req_digest_length = auth_xform->auth.digest_length; + sess->req_digest_length = +RTE_MIN (auth_xform->auth.digest_length, +DIGEST_LENGTH_MAX );break ;case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT :case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT :
@@ -116,7 +118,9 @@ aesni_gcm_session_configure(IMB_MGR *mb_mgr, void *session, key_length = aead_xform->aead.key.length; key = aead_xform->aead.key.data; sess->aad_length = aead_xform->aead.aad_length; - sess->req_digest_length = aead_xform->aead.digest_length; + sess->req_digest_length = +RTE_MIN (aead_xform->aead.digest_length, +DIGEST_LENGTH_MAX );break ;default : IPSEC_MB_LOG(
Signature · 13 lines
2.30.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
RE: [PATCH v4] crypto/ipsec_mb: fix coverity issue
Quoted 27 lines
-----Original Message-----
From: Piotr Bronowski <[email protected]>
Sent: Wednesday 9 March 2022 18:02
To: [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Yigit, Ferruh <[email protected]>; Doherty, Declan <[email protected]>; Bronowski, PiotrX <[email protected]>; [email protected]
Subject: [PATCH v4]crypto/ipsec_mb: fix coverity issueThis patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)Coverity issue: CID 375828
Fixes ceb863938708 ("crypto/aesni_gcm: support all truncated digest sizes")Signed-off-by Piotr Bronowski <[email protected]>---
v4: commit message corrected
---drivers/crypto/ipsec_mb/pmd_aesni_gcm.c| 8 ++++++--1 file changed, 6 insertions(+), 2 deletions(-)
<snip>
Re: [PATCH v4] crypto/ipsec_mb: fix coverity issue
Quoted 2 lines
Quoted 2 lines
This patch removes coverity defect CID 375828:
Untrusted value as argument (TAINTED_SCALAR)
It lacks an explanation of the cause.
Quoted 1 line
Quoted 1 line
Coverity issue: CID 375828
You should not write CID above.
Quoted 6 lines
Quoted 6 lines
Fixes ceb863938708 ("crypto/aesni_gcm: support all truncated digest sizes")Signed-off-by Piotr Bronowski <[email protected]>
This Cc should be just below the "Fixes".
Quoted 1 line
Acked-by Ciara Power <[email protected]>
Fixed formatting, writing a better title, and applied.