Repository navigation
fix(hip): HOST_ID packs DI-Type/DI-Length as 4 octets where RFC 7401 has one 16-bit word - #1132
Merged
Merged
Conversation
Owner
Author
|
Cross-review verdict on
Merge order with #1128: the two PRs conflict in
|
Contributor
|
Coverage: 88.75% (unit tier, Python 3.14,
Per-file detail: the |
…has one 16-bit word RFC 7401 section 5.2.9 packs DI-Type (4 bits) and DI Length (12 bits) into one 16-bit word between HI Length and Algorithm, and the schema's namespace says so -- (0, 4) plus (4, 12). The BitField declared four octets for it, so a made HOST_ID carried two surplus zero octets (18 against len=8, which HIP then rejected as "invalid format"), and a conformant record was read two octets late, taking the ECDSA curve as Algorithm. The HOST_ID entry of EXPECTED_FAILURES goes with it -- the case now round-trips -- as does the generator's note recording it as one of two gaps a second copy could not help.
JarryShaw
force-pushed
the
fix/1118-hip-host-id-di
branch
from
October 6, 2026 20:42
7693f20 to
c254248
Compare
Owner
Author
|
Cross-review verdict on Delta review of the rebase after #1128.
Unverified prose detail: the note's |
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.
make pylint,make mypy,make isort) — ranisort/mypy; both already fail onschema/internet/hip.pyatorigin/main(measured), and this diff adds no importsmake testpasses, and a test case covers the change — rantests/protocols/internet/test_hip_host_id_di_width_unit.py,tests/protocols/test_option_roundtrip_unit.py,tests/protocols/internet/test_hip_unit.py, the two sibling HIP width modules, andtests/projectdocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrally after the waveWhat is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
Closes #1118.
RFC 7401 §5.2.9 packs
DI-Type(4 bits) andDI Length(12 bits) into one 16-bit word betweenHI LengthandAlgorithm; the schema's namespace said so, theBitField'slengthdid not.length=4→length=2.Probe, ECDSA/NIST P-256 with a 4-octet key — before / after:
Rebased onto
c24df4fbeafter #1128 landed. With #1128'sHIP_TRANSFORMfix and this one, no HIP case fails at either setting ofHIP_COPIES— measured 49 OK of 49 at one copy and at two — soEXPECTED_FAILURESloses its last HIP entry and the block goes with it; theHIP_COPIESnote records that instead of calling HOST_ID a gap.make_samples.pynow leaves out 3 cases, none of them HIP, andoptions-internet.pcapcarries both0x02c1(705) and0x0241(577).Fails without the fix — reverting
length=2→length=4turns all three new tests red:ProtocolError: HIPv2: invalid format,'02c1000e00061002000000070001aabbccdd6162…' != '02c1000e0006100200070001aabbccdd6162…', andHIAlgorithm.NULL_ENCRYPT != HIAlgorithm.ECDSA. With the fix:3 passed; roundtrip6 passed, 360 subtests;test_hip_unit.py34 passed, 168 subtests;tests/project385 passed, 1 skipped, 1289 subtests.