Skip to content
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

Expose Interface for App to Set Stateless Reset Key #3879

Merged
merged 18 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/core/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,30 @@ QuicLibrarySetGlobalParam(
Status = QUIC_STATUS_SUCCESS;
break;

case QUIC_PARAM_GLOBAL_STATELESS_RESETKEY:
if (BufferLength != QUIC_STATELESS_RESETKEY_LENGTH * sizeof (uint8_t)) {
Status = QUIC_STATUS_INVALID_PARAMETER;
break;
}

for (uint16_t i = 0; i < MsQuicLib.ProcessorCount; ++i) {
QUIC_LIBRARY_PP* PerProc = &MsQuicLib.PerProc[i];
CxPlatLockAcquire(&PerProc->ResetTokenLock);
CxPlatHashFree(PerProc->ResetTokenHash);
Status =
CxPlatHashCreate(
CXPLAT_HASH_SHA256,
(uint8_t*)Buffer,
QUIC_STATELESS_RESETKEY_LENGTH * sizeof(uint8_t),
&PerProc->ResetTokenHash);
if (QUIC_FAILED(Status)) {
return Status;
nibanks marked this conversation as resolved.
Show resolved Hide resolved
}
CxPlatLockRelease(&PerProc->ResetTokenLock);
}
Status = QUIC_STATUS_SUCCESS;
break;

default:
Status = QUIC_STATUS_INVALID_PARAMETER;
break;
Expand Down
3 changes: 3 additions & 0 deletions src/cs/lib/msquic_generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3143,6 +3143,9 @@ internal static unsafe partial class MsQuic
[NativeTypeName("#define QUIC_PARAM_GLOBAL_TLS_PROVIDER 0x0100000A")]
internal const uint QUIC_PARAM_GLOBAL_TLS_PROVIDER = 0x0100000A;

[NativeTypeName("#define QUIC_PARAM_GLOBAL_STATELESS_RESETKEY 0x0100000B")]
internal const uint QUIC_PARAM_GLOBAL_STATELESS_RESETKEY = 0x0100000B;

[NativeTypeName("#define QUIC_PARAM_CONFIGURATION_SETTINGS 0x03000000")]
internal const uint QUIC_PARAM_CONFIGURATION_SETTINGS = 0x03000000;

Expand Down
7 changes: 6 additions & 1 deletion src/inc/msquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ typedef _In_range_(0, QUIC_UINT62_MAX) uint64_t QUIC_UINT62;
//
#define QUIC_MAX_RESUMPTION_APP_DATA_LENGTH 1000

//
// The number of bytes of stateless reset key
nibanks marked this conversation as resolved.
Show resolved Hide resolved
//
#define QUIC_STATELESS_RESETKEY_LENGTH 32

typedef enum QUIC_TLS_PROVIDER {
QUIC_TLS_PROVIDER_SCHANNEL = 0x0000,
QUIC_TLS_PROVIDER_OPENSSL = 0x0001,
Expand Down Expand Up @@ -832,7 +837,7 @@ void
#define QUIC_PARAM_GLOBAL_EXECUTION_CONFIG 0x01000009 // QUIC_EXECUTION_CONFIG
#endif
#define QUIC_PARAM_GLOBAL_TLS_PROVIDER 0x0100000A // QUIC_TLS_PROVIDER

#define QUIC_PARAM_GLOBAL_STATELESS_RESETKEY 0x0100000B // uint8_t[] Array size is QUIC_STATELESS_RESETKEY_LENGTH
nibanks marked this conversation as resolved.
Show resolved Hide resolved
//
// Parameters for Registration.
//
Expand Down
Loading