Page MenuHomePhabricator

crypto: refactor ChaCha20 classes to use Span<std::byte> interface
ClosedPublic

Authored by PiRK on Dec 3 2025, 14:13.

Event Timeline

PiRK requested review of this revision.Dec 3 2025, 14:13
Fabien requested changes to this revision.Dec 4 2025, 08:31
Fabien added a subscriber: Fabien.

More a question than requesting change

src/crypto/chacha20.cpp
47

see related question in the header

src/crypto/chacha20.h
100

Here and below

101

I wonder if the size be enforced at compile time like so

src/crypto/chacha20poly1305.cpp
20

same here

This revision now requires changes to proceed.Dec 4 2025, 08:31
PiRK requested review of this revision.Dec 4 2025, 10:05

We can probably do that after we switch from Span to std::span. The Span template does not have the Extent parameter

add a TODO comment regarding compile time enforcement of KEYLEN

add another comment about the same in SetKey

Fabien requested changes to this revision.Dec 4 2025, 11:47
Fabien added inline comments.
src/crypto/chacha20.cpp
48 ↗(On Diff #56855)

This comment should be before the assert

src/crypto/chacha20.h
100 ↗(On Diff #56855)
106 ↗(On Diff #56855)
This revision now requires changes to proceed.Dec 4 2025, 11:47

fix 3 comments as suggested

This revision is now accepted and ready to land.Dec 4 2025, 14:18