|WARNING| crypto/armv8: validate xform auth key length

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Mon Nov 2 13:25:53 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/171175

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-02

# DPDK Patch Review

## Errors

**1. NULL pointer dereference**

The patch checks `xform->auth.key.data == NULL` but there is no guard against `xform` itself being NULL. If `xform` is NULL, this will dereference a NULL pointer before the check can execute.

Looking at the function signature context (line 262), `auth_set_prerequisites` receives `xform` as a parameter. The patch should verify `xform != NULL` before accessing `xform->auth.key.data`.

**Suggested fix:**
```c
/* Validate xform and key */
if (xform == NULL || xform->auth.key.data == NULL ||
		xform->auth.key.length > SHA_BLOCK_MAX) {
	ARMV8_CRYPTO_LOG_ERR("Invalid authentication key provided.");
	return -1;
}
```

**Note:** This assumes `xform` can be NULL based on defensive programming practice. If the caller guarantees `xform != NULL`, this may not be necessary, but without seeing the caller code in the patch, the safer approach is to check.

## Warnings

**1. Inconsistent error return value**

The function returns `-1` on error. DPDK coding standards prefer returning standard negative errno values (`-EINVAL`, `-ENOMEM`, etc.) rather than `-1`.

**Suggested fix:**
```c
if (xform->auth.key.data == NULL ||
		xform->auth.key.length > SHA_BLOCK_MAX) {
	ARMV8_CRYPTO_LOG_ERR("Invalid authentication key provided.");
	return -EINVAL;
}
```

**2. Error message could be more specific**

The error message "Invalid authentication key provided" does not distinguish between NULL key data and oversized key length, making debugging harder for users.

**Suggested fix:**
```c
if (xform->auth.key.data == NULL) {
	ARMV8_CRYPTO_LOG_ERR("Authentication key data is NULL.");
	return -EINVAL;
}

if (xform->auth.key.length > SHA_BLOCK_MAX) {
	ARMV8_CRYPTO_LOG_ERR("Authentication key length (%u) exceeds maximum (%u).",
		xform->auth.key.length, SHA_BLOCK_MAX);
	return -EINVAL;
}
```

## Info

**Missing release notes update**

This patch changes the behavior of the `armv8` crypto PMD by adding validation that was previously absent. While the commit message explains this is aligning with other PMDs and preventing buffer overflows, users should be notified of this behavior change in the release notes.

The release notes file for the current release should document:
- That the armv8 crypto PMD now validates authentication key lengths
- That operations with oversized keys will now fail at configuration time rather than causing undefined behavior

Review-Result: ERROR


More information about the test-report mailing list