Skip to content

Allow Configuration of Stateless Retry Key #5112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

anrossi
Copy link
Contributor

@anrossi anrossi commented May 21, 2025

Description

Add a new Global SetParam to set the Stateless Retry key, algorithm, and key rotation interval.
Fixes #5005.

Testing

New tests added covering the invalid parameter cases.

Documentation

Settings.md was updated to describe the new parameter.

@anrossi anrossi requested a review from a team as a code owner May 21, 2025 05:50
@anrossi anrossi added Area: API Area: Core Related to the shared, core protocol logic labels May 21, 2025
Copy link

Cargo - windows-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/win_bindings.rs b/src/rs/ffi/win_bindings.rs
index 5b5a00e..ff0bfe3 100644
--- a/src/rs/ffi/win_bindings.rs
+++ b/src/rs/ffi/win_bindings.rs
@@ -168,6 +168,7 @@ pub const QUIC_PARAM_GLOBAL_LIBRARY_GIT_HASH: u32 = 16777224;
 pub const QUIC_PARAM_GLOBAL_EXECUTION_CONFIG: u32 = 16777225;
 pub const QUIC_PARAM_GLOBAL_TLS_PROVIDER: u32 = 16777226;
 pub const QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY: u32 = 16777227;
+pub const QUIC_PARAM_GLOBAL_STATELESS_RETRY_CONFIG: u32 = 16777228;
 pub const QUIC_PARAM_CONFIGURATION_SETTINGS: u32 = 50331648;
 pub const QUIC_PARAM_CONFIGURATION_TICKET_KEYS: u32 = 50331649;
 pub const QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS: u32 = 50331650;
@@ -4848,6 +4849,34 @@ const _: () = {
     ["Offset of field: QUIC_STREAM_STATISTICS::StreamBlockedByAppUs"]
         [::std::mem::offset_of!(QUIC_STREAM_STATISTICS, StreamBlockedByAppUs) - 56usize];
 };
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_128_GCM: QUIC_AEAD_ALGORITHM_TYPE = 0;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_256_GCM: QUIC_AEAD_ALGORITHM_TYPE = 1;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_CHACHA20_POLY1305: QUIC_AEAD_ALGORITHM_TYPE =
+    2;
+pub type QUIC_AEAD_ALGORITHM_TYPE = ::std::os::raw::c_int;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct QUIC_STATELESS_RETRY_CONFIG {
+    pub Algorithm: QUIC_AEAD_ALGORITHM_TYPE,
+    pub RotationMs: u32,
+    pub SecretLength: u32,
+    pub Secret: [u8; 1usize],
+}
+#[allow(clippy::unnecessary_operation, clippy::identity_op)]
+const _: () = {
+    ["Size of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::size_of::<QUIC_STATELESS_RETRY_CONFIG>() - 16usize];
+    ["Alignment of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::align_of::<QUIC_STATELESS_RETRY_CONFIG>() - 4usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Algorithm"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Algorithm) - 0usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::RotationMs"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, RotationMs) - 4usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::SecretLength"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, SecretLength) - 8usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Secret"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Secret) - 12usize];
+};
 pub type QUIC_SET_CONTEXT_FN = ::std::option::Option<
     unsafe extern "C" fn(Handle: HQUIC, Context: *mut ::std::os::raw::c_void),
 >;

Copy link

Cargo - windows-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/win_bindings.rs b/src/rs/ffi/win_bindings.rs
index 5b5a00e..ff0bfe3 100644
--- a/src/rs/ffi/win_bindings.rs
+++ b/src/rs/ffi/win_bindings.rs
@@ -168,6 +168,7 @@ pub const QUIC_PARAM_GLOBAL_LIBRARY_GIT_HASH: u32 = 16777224;
 pub const QUIC_PARAM_GLOBAL_EXECUTION_CONFIG: u32 = 16777225;
 pub const QUIC_PARAM_GLOBAL_TLS_PROVIDER: u32 = 16777226;
 pub const QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY: u32 = 16777227;
+pub const QUIC_PARAM_GLOBAL_STATELESS_RETRY_CONFIG: u32 = 16777228;
 pub const QUIC_PARAM_CONFIGURATION_SETTINGS: u32 = 50331648;
 pub const QUIC_PARAM_CONFIGURATION_TICKET_KEYS: u32 = 50331649;
 pub const QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS: u32 = 50331650;
