487 Commits

Author SHA1 Message Date
gr1ffon
4ba42a8456 replace repo 2025-11-14 04:04:40 +03:00
Marten Seemann
42b198b8d1 use default RTT (100ms) for 0-RTT if no prior estimate (#5388)
* utils: initialize the {Smoothed, Latest, Min}RTT to 100ms

* utils: use time.Duration.Nanoseconds instead of uint64

No functional change expected.

* congestion: better check to avoid division by zero
2025-10-16 09:32:46 +02:00
Marten Seemann
c2131eb595 qlog: split serializiation and event definitions, remove logging abstraction (#5356)
* qlog: implement a Trace and a Writer struct

* qlog: rename Trace to FileSeq

* split qlog trace writer and QUIC qlog events into separate packages

* use the new qlog.Recorder instead of the logging.ConnectionTracer
2025-10-08 05:53:02 +02:00
Marten Seemann
adc13be540 implement a memory-optimized time.Time replacement (#5334)
* implement a memory-optimized time.Time replacement

* monotime: properly handle systems with bad timer resolution (Windows)

* monotime: simplify Since
2025-09-14 08:12:10 +02:00
Marten Seemann
8c062ae604 use testing.B.Loop in all benchmark tests (#5285)
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=bloop -fix -test ./...
was used as a starting point.
2025-08-16 12:44:56 +02:00
Marten Seemann
92aa7b41d5 handshake: store key update interval in an atomic (#5234)
* handshake: store key update interval in an atomic

We recently changed the way the key update interval is set in tests to
use an environment variable. This resolved a race condition that existed
in the earlier logic, however, parsing of the environment variable now
shows up in benchmark tests.

Using an atomic variable should have a negligible performance impact.

* use an atomic swap
2025-06-21 12:14:07 +02:00
Ameame
8ef0a71581 store the RTT in the token, not in the session ticket (#5065)
* remove RTT from session ticket

* save RTT in token

* use mus as rtt unit in token

* move RTT from session state to token on client side

* Rename the rtt variables

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update internal/handshake/token_generator.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update token_generator.go

* Update connection.go

* Update token_generator.go

* correct slice  access in fuzz.go

* rearrange connection constructor parameters

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-05-16 12:25:58 +02:00
Marten Seemann
cfc6c16f36 fix race condition in tests when setting the key update interval (#5121)
* fix race conditions in tests when setting the key update interval

* remove test for running transports and handshakes
2025-05-06 04:45:27 +02:00
Marten Seemann
d35b5ac187 use ed25519 instead of RSA in tests and examples (#5050)
Also adds a golangci-lint depguard rules that forbids
importing crypto/rsa.
2025-04-20 05:55:08 +02:00
Marten Seemann
267cca773b switch from math/rand to math/rand/v2 (#5045)
* switch from math/rand to math/rand/v2

* switch away from golang.org/x/exp/rand
2025-04-19 09:01:22 +02:00
Marten Seemann
bf28da8346 handshake: use new crypto/tls 0-RTT API (#4953)
* handshake: simplify method signature of cryptoSetup.handleEvent

* use the new crypto/tls 0-RTT API
2025-02-14 03:17:01 +01:00
Marten Seemann
12f2be058b bump go.mod version to Go 1.23, run 1.23 and 1.24 on CI (#4880) 2025-02-13 12:49:54 +01:00
Julien Salleyron
c385cd10f1 handshake: lazily create the AEAD used for Retry (#4916)
* Change init to sync.Once to handle fips-only setup.

* review.

* use the mutex instead of the sync.Once

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-01-23 13:36:29 +01:00
Marten Seemann
5dbb46dcc1 utils: remove unused now parameter from RTTStats.UpdateRTT (#4780) 2024-12-22 14:50:31 +08:00
Marten Seemann
aed4d8df0c ci: disable the unparam linter for tests (#4738) 2024-12-01 12:27:32 +08:00
Marten Seemann
8754d28a6a handshake: migrate tests away from Ginkgo (#4667) 2024-10-11 21:44:30 -07:00
Marten Seemann
7a10ed602d utils: remove unused methods and constructor from RTTStats (#4672) 2024-09-12 00:55:57 -07:00
Marten Seemann
d067fe4156 bump Go version in go.mod, stop testing on Go 1.21 (#4633)
* bump Go version in go.mod, stop testing on Go 1.21

* ci: update golangci-lint to v1.60.1

* ignore Go 1.23 0-RTT events in exhaustive linter
2024-08-17 00:30:03 -07:00
Marten Seemann
f5ceb73171 handshake: generate CRYPTO_ERRORs for internal_error TLS alerts (#4601)
* handshake: generate CRYPTO_ERRORs for internal_error TLS alerts

* remove stray comment
2024-08-03 17:04:03 -07:00
Marten Seemann
87f2894af5 handshake: remove gomock tls.ClientSessionCache implementation (#4619) 2024-08-03 16:43:30 -07:00
Marten Seemann
82b275212c handshake: remove unneeded tokenProtector interface (#4585) 2024-07-19 21:45:20 -07:00
Marten Seemann
7825250d3f ci: use Go 1.23rc2 for unit and integration tests (#4571)
* ci: use Go 1.23rc1 for unit and integration tests

* handshake: avoid using linkname to access crypto/tls.cipherSuiteTLS13ByID

* ci: use use Go 1.23rc2
2024-07-18 10:20:54 -07:00
Marten Seemann
7379f1fd5e handshake: ignore unknown QUIC events from crypto/tls (#4577) 2024-06-28 06:24:50 -07:00
Marten Seemann
459a6f3df9 fix the server's 0-RTT rejection logic when using GetConfigForClient (#4550) 2024-06-03 03:42:58 -07:00
Marten Seemann
dea2eafd1d remove unused function parameter from qtls.SetupConfigForServer (#4549) 2024-06-03 00:12:12 -07:00
Marten Seemann
0d1e27d77c introduce Transport.ConnContext, use client's context on the connection (#4507)
* introduce Transport.ConnContext, use client's context on the connection

* panic if ConnContext returns nil
2024-05-26 21:30:19 -07:00
Marten Seemann
4f4da0423f ci: disable exhaustive linter for test files (#4499) 2024-05-06 21:36:22 -07:00
Marten Seemann
1514095afb wire: use quicvarint.Parse to when parsing transport parameters (#4482)
* wire: add a benchmark for parsing of transport parameters

* wire: use quicvarint.Parse to when parsing transport parameters
2024-05-05 04:26:51 -07:00
Marten Seemann
71f5ae5ecb handshake: optimize AEAD handling for long header sealers and openers (#4323) 2024-03-03 04:33:10 -08:00
Marten Seemann
f856163f1e handshake: embed the mask as an array into the aesHeaderProtector (#4324) 2024-03-03 04:32:32 -08:00
Marten Seemann
02e4506c3b handshake: add benchmarks for the Initial AEAD (#4320) 2024-02-08 23:56:46 -08:00
Marten Seemann
c22a3c8e6f handshake: validate HKDF-Expand-Label against crypto/tls implementation (#4311)
* handshake: validate HKDF-Expand-Label against crypto/tls implementation

* handshake: add a benchmark for HKDF-Expand-Label
2024-02-04 21:27:21 -08:00
Marten Seemann
fbaa941ea1 protocol: rename VersionNumber to Version (#4295) 2024-01-31 21:57:33 -08:00
putyWang
bda5b7e6dc handshake: fix documentation for updatableAEAD.SetWriteKey (#4256) 2024-01-22 19:30:50 -08:00
Marten Seemann
4407c60f04 handshake: unexport Set{Read,Write}Key methods on the cryptoSetup (#4254)
No functional change expected.
These methods were exported since they were passed to the old qtls API.
2024-01-19 20:44:09 -08:00
Marten Seemann
1083d1fb8f handshake: remove unneeded mutex in cryptoSetup (#4227) 2024-01-01 23:52:08 -08:00
Marten Seemann
d6e3f3229f qtls: remove unneeded type alias for the tls.QUICEncryptionLevel (#4220)
* qtls: remove unneeded type alias for the tls.QUICEncryptionLevel

* handshake: make cryptoSetup.WriteRecord private
2023-12-28 18:59:56 -08:00
Marten Seemann
22411e16d5 utils: switch to standard library min and max functions (#4218)
These functions were added in Go 1.21.
2023-12-27 21:19:13 -08:00
Marten Seemann
d795250479 drop support for Go 1.20, build on Go 1.22rc1 on CI (#4195)
* drop support for Go 1.20

* ci: udpate CircleCI to Go 1.21

* qtls: remove unnecessary type aliases

* ci: build using Go 1.22rc1
2023-12-27 20:31:58 -08:00
Marten Seemann
d234d62d52 qtls: only attempt 0-RTT resumption for 0-RTT enabled session tickets (#4183) 2023-12-09 06:17:47 -08:00
Marten Seemann
ef800d6f71 handshake: set MinVersion on the Config returned by GetConfigForClient (#4134) 2023-10-26 22:35:07 -07:00
Marten Seemann
d309060cde handshake: clone the tls.Config returned by GetConfigForClient (#4133)
We modify this tls.Config, so we should clone it first. Otherwise, this could
cause conflicts with how the application is using that config.
2023-10-26 22:22:20 -07:00
Marten Seemann
746290b78a never allow 0-RTT when using Dial, even if the session ticket allows it (#4125)
When resuming a TLS session using Dial (and not DialEarly), 0-RTT should
be disabled at the TLS layer, even if the session ticket allows for
0-RTT resumption.

This bug is not critical, since Dial doesn't return an EarlyConnection,
so the client wouldn't be able to actually send 0-RTT data in practice.
2023-10-25 08:20:23 -07:00
Marten Seemann
1affe38703 move MaxTokenAge configuration option to the Transport (#4084) 2023-09-16 05:10:20 -07:00
Marten Seemann
9b82196578 make the logging.Tracer and logging.ConnectionTracer a struct (#4082) 2023-09-16 04:58:51 -07:00
Marten Seemann
862e64c7b9 add a Transport config option for the key used to encrypt tokens (#4066)
* add a Transport config option for the key used to encrypt tokens

* handshake: remove unused error return values
2023-09-15 18:33:57 +07:00
Ameagari
d1f6ea997c save the RTT in non-0-RTT session tickets (#4042)
* also send session ticket when 0-RTT is disabled for go1.21

* allow session ticket without transport parameters

* do not include transport parameters for non-0RTT session ticket

* remove the test assertion because it is not supported for go1.20

* Update internal/handshake/session_ticket.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* add a 0-RTT argument to unmarshaling session tickets

* bump sessionTicketRevision to 4

* check if non-0-RTT session ticket has expected length

* change parameter order

* add test checks

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2023-09-11 08:05:31 -07:00
Marten Seemann
2797f85fc0 switch from unmaintained golang/mock to go.uber.org/mock (#4050) 2023-08-28 02:23:55 -07:00
Ameagari
6880f88089 save the max_datagram_frame_size transport parameter in the session ticket (#4013)
* Add MaxDatagramFrameSize parameter in session ticket

* fix gofumpt issues

* Update integrationtests/self/zero_rtt_test.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* fix: correct comparsion of max_datagram_frame_size

* test: use constant MaxDatagramFrameSize for session ticket test

* fix grammar

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2023-08-18 19:16:16 -07:00
Marten Seemann
501cc21c4b expose crypto/tls errors on the TransportError (#4015) 2023-08-18 03:01:49 -07:00