Repository navigation
Proposal: Add EAP-NOOB KDF and Key Export Regression Tests #176
Ratherrayees
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Proposal: Add EAP-NOOB KDF and Key Export Regression Tests
Background
During targeted mutation testing of
services/eap-noob, I found several mutations that changed key derivation or export behavior without causing the existing test suite to fail.I investigated these cases and prepared a test-only addition to improve regression coverage. The proposed tests cover deterministic expected outputs, published HKDF test vectors, non-empty export context, and label-length encoding.
This was targeted mutation testing of
services/eap-noob, not a repository-wide mutation-testing run. The purpose of this discussion is to ask whether the maintainers would welcome a focused test-only PR and to confirm the protocol interpretation behind the expected values before I submit it.Findings and evidence
I reproduced five surviving mutations in a disposable clone based on commit
85f523d3624cf1596bdda6e36c28eb8ad3969737. In each case, the fullservices/eap-noobtest suite passed with the mutation applied.KDF output loop condition: Changing
len(out) < outLento its logical opposite caused the derivation loop to be skipped, leaving zero-filled output instead of the expected key material.KDF counter: Changing
counter++tocounter--altered the derived key material.Export block counter: Changing
i++toi--broke exports longer than one SHA-256 block, while a 32-byte output did not expose the problem.Export salt condition: Changing
if salt == niltoif salt != nilchanged behavior for non-nil salt inputs. The productionExportpath uses a nil salt, so this mutation is not evidence of a failure on that path alone.KDF output loop boundary: Changing
len(out) < outLentolen(out) <= outLendid not change the returned output in the tested path because the extra derived bytes were truncated. I do not consider this a confirmed defect.These results indicate that the existing tests did not detect several meaningful changes to KDF and export behavior. They also show why surviving mutations need individual investigation rather than automatically being treated as defects.
Proposed regression coverage
The local test-only addition in
services/eap-noob/kdf_test.gocovers the following:One-step KDF golden test: Checks the complete 320-byte output against an expected value, covering the derived material rather than checking only determinism or output length.
HKDF known-answer tests: Checks the package's HKDF helper against the published SHA-256 test cases in RFC 5869 Appendix A. The test asserts the expected output keying material (OKM). A full-length OKM match checks the complete output of the helper, although it does not separately assert the intermediate pseudorandom key (PRK).
Export golden test with context: Checks a 100-byte export using a non-empty context. This exercises output spanning multiple SHA-256 blocks and verifies that context affects the expected result.
Long-label export test: Checks a 64-byte export with a 256-byte label. This exercises the high byte of the two-byte label-length encoding, which a short-label-only test would not cover.
The two export cases use fixed expected values:
app, context bytesaa bb, output length 100, and a 32-byteKzconsisting of0x42repeated 32 times.arepeated 256 times, nil context, and output length 64.The expected outputs were cross-checked through independent calculation paths using Go, Python HMAC, and the OpenSSL command-line tool. The supplied refinement report also records an additional oracle check with 14 of 14 expected-value comparisons matching. These are cross-checks of the calculations, not a substitute for an independently published EAP-NOOB known-answer vector.
The new tests also detected two additional mutation probes: removing the context from the export input and zeroing the high byte of the label-length encoding.
Protocol interpretation that needs confirmation
There is one point I would like to confirm before treating the EAP-NOOB KDF golden output as definitive.
My reading of RFC 9140, Section 3.5, together with NIST SP 800-56A Revision 3, Section 5.8.2.1.1, is that the FixedInfo input includes the one-byte length of SuppPrivInfo before the SuppPrivInfo data.
For the inputs used here, that gives:
"EAP-NOOB" || Np || Ns || 0x10 || NoobHere,
NpandNsare each 32 bytes,Noobis 16 bytes, and0x10encodes the 16-byte length.The implementation in
services/eap-noob/kdf.gofollows this interpretation. However, the reference C and Python implementations I examined appear to omit the length byte. I did not find a published full EAP-NOOB KDF known-answer vector that resolves this discrepancy.I therefore do not want to present the calculated golden value as independently established proof of protocol conformance. The calculation has been cross-checked, but the interpretation itself needs maintainer or protocol-expert confirmation. If the reference implementations reflect the intended behavior, the expected value or implementation may need further investigation before a regression test is merged.
Relevant references:
Verification performed
The supplied test report records the following checks:
services/eap-noobmodule test suite passed.go vetpassed for the targeted module.gofmtwas applied and checked.There were also two checks with unrelated repository-level limitations:
make test-servicesfailed atTestBrokerProxySetPortRebindsinservices/tests/broker_supervision_test.go:554. The supplied report says the failure was reproduced without the new test file, so it appears unrelated to this proposed change.desktop/tools/inference-dispatcher.These results are from the supplied local reports. They are not a claim that every repository test or every repository-wide check passes.
Questions for maintainers
Scope
The proposed change is limited to tests. It does not modify production behavior.
I would appreciate confirmation of the protocol interpretation and whether this test-only contribution fits the project's direction before opening a PR. If the interpretation needs adjustment, I would rather resolve that first than add golden values that accidentally lock in incorrect behavior.
All reactions