@@ -4848,6 +4849,34 @@ const _: () = {
     ["Offset of field: QUIC_STREAM_STATISTICS::StreamBlockedByAppUs"]
         [::std::mem::offset_of!(QUIC_STREAM_STATISTICS, StreamBlockedByAppUs) - 56usize];
 };
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_128_GCM: QUIC_AEAD_ALGORITHM_TYPE = 0;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_256_GCM: QUIC_AEAD_ALGORITHM_TYPE = 1;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_CHACHA20_POLY1305: QUIC_AEAD_ALGORITHM_TYPE =
+    2;
+pub type QUIC_AEAD_ALGORITHM_TYPE = ::std::os::raw::c_int;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct QUIC_STATELESS_RETRY_CONFIG {
+    pub Algorithm: QUIC_AEAD_ALGORITHM_TYPE,
+    pub RotationMs: u32,
+    pub SecretLength: u32,
+    pub Secret: [u8; 1usize],
+}
+#[allow(clippy::unnecessary_operation, clippy::identity_op)]
+const _: () = {
+    ["Size of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::size_of::<QUIC_STATELESS_RETRY_CONFIG>() - 16usize];
+    ["Alignment of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::align_of::<QUIC_STATELESS_RETRY_CONFIG>() - 4usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Algorithm"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Algorithm) - 0usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::RotationMs"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, RotationMs) - 4usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::SecretLength"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, SecretLength) - 8usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Secret"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Secret) - 12usize];
+};
 pub type QUIC_SET_CONTEXT_FN = ::std::option::Option<
     unsafe extern "C" fn(Handle: HQUIC, Context: *mut ::std::os::raw::c_void),
 >;

Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 96.15385% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.82%. Comparing base (31d2b73) to head (c1069ab).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/core/library.c 96.73% 3 Missing ⚠️
src/core/partition.c 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5112      +/-   ##
==========================================
- Coverage   87.19%   86.82%   -0.37%     
==========================================
  Files          59       59              
  Lines       18086    18183      +97     
==========================================
+ Hits        15770    15788      +18     
- Misses       2316     2395      +79     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Cargo - windows-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/win_bindings.rs b/src/rs/ffi/win_bindings.rs
index 998d8cf..18cab7e 100644
--- a/src/rs/ffi/win_bindings.rs
+++ b/src/rs/ffi/win_bindings.rs
@@ -4861,14 +4861,14 @@ pub struct QUIC_STATELESS_RETRY_CONFIG {
     pub Algorithm: QUIC_AEAD_ALGORITHM_TYPE,
     pub RotationMs: u32,
     pub SecretLength: u32,
-    pub Secret: [u8; 1usize],
+    pub Secret: *const u8,
 }
 #[allow(clippy::unnecessary_operation, clippy::identity_op)]
 const _: () = {
     ["Size of QUIC_STATELESS_RETRY_CONFIG"]
-        [::std::mem::size_of::<QUIC_STATELESS_RETRY_CONFIG>() - 16usize];
+        [::std::mem::size_of::<QUIC_STATELESS_RETRY_CONFIG>() - 24usize];
     ["Alignment of QUIC_STATELESS_RETRY_CONFIG"]
-        [::std::mem::align_of::<QUIC_STATELESS_RETRY_CONFIG>() - 4usize];
+        [::std::mem::align_of::<QUIC_STATELESS_RETRY_CONFIG>() - 8usize];
     ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Algorithm"]
         [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Algorithm) - 0usize];
     ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::RotationMs"]
@@ -4876,7 +4876,7 @@ const _: () = {
     ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::SecretLength"]
         [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, SecretLength) - 8usize];
     ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Secret"]
-        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Secret) - 12usize];
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Secret) - 16usize];
 };
 pub type QUIC_SET_CONTEXT_FN = ::std::option::Option<
     unsafe extern "C" fn(Handle: HQUIC, Context: *mut ::std::os::raw::c_void),

Copy link

Cargo - ubuntu-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/linux_bindings.rs b/src/rs/ffi/linux_bindings.rs
index cf4039b..01b44d4 100644
--- a/src/rs/ffi/linux_bindings.rs
+++ b/src/rs/ffi/linux_bindings.rs
@@ -175,6 +175,7 @@ pub const QUIC_PARAM_GLOBAL_EXECUTION_CONFIG: u32 = 16777225;
 pub const QUIC_PARAM_GLOBAL_TLS_PROVIDER: u32 = 16777226;
 pub const QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY: u32 = 16777227;
 pub const QUIC_PARAM_GLOBAL_STATISTICS_V2_SIZES: u32 = 16777228;
+pub const QUIC_PARAM_GLOBAL_STATELESS_RETRY_CONFIG: u32 = 16777229;
 pub const QUIC_PARAM_CONFIGURATION_SETTINGS: u32 = 50331648;
 pub const QUIC_PARAM_CONFIGURATION_TICKET_KEYS: u32 = 50331649;
 pub const QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS: u32 = 50331650;
