fix(kerykeion): surface AES init failures during trial decryption - #459
Merged
Conversation
The loop skipped a channel on any `apply_aes_ctr` error without saying so. That was defensible while a bad-length key could reach it: init failure was then a routine outcome of guessing wrong, indistinguishable from a wrong-key decode. Since #436 it cannot be routine. `resolve_psk` yields `Key` only at 16 or 32 bytes, and `apply_aes_ctr` rejects every other length before touching the cipher -- so a failure here is a fault in the AES implementation or the machine under it, not a wrong guess about which channel a packet belongs to. It now warns with the error and the channel index. Still `continue` rather than `fail`: a later channel may decrypt, and refusing the whole packet over one channel's fault would turn a local problem into dropped traffic. What changes is that it can no longer happen quietly. Deliberately untested, and worth saying why rather than adding a test that passes for the wrong reason: with the length guarantee above, no input this crate accepts can reach the arm. A test would have to construct a key that `resolve_psk` cannot produce, which proves something about the test rather than about the code. The arm's value is precisely that it is loud if the impossible happens. Refs #229
This was referenced Aug 21, 2026
forkwright
pushed a commit
that referenced
this pull request
Aug 21, 2026
🤖 I have created a release *beep* *boop* --- ## [0.6.1](v0.6.0...v0.6.1) (2026-08-21) ### Bug Fixes * **kerykeion:** surface AES init failures during trial decryption ([#459](#459)) ([6a0e514](6a0e514)) * **kryphos:** stop the audit log recording credential names in cleartext ([#457](#457)) ([84055c0](84055c0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trial decryption iterated candidate keys and silently
continued when AESinitialisation itself failed. An init failure is not a wrong-key signal — it
means the cipher could not be constructed at all — but the loop treated the two
identically, so a misconfigured cipher was indistinguishable from an
exhausted keyspace and reported the same "no key matched" outcome.
The failure is now logged with the key reference before the loop moves on, so
a construction fault is visible instead of being folded into a negative result.
This does not complete issue 229 — see Scope below.
Verification
utilities/pre-push-verify.shagainst the branch tip:FMT_EXIT=0 CLIPPY_EXIT=0 TEST_EXIT=0— 778 tests, 0 failed.Scope
This addresses only the silent-
continuereporting defect. The broaderquestion on #229 — that trial decryption attributes by decrypt-success alone,
with no authenticated channel binding — is separate, remains open on the
issue, and is not touched here.