Fix CI failures on OTP 27+/28 caused by undersized test keys - #230
Merged
Conversation
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>
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.
Summary
test/hap/hap_session_transport_test.exsfailed 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.** (ErlangError) Erlang error: {:badarg, {"aead.c", 90}, "Unknown cipher or invalid key size"}from:crypto.crypto_one_time_aead(:chacha20_poly1305, ...).<<1>>,<<2>>) instead of the 32-byte keyschacha20_poly1305actually requires. OTP 26's:cryptoNIF tolerated the undersized key; OTP 27+ (linked against a newer OpenSSL) validates AEAD key length strictly and raisesbadarg.mainunder 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/6call used to independently verify the wire format in the second test.Test plan
mix test test/hap/hap_session_transport_test.exspasses locally (OTP 29, which also enforces strict key-size validation)mix testpasses in full (41 tests, 0 failures)🤖 Generated with Claude Code