Skip to content

fix(kerykeion): surface AES init failures during trial decryption - #459

Merged
forkwright merged 1 commit into
mainfrom
fix/229-aes-init-errors
Aug 21, 2026
Merged

fix(kerykeion): surface AES init failures during trial decryption#459
forkwright merged 1 commit into
mainfrom
fix/229-aes-init-errors

Conversation

@forkwright

@forkwright forkwright commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Trial decryption iterated candidate keys and silently continued when AES
initialisation 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.sh against the branch tip:
FMT_EXIT=0 CLIPPY_EXIT=0 TEST_EXIT=0 — 778 tests, 0 failed.

Scope

This addresses only the silent-continue reporting defect. The broader
question 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.

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
@forkwright
forkwright merged commit 6a0e514 into main Aug 21, 2026
11 checks passed
@forkwright
forkwright deleted the fix/229-aes-init-errors branch August 21, 2026 15:53
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant