Repository navigation
feat(internet): verify HIP's RVS_HMAC and RELAY_HMAC parameters (#3187) - #3193
Merged
Merged
Conversation
Owner
Author
|
Needs changes at
Confirmed and unchanged: the HMAC scope and key direction against the RFC text, |
- HIPRegistration holds a requester's registration with its rendezvous server or relay (RFC 8003): the association, the registrar's HIT and the Registration Types granted. HIPContext registers it, and match_registrations() returns every one a packet may flow through. - REGISTRATION_HMAC maps RVS_HMAC to RENDEZVOUS (RFC 8004 section 4.2.1) and RELAY_HMAC to RELAY_UDP_HIP and RELAY_UDP_ESP (RFC 9028 section 5.8). - _verify_hip_mac() verifies both over _auth_scope(), keyed by the sending side, trying each matching registration: VALID if any verifies, INVALID if none does, NO_KEY if none matches. Parsing is unchanged.
JarryShaw
force-pushed
the
feat/3187-hip-rvs-relay-hmac
branch
from
November 28, 2026 15:13
1f6f83e to
f73c547
Compare
Owner
Author
|
Good to go at
The old name |
Contributor
|
Coverage: 94.81% (unit tier, Python 3.15,
Per-file detail: the |
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.
Please follow the guide below
Put an
xinto every box [ ] that applies to your pull request (like this: [x])Use the Preview tab to see how your pull request will look
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeDescribed the user-visible change below and left its changelog entry to the maintainer, keeping
docs/source/changelog/andCHANGELOG.mdout of the diff, if the change is user-visible: N/A — centralisedWhat is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseAlso tick if it regenerates constant or registry tables, members keeping their numeric values (the
constlabel)Description of your pull request and other information
Closes #3187.
HIPRegistration(association, *, registrar, reg_type): a requester's registration (RFC 8003) with its rendezvous server or relay, registered inHIPContextbeside identities and associations.HIPContext.match_registrations()returns every one a packet may flow through;REGISTRATION_HMACmapsRVS_HMACtoRENDEZVOUS(RFC 8004 §4.2.1) andRELAY_HMACtoRELAY_UDP_HIP/RELAY_UDP_ESP(RFC 9028 §5.8, §4.1, §4.12.2)._verify_hip_mac()now takes both: same_auth_scope()(header and every parameter before the HMAC, Checksum zeroed, Header Length recounted), keyed by the sending side, so a packet the server relays to its client (third-party Sender's HIT) is under the server's HIP-gl/HIP-lg and one the client sends under its own. A packet's HITs need not identify its registration (one registrar serving both hosts, one requester with several registrars), so each match is tried:VALIDif any verifies,INVALIDif none,NO_KEYif none matches. Recordshmac_status; parsing and rebuilds are unchanged. HIPv1 (RFC 5770's base) reportsUNSUPPORTED, as feat(internet): verify HIP's HMAC and signature parameters #2939 does.HIPContext.__repr__gainsregistrations=N;test_hip_auth_2939_unitupdated for it.test_hip_registration_hmac_3187_unit(19 tests): relayed I1 with FROM + RVS_HMAC, relayed I1/I2 with RELAY_FROM + RELAY_HMAC, client↔server packets, and ambiguous registrations in both context orders, each against HMACs computed withhmac, plus tamper cases (FROM / RELAY_FROM / Sender's HIT, the other side's key, on-wire Header Length, non-zero Checksum) that must reportINVALID. All fail on an untouchedorigin/developexport. Key-direction mutations (swapped sides, key by role instead of by greater HIT, swapped HITs, first match only) each fail the suite.make_samples.py,-n 2):tests/project2428 passed;tests/protocols/test_*.py741; the HIP modules 213. HIPprotocol.pycoverage over the HIP tests 99.39% → 99.47%; no pins moved.