@@ -4884,6 +4885,34 @@ const _: () = {
     ["Offset of field: QUIC_STREAM_STATISTICS::StreamBlockedByAppUs"]
         [::std::mem::offset_of!(QUIC_STREAM_STATISTICS, StreamBlockedByAppUs) - 56usize];
 };
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_128_GCM: QUIC_AEAD_ALGORITHM_TYPE = 0;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_256_GCM: QUIC_AEAD_ALGORITHM_TYPE = 1;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_CHACHA20_POLY1305: QUIC_AEAD_ALGORITHM_TYPE =
+    2;
+pub type QUIC_AEAD_ALGORITHM_TYPE = ::std::os::raw::c_uint;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct QUIC_STATELESS_RETRY_CONFIG {
+    pub Algorithm: QUIC_AEAD_ALGORITHM_TYPE,
+    pub RotationMs: u32,
+    pub SecretLength: u32,
+    pub Secret: *const u8,
+}
+#[allow(clippy::unnecessary_operation, clippy::identity_op)]
+const _: () = {
+    ["Size of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::size_of::<QUIC_STATELESS_RETRY_CONFIG>() - 24usize];
+    ["Alignment of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::align_of::<QUIC_STATELESS_RETRY_CONFIG>() - 8usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Algorithm"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Algorithm) - 0usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::RotationMs"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, RotationMs) - 4usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::SecretLength"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, SecretLength) - 8usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Secret"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Secret) - 16usize];
+};
 pub type QUIC_SET_CONTEXT_FN = ::std::option::Option<
     unsafe extern "C" fn(Handle: HQUIC, Context: *mut ::std::os::raw::c_void),
 >;

Copy link

Cargo - ubuntu-latest

The rust bindings need to be updated. Please apply (git apply) this patch:

diff --git a/src/rs/ffi/linux_bindings.rs b/src/rs/ffi/linux_bindings.rs
index cf4039b..01b44d4 100644
--- a/src/rs/ffi/linux_bindings.rs
+++ b/src/rs/ffi/linux_bindings.rs
@@ -175,6 +175,7 @@ pub const QUIC_PARAM_GLOBAL_EXECUTION_CONFIG: u32 = 16777225;
 pub const QUIC_PARAM_GLOBAL_TLS_PROVIDER: u32 = 16777226;
 pub const QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY: u32 = 16777227;
 pub const QUIC_PARAM_GLOBAL_STATISTICS_V2_SIZES: u32 = 16777228;
+pub const QUIC_PARAM_GLOBAL_STATELESS_RETRY_CONFIG: u32 = 16777229;
 pub const QUIC_PARAM_CONFIGURATION_SETTINGS: u32 = 50331648;
 pub const QUIC_PARAM_CONFIGURATION_TICKET_KEYS: u32 = 50331649;
 pub const QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS: u32 = 50331650;
@@ -4884,6 +4885,34 @@ const _: () = {
     ["Offset of field: QUIC_STREAM_STATISTICS::StreamBlockedByAppUs"]
         [::std::mem::offset_of!(QUIC_STREAM_STATISTICS, StreamBlockedByAppUs) - 56usize];
 };
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_128_GCM: QUIC_AEAD_ALGORITHM_TYPE = 0;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_AES_256_GCM: QUIC_AEAD_ALGORITHM_TYPE = 1;
+pub const QUIC_AEAD_ALGORITHM_TYPE_QUIC_AEAD_ALGORITHM_CHACHA20_POLY1305: QUIC_AEAD_ALGORITHM_TYPE =
+    2;
+pub type QUIC_AEAD_ALGORITHM_TYPE = ::std::os::raw::c_uint;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct QUIC_STATELESS_RETRY_CONFIG {
+    pub Algorithm: QUIC_AEAD_ALGORITHM_TYPE,
+    pub RotationMs: u32,
+    pub SecretLength: u32,
+    pub Secret: *const u8,
+}
+#[allow(clippy::unnecessary_operation, clippy::identity_op)]
+const _: () = {
+    ["Size of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::size_of::<QUIC_STATELESS_RETRY_CONFIG>() - 24usize];
+    ["Alignment of QUIC_STATELESS_RETRY_CONFIG"]
+        [::std::mem::align_of::<QUIC_STATELESS_RETRY_CONFIG>() - 8usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Algorithm"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Algorithm) - 0usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::RotationMs"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, RotationMs) - 4usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::SecretLength"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, SecretLength) - 8usize];
+    ["Offset of field: QUIC_STATELESS_RETRY_CONFIG::Secret"]
+        [::std::mem::offset_of!(QUIC_STATELESS_RETRY_CONFIG, Secret) - 16usize];
+};
 pub type QUIC_SET_CONTEXT_FN = ::std::option::Option<
     unsafe extern "C" fn(Handle: HQUIC, Context: *mut ::std::os::raw::c_void),
 >;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API Area: Core Related to the shared, core protocol logic
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

External DDoS Support for Retry Token Key Configuration
4 participants