Skip to content

Feat: XTS-AES - #195

Closed
officialfrancismendoza wants to merge 18 commits into
bcgit:release/0.1.4alphafrom
officialfrancismendoza:feature/officialfrancismendoza/184-AES-XTS
Closed

officialfrancismendoza wants to merge 18 commits into
bcgit:release/0.1.4alphafrom
officialfrancismendoza:feature/officialfrancismendoza/184-AES-XTS

Conversation

@officialfrancismendoza

Copy link
Copy Markdown
Contributor

Implement XTS-AES (outlined as part of the official NIST SP 800-38E). Solves (#184).

@officialfrancismendoza officialfrancismendoza added the enhancement New feature or request label Nov 18, 2026
@officialfrancismendoza
officialfrancismendoza marked this pull request as draft November 18, 2026 23:27
@officialfrancismendoza

Copy link
Copy Markdown
Contributor Author

Resolve merge conflict to include both x25519 and xts packages

…ory tests only

Since the digest crate took in the vector suites, the step ran tests that
need bc-test-data, which the Build job does not check out, and the
concatenation KDF's ACVP suite failed on the missing data.

Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit 98f284a)
hex moved into core on release.

Assisted-by: Claude:claude-opus-5-5
The 41 vectors embedded in the test file are replaced by the ACVP-AES-XTS-1.0
and -2.0 sample sets in bc-test-data/crypto/acvp (ACVP-Server commit 975de31e).
Every single-data-unit case of whole bytes runs, in both directions: 260 from
1.0 and 72 from 2.0. The bit-length and multiple-data-unit cases are counted
and skipped, and the counts are asserted.

Assisted-by: Claude:claude-fable-5-2
@dghgit
dghgit self-requested a review November 22, 2026 21:33

@dghgit dghgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR report sent via teams.

…crypt-only guard has a doctest

first_mask built T = E_Key2(i) in a local Secret<Block> and returned it by
value, which moves the mask out of a copy nothing wipes when the function
is not inlined. encrypt and decrypt now declare the Secret and first_mask
fills it through &mut. The output is unchanged.

XTSKey::encrypt_inplace's const assertion on BlockPermutation::DECRYPT_ONLY
had no test. Its docs gain a compile_fail,E0080 doctest over a decrypt-only
wrapper of the toy permutation, and beside it the same key decrypting, so
that the failure is known to be the guard's.

Assisted-by: Claude:claude-fable-5-2
XTS_AES_128 was listed among the modes that the following sentence says
are used through a key such as AES256Key<GCM> handing out encryptors and
decryptors. XTS has its own key type and no workers; the sentence now
says so.

Assisted-by: Claude:claude-fable-5-2
…r points at the help

An all-zero --key drew the block cipher loader's warning that it was
proceeding and then XTS's refusal of equal halves, and a key with one
all-zero half was refused with AES's InvalidKeyType debug message. The
commands now load their key themselves, once, and refuse equal halves and
an all-zero half with a message that names the cause, before the key is
built; the halves are compared in constant time. The shared loader is
unchanged.

The module header repeated the subcommand help on data units and the
tweak; it now points there.

Assisted-by: Claude:claude-fable-5-2
…/officialfrancismendoza/184-AES-XTS

# Conflicts:
#	.gitea/workflows/rust-build.yml
#	.github/workflows/rust-build.yml
dghgit pushed a commit that referenced this pull request Nov 23, 2026
XTS (NIST SP 800-38E) over a 128-bit block permutation, as
bouncycastle_cipher::modes::XTSKey with the aliases XTS_AES_128 and
XTS_AES_256: one data unit of 16 bytes to 2^20 blocks per call, in
place, with ciphertext stealing, and a key whose halves must differ.
The aes128-xts and aes256-xts CLI commands, benches and the stack
harness. Tested against NIST's ACVP and CAVP vector sets.

Reviewed before the merge; its six findings are fixed on the branch:
the first mask is filled in the caller's Secret, the decrypt-only guard
has a compile_fail doctest, the CLI names the keys XTS refuses, and two
doc corrections. Open: the IEEE Std 1619-2007 citations were not
checked against the standard, and no mutation run was made on the
final code.

Verified: workspace suite 4133 passed, 0 failed, 14 ignored before the
last release merge; after it the cipher, aes and cli suites pass (790)
and the workspace builds.

Assisted-by: Claude:claude-fable-5-2
@dghgit

dghgit commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Merged

@dghgit dghgit closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants