Skip to contentSkip to conversation

crypto/ipsec_mb: fix clearing snow3g digest

PATCH Applied weid [email protected] 3 participants 5 messages Jan 20 – Jul 16 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/ipsec_mb: fix clearing snow3g digest

From: weid <[email protected]>

Before this patch, the software crypto_snow3g clear the encrypted auth snow3g digest when the dst mbuf is same as the src mbuf in crypto op.

This bug can be checked by following way, start app/dpdk-test --vdev=crypto_snow3g, run pdcp_autotest
the case failed when i=42 in run_test_for_one_known_vec() in test_pdcp.c. The case is PDCP control plane auth snow3g gen
+ cipher snow3g enc.
The case failed because the last 4 bytes are cleared in last for() loop in line 167 in process_snow3g_cipher_op() in pmd_snow3g.c .

Fixes 5208d68d30cb ("crypto/ipsec_mb: support snow3g digest appended ops")
---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +2 -1
index b3c3b05a8a..35fe23c157 100644
@@ -157,7 +157,8 @@ process_snow3g_cipher_op(struct ipsec_mb_qp *qp, struct rte_crypto_op **ops,
 	for (i = 0; i < num_ops; i++) {
 		if ((session->op == IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT ||
 			session->op == IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT) &&
-				ops[i]->sym->m_dst != NULL) {
+				ops[i]->sym->m_dst != NULL &&
+				ops[i]->sym->m_dst != ops[i]->sym->m_src) {
 			digest_appended[i] =
 				snow3g_digest_appended_in_src(ops[i]);
 			/* Clear unencrypted digest from
Signature · 1 line
2.51.0.windows.1
#1 lore raw

Hi Pablo/Kai,
Please ack if no objection

Quoted 45 lines

From: weid <[email protected]>

Before this patch, the software crypto_snow3g clear the encrypted auth snow3g digest when the dst mbuf is same as the src mbuf in crypto op.

This bug can be checked by following way, start app/dpdk-test --vdev=crypto_snow3g, run pdcp_autotest
the case failed when i=42 in run_test_for_one_known_vec() in test_pdcp.c. The case is PDCP control plane auth snow3g gen
+ cipher snow3g enc.
The case failed because the last 4 bytes are cleared in last for() loop in line 167 in process_snow3g_cipher_op() in pmd_snow3g.c .

Fixes 5208d68d30cb ("crypto/ipsec_mb: support snow3g digest appended ops")
---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +0 -0
index b3c3b05a8a..35fe23c157 100644
@@ -157,7 +157,8 @@ process_snow3g_cipher_op(struct ipsec_mb_qp *qp,
 struct rte_crypto_op **ops,
 	for (i = 0; i < num_ops; i++) {
 		if ((session->op ==

IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT ||
session->op ==
IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT) &&

drivers/crypto/ipsec_mb/pmd_snow3g.c +2 -2
-				ops[i]->sym->m_dst != NULL) {
+				ops[i]->sym->m_dst != NULL &&
+				ops[i]->sym->m_dst != ops[i]->sym->m_src) {
 			digest_appended[i] =
 				snow3g_digest_appended_in_src(ops[i]);
 			/* Clear unencrypted digest from
--

2.51.0.windows.1

#2 lore raw
Quoted 3 lines

Hi Pablo/Kai,
Please ack if no objection

Reminder for ack.

Quoted 47 lines
Quoted 19 lines

From: weid <[email protected]>

Before this patch, the software crypto_snow3g clear the encrypted auth snow3g digest when the dst mbuf is same as the src mbuf in crypto op.

This bug can be checked by following way, start app/dpdk-test --vdev=crypto_snow3g, run pdcp_autotest
the case failed when i=42 in run_test_for_one_known_vec() in test_pdcp.c. The case is PDCP control plane auth snow3g gen
+ cipher snow3g enc.
The case failed because the last 4 bytes are cleared in last for() loop in line 167 in process_snow3g_cipher_op() in pmd_snow3g.c .

Quoted 1 line
Fixes 5208d68d30cb ("crypto/ipsec_mb: support snow3g digest appended

ops")

Quoted 26 lines
---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +0 -0
index b3c3b05a8a..35fe23c157 100644
@@ -157,7 +157,8 @@ process_snow3g_cipher_op(struct ipsec_mb_qp *qp,
 struct rte_crypto_op **ops,
 	for (i = 0; i < num_ops; i++) {
 		if ((session->op ==

IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT ||
session->op ==
IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT) &&

drivers/crypto/ipsec_mb/pmd_snow3g.c +2 -2
-				ops[i]->sym->m_dst != NULL) {
+				ops[i]->sym->m_dst != NULL &&
+				ops[i]->sym->m_dst != ops[i]->sym->m_src) {
 			digest_appended[i] =
 				snow3g_digest_appended_in_src(ops[i]);
 			/* Clear unencrypted digest from
--

2.51.0.windows.1

Acked-by
#3 lore raw

Please aware the IPSEC SNOW3G and ZUC PMDs currently remained in DPDK will only be built for the ARM version: https://patches.dpdk.org/project/dpdk/list/?series=38319
The AESNI_MB PMD is recommended for IPSEC-MB lib

________________________________
From: Akhil Goyal <[email protected]>
Sent: Tuesday, March 10, 2026 14:05
To: Akhil Goyal <[email protected]>; Ji, Kai <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Cc: [email protected] <[email protected]>; weid [email protected] <[email protected]>
Subject: RE: [EXTERNAL] [PATCH] crypto/ipsec_mb: fix clearing snow3g digest

Quoted 3 lines

Hi Pablo/Kai,
Please ack if no objection

Reminder for ack.

Quoted 47 lines
Quoted 19 lines

From: weid <[email protected]>

Before this patch, the software crypto_snow3g clear the encrypted auth snow3g digest when the dst mbuf is same as the src mbuf in crypto op.

This bug can be checked by following way, start app/dpdk-test --vdev=crypto_snow3g, run pdcp_autotest
the case failed when i=42 in run_test_for_one_known_vec() in test_pdcp.c. The case is PDCP control plane auth snow3g gen
+ cipher snow3g enc.
The case failed because the last 4 bytes are cleared in last for() loop in line 167 in process_snow3g_cipher_op() in pmd_snow3g.c .

Quoted 1 line
Fixes 5208d68d30cb ("crypto/ipsec_mb: support snow3g digest appended

ops")

Quoted 26 lines
---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/pmd_snow3g.c +0 -0
index b3c3b05a8a..35fe23c157 100644
@@ -157,7 +157,8 @@ process_snow3g_cipher_op(struct ipsec_mb_qp *qp,
 struct rte_crypto_op **ops,
     for (i = 0; i < num_ops; i++) {
             if ((session->op ==

IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT ||

                     session->op ==

IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT) &&

drivers/crypto/ipsec_mb/pmd_snow3g.c +2 -2
-                           ops[i]->sym->m_dst != NULL) {
+                           ops[i]->sym->m_dst != NULL &&
+                           ops[i]->sym->m_dst != ops[i]->sym->m_src) {
                     digest_appended[i] =
                             snow3g_digest_appended_in_src(ops[i]);
                     /* Clear unencrypted digest from
--

2.51.0.windows.1