Skip to content

Fix CI failures on OTP 27+/28 caused by undersized test keys - #230

Merged
mtrudel merged 1 commit into
mainfrom
fix/chacha20-test-key-size
Jul 27, 2026
Merged

Fix CI failures on OTP 27+/28 caused by undersized test keys#230
mtrudel merged 1 commit into
mainfrom
fix/chacha20-test-key-size

Conversation

@mtrudel

@mtrudel mtrudel commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • test/hap/hap_session_transport_test.exs failed on every OTP 27.x/28.x CI job (all Elixir versions), while every OTP 26.x job passed — see run https://github.com/mtrudel/hap/actions/runs/30280957121.
  • Failure: ** (ErlangError) Erlang error: {:badarg, {"aead.c", 90}, "Unknown cipher or invalid key size"} from :crypto.crypto_one_time_aead(:chacha20_poly1305, ...).
  • Root cause: the tests used 1-byte stand-in keys (<<1>>, <<2>>) instead of the 32-byte keys chacha20_poly1305 actually requires. OTP 26's :crypto NIF tolerated the undersized key; OTP 27+ (linked against a newer OpenSSL) validates AEAD key length strictly and raises badarg.
  • This is unrelated to any recent app changes — it's a pre-existing latent test bug that would fail identically on main under OTP 27/28.

Fix

Replace the 1-byte keys with 32-byte keys (:binary.copy(<<1>>, 32) / :binary.copy(<<2>>, 32)), including in the raw :crypto.crypto_one_time_aead/6 call used to independently verify the wire format in the second test.

Test plan

  • mix test test/hap/hap_session_transport_test.exs passes locally (OTP 29, which also enforces strict key-size validation)
  • mix test passes in full (41 tests, 0 failures)

🤖 Generated with Claude Code

chacha20_poly1305 requires 256-bit keys, but the tests were passing
1-byte stand-ins (<<1>>, <<2>>). OTP 26's :crypto NIF tolerated the
undersized key; OTP 27+ validates AEAD key length strictly and raises
{:badarg, {"aead.c", 90}, "Unknown cipher or invalid key size"},
failing these tests on every OTP 27.x/28.x CI job.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mtrudel
mtrudel merged commit 3110913 into main Jul 27, 2026
18 of 19 checks passed
@mtrudel
mtrudel deleted the fix/chacha20-test-key-size branch July 27, 2026 16:44
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