Repository navigation
Conversation
Owner
Author
|
Needs changes at
|
- SecurityAssociation takes esn, seq and window: extend() infers the high-order bits by RFC 4303 Appendix A2.2 from the highest authenticated sequence number, which advance() moves on every authentic packet (A2.1) - the ICV covers the high-order bits after the trailer (s3.3.2.1), and every AEAD's associated data leads with them - RFC 8750's implicit IV suites join CIPHER_SUITES, with CipherSuite.implicit_iv; the nonce takes the 64-bit sequence number - the ESP data model gains esn, and make() takes it as esn, so a construction and from_data process under it rather than inferring; make() refuses a seq that does not fit in 32 bits instead of wrapping it - tests: new test_esp_esn_2963_unit; the suite-set, gate and PyPy pins move
JarryShaw
force-pushed
the
feat/2963-esp-esn
branch
from
November 29, 2026 04:37
7af80df to
d718752
Compare
Owner
Author
|
Good to go at
|
Contributor
|
Coverage: 94.94% (unit tier, Python 3.15,
Per-file detail: the |
This branch has not been deployed
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 #2963.
Design. The issue names no preference, so this takes the mechanism RFC 4303 specifies: the receiver "must deduce and track" the high-order bits (§3.4.3, Appendix A2.2); a caller-supplied high word appears nowhere in it and breaks at the first wrap.
SecurityAssociation(esn=True, seq=T, window=W)holds Appendix A2'sTandW;extend()picksSeqhby A2.2 (mod 2**32, as A2.3 computes it) andadvance()movesT(A2.1) on every authentic packet. The high bits follow the trailer in the ICV (§3.3.2.1) and lead the AEAD associated data (RFC 4106 §5, RFC 4309 §5, RFC 4543 §3.3, RFC 7634 §2.1).RFC 8750's
ENCR_AES_CCM_8_IIV,ENCR_AES_GCM_16_IIVandENCR_CHACHA20_POLY1305_IIVjoinCIPHER_SUITESthroughCipherSuite.implicit_iv: no IV on the wire, the nonce is the salt and the 64-bit sequence number (Figures 1 and 2).ESP.info.esnrecords the number a packet was processed under, andmake(esn=)takes it, so a construction andfrom_datareuse it rather than inferring;seqstays the 32-bit field, so a keyless rebuild, as an outer layer's payload rebuild is, still writes the same octets. Appendix A3's re-synchronisation (a SHOULD whose trigger and retry limit are local) is left out and listed under Known Limitations; an SA joining a capture late is seeded throughseq.Tests.
test_esp_esn_2963_unit.py: both A2.2 cases at their edges, an HMAC ICV recomputed withhmacacross a 2**32 wrap in one extraction, every ESN packet of draft-mcgrew-gcm-test-01, and CCM, ChaCha20-Poly1305, GMAC, CMAC and implicit-IV packets recomputed withcryptographyfrom each RFC's layout. Every test fails on an untouchedorigin/developexport. Branch coverage ofesp/protocol.pyunder the ESP tests goes from 98.24% to 98.73%, andcorekit/context.pystays at 96.15%. Moved pins:test_esp_unit's suite set, #2958's refused list,test_tier_guard'sHAS_CRYPTOset andPYPY_EXCLUSIONS['cryptography'].Breaking. Building a
CipherSuiteneedsimplicit_iv=, and the ESP data model, soto_dict()and every dump, gainsesn.make()raisesProtocolErroron aseqthat does not fit in 32 bits where it wrote it modulo 2**32, andcompute_icv/decrypt/encryptraise it on aseqtoo wide for the SA, where they raisedOverflowErroror, underENCR_NULL, ignored it.