Bug: crypto_snow3g failed in Auth snow3g + Cipher snow3g

Stephen Hemminger stephen at networkplumber.org
Fri Jan 16 18:53:57 CET 2026


On Fri, 16 Jan 2026 18:45:15 +0800
coolwilled <coolwilled at gmail.com> wrote:

> Hi,
> I run "pdcp_autotest"  with --vdev=crypto_snow3g in app/dpdk-test in dpdk
> v25.11.
> When i = 42 in run_test_for_one_know_vec() in test_pdcp.c,
> It is PDCP control plane Auth snow3g gen + Cipher sonw3g enc,
> the case failed because the last 4 bytes is cleared in
> last for() loop in line 167 in  process_snow3g_cipher_op() in pmd_snow3g.c .
> 
> It can be fixed with following change:
> 
> diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c
> b/drivers/crypto/ipsec_mb/pmd_snow3g.c
> index b3c3b05a8a..45a8be5fc8 100644
> --- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
> +++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
> @@ -157,7 +157,7 @@ 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

For a more complete idea of what is missing for a DPDK patch submission.
Here is the semi-automated AI patch review:

## Patch Review: crypto_snow3g Bug Report

This submission is **not a proper patch** - it's a bug report email with an embedded code suggestion. If the author wants this fix merged, they need to submit a formal patch. Here's my assessment against the AGENTS.md criteria:

---

### **ERRORS (Must Fix)**

| Issue | Details |
|-------|---------|
| **Missing Signed-off-by** | No `Signed-off-by:` tag present. Required for all patches. |
| **Invalid Subject Line Format** | `Bug: crypto_snow3g failed...` is a bug report title, not a commit subject. Should be: `crypto/snow3g: fix digest clear for in-place operations` or similar |
| **Wrong Component Prefix** | Uses `Bug:` instead of proper prefix like `crypto/snow3g:` |
| **Subject Line Too Long** | At 55 characters visible, but the full title would exceed 60 characters |
| **Incomplete Patch** | The diff is truncated - missing the context and the complete change |
| **Line Wrapping in Diff** | Lines 115-116 and 121-122 show improper line wrapping in the diff output itself |

---

### **WARNINGS (Should Fix)**

| Issue | Details |
|-------|---------|
| **Missing Fixes Tag** | If this fixes a regression, it should include `Fixes: <sha> ("original commit")` |
| **Missing Cc: stable at dpdk.org** | Bug fixes should typically be CC'd to stable |
| **No Bugzilla ID** | If there's a bugzilla entry, include `Bugzilla ID: NNNNN` |
| **Body starts informally** | Commit body should not read like an email; should describe the bug/fix concisely |

---

### **The Actual Code Change**

Looking at the suggested fix:
```c
-                               ops[i]->sym->m_dst != NULL) {
+                               ops[i]->sym->m_dst != NULL &&
+                               ops[i]->sym->m_dst != ops[i]->sym->m_src) {
```

The logic looks **correct** - it adds a check to avoid clearing the digest when the operation is in-place (src == dst). However:

1. **Line length**: Need to verify the continuation doesn't exceed 100 characters
2. **Explicit comparison style**: Using `!= NULL` is correct per DPDK style

---

### **Recommended Resubmission Format**

```
crypto/snow3g: fix digest clear for in-place cipher ops

When performing combined hash-then-encrypt operations with
in-place buffers (m_dst == m_src), the digest was incorrectly
being cleared. Add a check to skip clearing when source and
destination buffers are the same.

Fixes: <12-char-sha> ("original commit that introduced bug")
Cc: stable at dpdk.org

Signed-off-by: Real Name <email at domain.com>
---
 drivers/crypto/ipsec_mb/pmd_snow3g.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c
index b3c3b05a8a..45a8be5fc8 100644
--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c
+++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c
@@ -157,7 +157,8 @@ process_snow3g_cipher_op(...)
 	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) {
```

---

### **Summary**

| Severity | Count |
|----------|-------|
| **Error** | 6 |
| **Warning** | 4 |

**Verdict**: This is a valid bug report but not a submittable patch. The author should use `git format-patch` to create a proper patch with correct commit message format, sign-off, and complete diff context.


More information about the dev mailing list