Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 0/8] crypto: amcc - fixes for the crypto4xx driver
@ 2026-11-27  4:04 Rosen Penev
  2026-11-27  4:04 ` [PATCH 1/8] crypto: amcc - fix scatter ring full check Rosen Penev
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Rosen Penev @ 2026-11-27  4:04 UTC (permalink / raw)
  To: linux-crypto
  Cc: Herbert Xu, David S. Miller, James Hsiao, Rosen Penev,
	Christian Lamparter

These fix bugs in the AMCC PPC4xx crypto driver (crypto4xx), found while
working on the driver on an APM82181-based Meraki MX60.

Patch 1 fixes a typo in the scatter ring full check. With it, batched
requests could overrun the scatter ring and leave the engine parked on a
descriptor with no further interrupts.

Patch 2 adds the missing DMA barriers when building and completing packet
descriptors. It also clears the stale PE_DONE bit of a reused descriptor,
so the completion handler cannot take a half-built descriptor for a
finished one.

Patches 3 and 4 make probe allocate all algorithm wrappers and set up the
TRNG before registering any algorithm. A registered algorithm's
self-tests can start on the engine right away, so probe cannot safely
unregister it again when a later step fails.

Patch 5 stops using memcpy() on the cache-inhibited SA and state record
pools, where its dcbz takes an alignment exception. Removing those traps
also made batched requests up to 3.8 times faster on the MX60.

Patch 6 fixes the DMA mappings: the source was never unmapped, the
destination was mapped and unmapped with different directions, and
neither mapping was checked.

Patch 7 fixes the inverted AEAD error ratelimit, and patch 8 wipes the SA
key material when it is freed.

Patches 1 to 6 were tested on the MX60 with the driver backported to an
OpenWrt 6.18.64 kernel, together with the first seven patches of the
follow-up modernization series. The full crypto self-tests pass for all
six algorithms. A test module comparing the engine against the software
implementations, with random lengths, scatterlist splits and in-place
requests, ran about 4 million requests without a mismatch and exercised
the backlog and ring-full paths. With CONFIG_DMA_API_DEBUG there were no
DMA API errors and no leaked mappings. Patches 7 and 8 were only
compile-tested.

An AI coding assistant (Claude Code, Claude Opus 5.5) was used to find
the bugs, write the fixes and the test module, run the tests on the MX60,
and draft the commit messages and this cover letter.

Rosen Penev (8):
  crypto: amcc - fix scatter ring full check
  crypto: amcc - fix missing DMA memory barriers in descriptor handling
  crypto: amcc - allocate all algorithm wrappers before registering
  crypto: amcc - set up the TRNG before registering the algorithms
  crypto: amcc - don't use memcpy() on the coherent SA and state record
  crypto: amcc - fix the DMA mappings of the source and destination
  crypto: amcc - fix the inverted AEAD error ratelimit
  crypto: amcc - wipe the SA key material when freeing it

 drivers/crypto/amcc/crypto4xx_core.c | 237 +++++++++++++++++----------
 drivers/crypto/amcc/crypto4xx_core.h |  24 ++-
 2 files changed, 175 insertions(+), 86 deletions(-)


base-commit: 04cd6899aaaeeab82afb97e58eb8619fde35b47d
-- 
2.56.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-27  4:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  4:04 [PATCH 0/8] crypto: amcc - fixes for the crypto4xx driver Rosen Penev
2026-11-27  4:04 ` [PATCH 1/8] crypto: amcc - fix scatter ring full check Rosen Penev
2026-11-27  4:04 ` [PATCH 2/8] crypto: amcc - fix missing DMA memory barriers in descriptor handling Rosen Penev
2026-11-27  4:04 ` [PATCH 3/8] crypto: amcc - allocate all algorithm wrappers before registering Rosen Penev
2026-11-27  4:04 ` [PATCH 4/8] crypto: amcc - set up the TRNG before registering the algorithms Rosen Penev
2026-11-27  4:04 ` [PATCH 5/8] crypto: amcc - don't use memcpy() on the coherent SA and state record Rosen Penev
2026-11-27  4:04 ` [PATCH 6/8] crypto: amcc - fix the DMA mappings of the source and destination Rosen Penev
2026-11-27  4:04 ` [PATCH 7/8] crypto: amcc - fix the inverted AEAD error ratelimit Rosen Penev
2026-11-27  4:04 ` [PATCH 8/8] crypto: amcc - wipe the SA key material when freeing it Rosen Penev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox