RustCrypto / RustCrypto/stream-ciphers

chacha20: improve tests for 64-bit counter variants

Open
#582 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
325
Forks
77
Avg merge
1h 47m
Merged PRs (30d)
4

Description

Replacing these lines with state[12] = _mm_cvtsi128_si32(self.v[3]) as u32; (i.e. writing only 32 counter bits) does not result in failed tests for the legacy cipher variants (RNG tests fail as expected). We probably should add tests to check cipher behavior in scenarios which overflow 32 bit counter.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the counter handling at lines 72–73 of chacha20/src/backends/sse2.rs and inspect the existing tests for the legacy cipher variants, including the RNG tests. Add coverage for cipher behavior when the counter overflows 32 bits. Done means the tests detect a 32-bit-only counter implementation while preserving the expected behavior of the 64-bit variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.