зеркало из https://github.com/microsoft/msquic.git
Resumption ticket generation/parsing logic (#492)
This commit is contained in:
Родитель
5a273249d3
Коммит
bc1b7e8f1a
|
@ -388,6 +388,10 @@ QuicConnFree(
|
|||
if (Connection->OrigDestCID != NULL) {
|
||||
QUIC_FREE(Connection->OrigDestCID);
|
||||
}
|
||||
if (Connection->HandshakeTP != NULL) {
|
||||
QUIC_FREE(Connection->HandshakeTP);
|
||||
Connection->HandshakeTP = NULL;
|
||||
}
|
||||
QuicTraceEvent(
|
||||
ConnDestroyed,
|
||||
"[conn][%p] Destroyed",
|
||||
|
@ -436,9 +440,19 @@ QuicConnApplySettings(
|
|||
if (Settings->ServerResumptionLevel > QUIC_SERVER_NO_RESUME) {
|
||||
QUIC_DBG_ASSERT(!Connection->State.Started);
|
||||
//
|
||||
// TODO: allocate memory for handshake TP here
|
||||
// TODO: Replace with pool allocator for performance.
|
||||
//
|
||||
Connection->State.ResumptionEnabled = TRUE;
|
||||
Connection->HandshakeTP = QUIC_ALLOC_NONPAGED(sizeof(*Connection->HandshakeTP));
|
||||
if (Connection->HandshakeTP == NULL) {
|
||||
QuicTraceEvent(
|
||||
AllocFailure,
|
||||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"handshake TP",
|
||||
sizeof(*Connection->HandshakeTP));
|
||||
} else {
|
||||
QuicZeroMemory(Connection->HandshakeTP, sizeof(*Connection->HandshakeTP));
|
||||
Connection->State.ResumptionEnabled = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
QuicSendApplySettings(&Connection->Send, Settings);
|
||||
|
@ -1904,6 +1918,296 @@ QuicConnRestart(
|
|||
QuicLossDetectionReset(&Connection->LossDetection);
|
||||
QuicCryptoReset(&Connection->Crypto, CompleteReset);
|
||||
}
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
QUIC_STATUS
|
||||
QuicConnSendResumptionTicket(
|
||||
_In_ QUIC_CONNECTION* Connection,
|
||||
_In_ uint16_t AppDataLength,
|
||||
_In_reads_bytes_opt_(AppDataLength)
|
||||
const uint8_t* AppResumptionData
|
||||
)
|
||||
{
|
||||
QUIC_STATUS Status;
|
||||
uint32_t EncodedTransportParametersLength = 0;
|
||||
uint8_t* TicketBuffer = NULL;
|
||||
uint16_t AlpnLength = *(Connection->Crypto.TlsState.NegotiatedAlpn);
|
||||
const uint8_t* EncodedHSTP = NULL;
|
||||
|
||||
if (Connection->HandshakeTP == NULL) {
|
||||
Status = QUIC_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
QUIC_TRANSPORT_PARAMETERS HSTPCopy = *Connection->HandshakeTP;
|
||||
HSTPCopy.Flags = HSTPCopy.Flags & (
|
||||
QUIC_TP_FLAG_ACTIVE_CONNECTION_ID_LIMIT |
|
||||
QUIC_TP_FLAG_INITIAL_MAX_DATA |
|
||||
QUIC_TP_FLAG_INITIAL_MAX_STRM_DATA_BIDI_LOCAL |
|
||||
QUIC_TP_FLAG_INITIAL_MAX_STRM_DATA_BIDI_REMOTE |
|
||||
QUIC_TP_FLAG_INITIAL_MAX_STRM_DATA_UNI |
|
||||
QUIC_TP_FLAG_INITIAL_MAX_STRMS_BIDI |
|
||||
QUIC_TP_FLAG_INITIAL_MAX_STRMS_UNI);
|
||||
|
||||
EncodedHSTP =
|
||||
QuicCryptoTlsEncodeTransportParameters(
|
||||
Connection,
|
||||
&HSTPCopy,
|
||||
&EncodedTransportParametersLength);
|
||||
if (EncodedHSTP == NULL) {
|
||||
Status = QUIC_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
uint32_t TotalTicketLength =
|
||||
(uint32_t)(QuicVarIntSize(QUIC_TLS_RESUMPTION_TICKET_VERSION) +
|
||||
QuicVarIntSize(AlpnLength) +
|
||||
QuicVarIntSize(EncodedTransportParametersLength) +
|
||||
QuicVarIntSize(AppDataLength) +
|
||||
sizeof(QUIC_VERSION_LATEST) +
|
||||
AlpnLength +
|
||||
EncodedTransportParametersLength +
|
||||
AppDataLength);
|
||||
|
||||
TicketBuffer = QUIC_ALLOC_NONPAGED(TotalTicketLength);
|
||||
if (TicketBuffer == NULL) {
|
||||
QuicTraceEvent(
|
||||
AllocFailure,
|
||||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"Server resumption ticket",
|
||||
TotalTicketLength);
|
||||
Status = QUIC_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Encoded ticket format is as follows:
|
||||
// Ticket Version (QUIC_VAR_INT) [1..4]
|
||||
// Quic Version [4]
|
||||
// Negotiated ALPN length (QUIC_VAR_INT) [1..2]
|
||||
// Negotiated ALPN [...]
|
||||
// Transport Parameters length (QUIC_VAR_INT) [1..2]
|
||||
// Transport Parameters [...]
|
||||
// App Ticket length (QUIC_VAR_INT) [1..2]
|
||||
// App Ticket (omitted if length is zero) [...]
|
||||
//
|
||||
|
||||
uint8_t* TicketCursor = QuicVarIntEncode(QUIC_TLS_RESUMPTION_TICKET_VERSION, TicketBuffer);
|
||||
*(uint32_t*)TicketCursor = QuicByteSwapUint32(QUIC_VERSION_LATEST);
|
||||
TicketCursor += sizeof(QUIC_VERSION_LATEST);
|
||||
TicketCursor = QuicVarIntEncode(AlpnLength, TicketCursor);
|
||||
QuicCopyMemory(TicketCursor, Connection->Crypto.TlsState.NegotiatedAlpn + 1, AlpnLength);
|
||||
TicketCursor += AlpnLength;
|
||||
TicketCursor = QuicVarIntEncode(EncodedTransportParametersLength, TicketCursor);
|
||||
QuicCopyMemory(TicketCursor, EncodedHSTP, EncodedTransportParametersLength);
|
||||
TicketCursor += EncodedTransportParametersLength;
|
||||
TicketCursor = QuicVarIntEncode(AppDataLength, TicketCursor);
|
||||
if (AppDataLength > 0) {
|
||||
QuicCopyMemory(TicketCursor, AppResumptionData, AppDataLength);
|
||||
}
|
||||
|
||||
Status = QuicCryptoProcessAppData(&Connection->Crypto, TotalTicketLength, TicketBuffer);
|
||||
|
||||
Error:
|
||||
if (TicketBuffer != NULL) {
|
||||
//
|
||||
// TODO: This might need to be kept around for longer depending on TLS implementation...
|
||||
//
|
||||
QUIC_FREE(TicketBuffer);
|
||||
}
|
||||
|
||||
if (EncodedHSTP != NULL) {
|
||||
QUIC_FREE(EncodedHSTP);
|
||||
}
|
||||
|
||||
if (AppResumptionData != NULL) {
|
||||
QUIC_FREE(AppResumptionData);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
BOOLEAN
|
||||
QuicConnRecvResumptionTicket(
|
||||
_In_ QUIC_CONNECTION* Connection,
|
||||
_In_ uint16_t TicketLength,
|
||||
_In_reads_(TicketLength)
|
||||
const uint8_t* Ticket
|
||||
)
|
||||
{
|
||||
BOOLEAN ResumptionAccepted = FALSE;
|
||||
QUIC_TRANSPORT_PARAMETERS ResumedTP;
|
||||
if (QuicConnIsServer(Connection)) {
|
||||
uint16_t Offset = 0;
|
||||
QUIC_VAR_INT TicketVersion = 0, AlpnLength = 0, TPLength = 0, AppTicketLength = 0;
|
||||
if (!QuicVarIntDecode(TicketLength, Ticket, &Offset, &TicketVersion)) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket version failed to decode");
|
||||
goto Error;
|
||||
}
|
||||
if (TicketVersion != QUIC_TLS_RESUMPTION_TICKET_VERSION) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket version unsupported");
|
||||
goto Error;
|
||||
}
|
||||
|
||||
uint32_t QuicVersionHost = QuicByteSwapUint32(*(uint32_t*)(Ticket + Offset));
|
||||
if (!QuicIsVersionSupported(QuicVersionHost)) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket for unsupported QUIC version");
|
||||
goto Error;
|
||||
}
|
||||
Offset += sizeof(QuicVersionHost);
|
||||
|
||||
if (!QuicVarIntDecode(TicketLength, Ticket, &Offset, &AlpnLength)) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket ALPN length failed to decode");
|
||||
goto Error;
|
||||
}
|
||||
if (QuicTlsAlpnFindInList(
|
||||
Connection->Session->AlpnListLength, Connection->Session->AlpnList,
|
||||
(uint8_t)AlpnLength, Ticket + Offset) == NULL) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket ALPN not present in ALPN list");
|
||||
goto Error;
|
||||
}
|
||||
Offset += (uint16_t)AlpnLength;
|
||||
|
||||
if (!QuicVarIntDecode(TicketLength, Ticket, &Offset, &TPLength)) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket TP length failed to decode");
|
||||
goto Error;
|
||||
}
|
||||
if (!QuicCryptoTlsDecodeTransportParameters(
|
||||
Connection,
|
||||
Ticket + Offset,
|
||||
(uint16_t)TPLength,
|
||||
&ResumedTP)) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket TParams failed to decode");
|
||||
goto Error;
|
||||
}
|
||||
Offset += (uint16_t)TPLength;
|
||||
|
||||
//
|
||||
// Validate resumed TP are <= current settings
|
||||
//
|
||||
if (ResumedTP.ActiveConnectionIdLimit > QUIC_ACTIVE_CONNECTION_ID_LIMIT ||
|
||||
ResumedTP.InitialMaxData > Connection->Send.MaxData ||
|
||||
ResumedTP.InitialMaxStreamDataBidiLocal > Connection->Session->Settings.StreamRecvWindowDefault ||
|
||||
ResumedTP.InitialMaxStreamDataBidiRemote > Connection->Session->Settings.StreamRecvWindowDefault ||
|
||||
ResumedTP.InitialMaxStreamDataUni > Connection->Session->Settings.StreamRecvWindowDefault ||
|
||||
ResumedTP.InitialMaxUniStreams > Connection->Streams.Types[STREAM_ID_FLAG_IS_CLIENT | STREAM_ID_FLAG_IS_UNI_DIR].MaxTotalStreamCount ||
|
||||
ResumedTP.InitialMaxBidiStreams > Connection->Streams.Types[STREAM_ID_FLAG_IS_CLIENT | STREAM_ID_FLAG_IS_BI_DIR].MaxTotalStreamCount) {
|
||||
//
|
||||
// Server settings have changed since the resumption ticket was
|
||||
// encoded, so reject resumption.
|
||||
//
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket transport params greater than current server settings");
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (!QuicVarIntDecode(TicketLength, Ticket, &Offset, &AppTicketLength)) {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket app data length failed to decode");
|
||||
goto Error;
|
||||
}
|
||||
|
||||
QUIC_CONNECTION_EVENT Event = { 0, };
|
||||
Event.Type = QUIC_CONNECTION_EVENT_RESUMED;
|
||||
Event.RESUMED.ResumptionStateLength = (uint16_t)AppTicketLength;
|
||||
Event.RESUMED.ResumptionState = (AppTicketLength > 0) ? Ticket + Offset : NULL;
|
||||
ResumptionAccepted =
|
||||
QUIC_SUCCEEDED(QuicConnIndicateEvent(Connection, &Event));
|
||||
|
||||
|
||||
if (ResumptionAccepted) {
|
||||
QuicTraceEvent(
|
||||
ConnServerResumeTicket,
|
||||
"[conn][%p] Server app accepted resumption ticket",
|
||||
Connection);
|
||||
} else {
|
||||
QuicTraceEvent(
|
||||
ConnError,
|
||||
"[conn][%p] ERROR, %s.",
|
||||
Connection,
|
||||
"Resumption Ticket rejected by server app");
|
||||
}
|
||||
|
||||
QUIC_DBG_ASSERT(Offset + AppTicketLength == TicketLength);
|
||||
} else {
|
||||
//
|
||||
// TODO Client-side processing.
|
||||
// Until then, this shouldn't ever get called.
|
||||
//
|
||||
QUIC_FRE_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
Error:
|
||||
|
||||
return ResumptionAccepted;
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
void
|
||||
QuicConnCleanupServerResumptionState(
|
||||
_In_ QUIC_CONNECTION* Connection
|
||||
)
|
||||
{
|
||||
QUIC_DBG_ASSERT(QuicConnIsServer(Connection));
|
||||
if (!Connection->State.ResumptionEnabled) {
|
||||
if (Connection->HandshakeTP != NULL) {
|
||||
QUIC_FREE(Connection->HandshakeTP);
|
||||
Connection->HandshakeTP = NULL;
|
||||
}
|
||||
|
||||
QUIC_CRYPTO* Crypto = &Connection->Crypto;
|
||||
|
||||
QuicTraceLogConnInfo(
|
||||
CryptoStateDiscard,
|
||||
Connection,
|
||||
"TLS state no longer needed");
|
||||
if (Crypto->TLS != NULL) {
|
||||
QuicTlsUninitialize(Crypto->TLS);
|
||||
Crypto->TLS = NULL;
|
||||
}
|
||||
if (Crypto->Initialized) {
|
||||
QuicRecvBufferUninitialize(&Crypto->RecvBuffer);
|
||||
QuicRangeUninitialize(&Crypto->SparseAckRanges);
|
||||
QUIC_FREE(Crypto->TlsState.Buffer);
|
||||
Crypto->TlsState.Buffer = NULL;
|
||||
Crypto->Initialized = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
QUIC_STATUS
|
||||
|
@ -2085,6 +2389,15 @@ QuicConnHandshakeConfigure(
|
|||
LocalTP.MaxDatagramFrameSize = QUIC_DEFAULT_MAX_DATAGRAM_LENGTH;
|
||||
}
|
||||
|
||||
//
|
||||
// Persist the transport parameters used during handshake for resumption.
|
||||
// (if resumption is enabled)
|
||||
//
|
||||
if (Connection->HandshakeTP != NULL) {
|
||||
QUIC_DBG_ASSERT(Connection->State.ResumptionEnabled);
|
||||
*Connection->HandshakeTP = LocalTP;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
uint32_t InitialQuicVersion = QUIC_VERSION_LATEST;
|
||||
|
@ -6112,6 +6425,20 @@ QuicConnProcessApiOperation(
|
|||
ApiCtx->CONN_START.ServerName = NULL;
|
||||
break;
|
||||
|
||||
case QUIC_API_TYPE_CONN_SEND_RESUMPTION_TICKET:
|
||||
Status =
|
||||
QuicConnSendResumptionTicket(
|
||||
Connection,
|
||||
ApiCtx->CONN_SEND_RESUMPTION_TICKET.AppDataLength,
|
||||
ApiCtx->CONN_SEND_RESUMPTION_TICKET.ResumptionAppData);
|
||||
ApiCtx->CONN_SEND_RESUMPTION_TICKET.ResumptionAppData = NULL;
|
||||
if (ApiCtx->CONN_SEND_RESUMPTION_TICKET.Flags & QUIC_SEND_RESUMPTION_FLAG_FINAL) {
|
||||
QUIC_DBG_ASSERT(QuicConnIsServer(Connection));
|
||||
Connection->State.ResumptionEnabled = FALSE;
|
||||
QuicConnCleanupServerResumptionState(Connection); // BUG: With Async processing, this frees the memory before it's used.
|
||||
}
|
||||
break;
|
||||
|
||||
case QUIC_API_TYPE_STRM_CLOSE:
|
||||
QuicStreamClose(ApiCtx->STRM_CLOSE.Stream);
|
||||
break;
|
||||
|
|
|
@ -530,6 +530,12 @@ typedef struct QUIC_CONNECTION {
|
|||
//
|
||||
QUIC_CONNECTION_CALLBACK_HANDLER ClientCallbackHandler;
|
||||
|
||||
//
|
||||
// (Server-only) Transport parameters used during handshake.
|
||||
// Only non-null when resumption is enabled.
|
||||
//
|
||||
QUIC_TRANSPORT_PARAMETERS* HandshakeTP;
|
||||
|
||||
//
|
||||
// Statistics
|
||||
//
|
||||
|
@ -1218,6 +1224,18 @@ QuicConnHandshakeConfigure(
|
|||
_In_opt_ QUIC_SEC_CONFIG* SecConfig
|
||||
);
|
||||
|
||||
//
|
||||
// Check if the resumption state is ready to be cleaned up and free it.
|
||||
//
|
||||
// Called when the server has sent everything it will ever send and it has all
|
||||
// been acknowledged.
|
||||
//
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
void
|
||||
QuicConnCleanupServerResumptionState(
|
||||
_In_ QUIC_CONNECTION* Connection
|
||||
);
|
||||
|
||||
//
|
||||
// Discard any 0-RTT deferred datagrams.
|
||||
//
|
||||
|
|
|
@ -436,33 +436,6 @@ QuicCryptoDiscardKeys(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Called when the server has sent everything it will ever send and it has all
|
||||
// been acknowledged.
|
||||
//
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
void
|
||||
QuicCryptoOnServerComplete(
|
||||
_In_ QUIC_CRYPTO* Crypto
|
||||
)
|
||||
{
|
||||
QuicTraceLogConnInfo(
|
||||
CryptoStateDiscard,
|
||||
QuicCryptoGetConnection(Crypto),
|
||||
"Crypto/TLS state no longer needed");
|
||||
if (Crypto->TLS != NULL) {
|
||||
QuicTlsUninitialize(Crypto->TLS);
|
||||
Crypto->TLS = NULL;
|
||||
}
|
||||
if (Crypto->Initialized) {
|
||||
QuicRecvBufferUninitialize(&Crypto->RecvBuffer);
|
||||
QuicRangeUninitialize(&Crypto->SparseAckRanges);
|
||||
QUIC_FREE(Crypto->TlsState.Buffer);
|
||||
Crypto->TlsState.Buffer = NULL;
|
||||
Crypto->Initialized = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Send Interfaces
|
||||
//
|
||||
|
@ -985,9 +958,7 @@ QuicCryptoOnAck(
|
|||
if (Connection->State.Connected && QuicConnIsServer(Connection) &&
|
||||
Crypto->TlsState.BufferOffset1Rtt != 0 &&
|
||||
Crypto->UnAckedOffset == Crypto->TlsState.BufferTotalLength) {
|
||||
QuicCryptoOnServerComplete(Crypto); // TODO - If sending 0-RTT tickets ever becomes
|
||||
// controllable by the app, this logic will have
|
||||
// to take that into account.
|
||||
QuicConnCleanupServerResumptionState(Connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1453,9 +1424,7 @@ QuicCryptoProcessTlsCompletion(
|
|||
if (QuicConnIsServer(Connection) &&
|
||||
Crypto->TlsState.BufferOffset1Rtt != 0 &&
|
||||
Crypto->UnAckedOffset == Crypto->TlsState.BufferTotalLength) {
|
||||
QuicCryptoOnServerComplete(Crypto); // TODO - If sending 0-RTT tickets ever becomes
|
||||
// controllable by the app, this logic will have
|
||||
// to take that into account.
|
||||
QuicConnCleanupServerResumptionState(Connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1678,7 +1647,7 @@ QuicCryptoProcessData(
|
|||
QuicCryptoValidate(Crypto);
|
||||
|
||||
QUIC_TLS_RESULT_FLAGS ResultFlags =
|
||||
QuicTlsProcessData(Crypto->TLS, Buffer.Buffer, &Buffer.Length, &Crypto->TlsState);
|
||||
QuicTlsProcessData(Crypto->TLS, QUIC_TLS_CRYPTO_DATA, Buffer.Buffer, &Buffer.Length, &Crypto->TlsState);
|
||||
|
||||
QUIC_TEL_ASSERT(!IsClientInitial || ResultFlags != QUIC_TLS_RESULT_PENDING); // TODO - Support async for client Initial?
|
||||
|
||||
|
@ -1694,6 +1663,22 @@ Error:
|
|||
QuicCryptoValidate(Crypto);
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
QUIC_STATUS
|
||||
QuicCryptoProcessAppData(
|
||||
_In_ QUIC_CRYPTO* Crypto,
|
||||
_In_ uint32_t DataLength,
|
||||
_In_reads_bytes_(DataLength)
|
||||
const uint8_t* AppData
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(Crypto);
|
||||
UNREFERENCED_PARAMETER(DataLength);
|
||||
UNREFERENCED_PARAMETER(AppData);
|
||||
|
||||
return QUIC_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
QUIC_STATUS
|
||||
QuicCryptoGenerateNewKeys(
|
||||
|
|
|
@ -232,6 +232,18 @@ QuicCryptoProcessCompleteOperation(
|
|||
_In_ QUIC_CRYPTO* Crypto
|
||||
);
|
||||
|
||||
//
|
||||
// Processes app-provided data for TLS (i.e. resumption ticket data).
|
||||
//
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
QUIC_STATUS
|
||||
QuicCryptoProcessAppData(
|
||||
_In_ QUIC_CRYPTO* Crypto,
|
||||
_In_ uint32_t DataLength,
|
||||
_In_reads_bytes_(DataLength)
|
||||
const uint8_t* AppData
|
||||
);
|
||||
|
||||
//
|
||||
// Helper function to determine how much complete TLS data is contained in the
|
||||
// buffer, and should be passed to TLS.
|
||||
|
|
|
@ -403,6 +403,12 @@ QUIC_STATIC_ASSERT(
|
|||
//
|
||||
#define QUIC_DEFAULT_SERVER_RESUMPTION_LEVEL QUIC_SERVER_NO_RESUME
|
||||
|
||||
//
|
||||
// Version of the wire-format for resumption tickets.
|
||||
// This needs to be incremented for each change in order or count of fields.
|
||||
//
|
||||
#define QUIC_TLS_RESUMPTION_TICKET_VERSION 1
|
||||
|
||||
/*************************************************************
|
||||
PERSISTENT SETTINGS
|
||||
*************************************************************/
|
||||
|
|
|
@ -132,6 +132,13 @@ typedef enum QUIC_TLS_RESULT_FLAGS {
|
|||
|
||||
} QUIC_TLS_RESULT_FLAGS;
|
||||
|
||||
typedef enum QUIC_TLS_DATA_FLAGS {
|
||||
|
||||
QUIC_TLS_CRYPTO_DATA,
|
||||
QUIC_TLS_TICKET_DATA
|
||||
|
||||
} QUIC_TLS_DATA_FLAGS;
|
||||
|
||||
//
|
||||
// Different possible results after writing new TLS data.
|
||||
//
|
||||
|
@ -368,6 +375,7 @@ _IRQL_requires_max_(PASSIVE_LEVEL)
|
|||
QUIC_TLS_RESULT_FLAGS
|
||||
QuicTlsProcessData(
|
||||
_In_ QUIC_TLS* TlsContext,
|
||||
_In_ QUIC_TLS_DATA_FLAGS DataFlags,
|
||||
_In_reads_bytes_(*BufferLength)
|
||||
const uint8_t * Buffer,
|
||||
_Inout_ uint32_t * BufferLength,
|
||||
|
@ -396,18 +404,6 @@ QuicTlsReadTicket(
|
|||
uint8_t* Buffer
|
||||
);
|
||||
|
||||
//
|
||||
// Called to send a TLS ticket.
|
||||
//
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
QUIC_STATUS
|
||||
QuicTlsSendTicket(
|
||||
_In_ QUIC_TLS* TlsContext,
|
||||
_In_ uint32_t SerializedTicketLength,
|
||||
_In_reads_bytes_(SerializedTicketLength)
|
||||
const uint8_t* SerializedTicket
|
||||
);
|
||||
|
||||
//
|
||||
// Sets a TLS parameter.
|
||||
//
|
||||
|
|
|
@ -864,6 +864,13 @@ QUIC_TRACE_EVENT(ConnQueueSendFlush,
|
|||
ctf_integer_hex(uint64_t, Connection, Connection)
|
||||
ctf_integer(uint32_t, Reason, Reason))
|
||||
)
|
||||
QUIC_TRACE_EVENT(ConnServerResumeTicket,
|
||||
TP_ARGS(
|
||||
const void*, Connection),
|
||||
TP_FIELDS(
|
||||
ctf_integer_hex(uint64_t, Connection, Connection))
|
||||
)
|
||||
QUIC_TRACE_LEVEL(ConnServerResumeTicket, TRACE_INFO)
|
||||
QUIC_TRACE_EVENT(StreamCreated,
|
||||
TP_ARGS(
|
||||
const void*, Stream,
|
||||
|
|
|
@ -1209,6 +1209,12 @@
|
|||
name="Type"
|
||||
/>
|
||||
</template>
|
||||
<template tid="tid_CONN_SERVER_RESUME_TICKET">
|
||||
<data
|
||||
inType="win:Pointer"
|
||||
name="Connection"
|
||||
/>
|
||||
</template>
|
||||
<template tid="tid_STREAM">
|
||||
<data
|
||||
inType="win:Pointer"
|
||||
|
@ -2534,6 +2540,15 @@
|
|||
template="tid_CONN_PACKET_STATISTICS"
|
||||
value="5174"
|
||||
/>
|
||||
<event
|
||||
keywords="ut:Connection"
|
||||
level="win:Informational"
|
||||
message="$(string.Etw.ConnServerResumeTicket)"
|
||||
opcode="win:Info"
|
||||
symbol="QuicConnServerResumeTicket"
|
||||
template="tid_CONN_SERVER_RESUME_TICKET"
|
||||
value="5175"
|
||||
/>
|
||||
<!-- 6144 - 7167 | Stream Events -->
|
||||
<event
|
||||
keywords="ut:Stream ut:LowVolume"
|
||||
|
@ -3040,6 +3055,10 @@
|
|||
id="Etw.ConnPacketLost"
|
||||
value="[conn][%1][TX][%2] %3 Lost: %4"
|
||||
/>
|
||||
<string
|
||||
id="Etw.ConnServerResumeTicket"
|
||||
value="[conn][%1] Server app accepted resumption ticket"
|
||||
/>
|
||||
<string
|
||||
id="Etw.ConnPacketAcked"
|
||||
value="[conn][%1][TX][%2] %3 ACKed"
|
||||
|
|
|
@ -1145,12 +1145,14 @@ _IRQL_requires_max_(PASSIVE_LEVEL)
|
|||
QUIC_TLS_RESULT_FLAGS
|
||||
QuicTlsProcessData(
|
||||
_In_ QUIC_TLS* TlsContext,
|
||||
_In_ QUIC_TLS_DATA_FLAGS DataFlags,
|
||||
_In_reads_bytes_(*BufferLength)
|
||||
const uint8_t * Buffer,
|
||||
_Inout_ uint32_t * BufferLength,
|
||||
_Inout_ QUIC_TLS_PROCESS_STATE* State
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(DataFlags);
|
||||
QUIC_TLS_RESULT_FLAGS ResultFlags = 0;
|
||||
uint32_t ConsumedBytes;
|
||||
|
||||
|
|
|
@ -1361,11 +1361,13 @@ QuicTlsGetSecConfig(
|
|||
QUIC_TLS_RESULT_FLAGS
|
||||
QuicTlsProcessData(
|
||||
_In_ QUIC_TLS* TlsContext,
|
||||
_In_ QUIC_TLS_DATA_FLAGS DataFlags,
|
||||
_In_reads_bytes_(*BufferLength) const uint8_t* Buffer,
|
||||
_Inout_ uint32_t* BufferLength,
|
||||
_Inout_ QUIC_TLS_PROCESS_STATE* State
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(DataFlags);
|
||||
int Ret = 0;
|
||||
int Err = 0;
|
||||
|
||||
|
|
|
@ -2181,12 +2181,14 @@ _IRQL_requires_max_(PASSIVE_LEVEL)
|
|||
QUIC_TLS_RESULT_FLAGS
|
||||
QuicTlsProcessData(
|
||||
_In_ QUIC_TLS* TlsContext,
|
||||
_In_ QUIC_TLS_DATA_FLAGS DataFlags,
|
||||
_In_reads_bytes_(*BufferLength)
|
||||
const uint8_t * Buffer,
|
||||
_Inout_ uint32_t * BufferLength,
|
||||
_Inout_ QUIC_TLS_PROCESS_STATE* State
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(DataFlags);
|
||||
QUIC_TLS_RESULT_FLAGS Result = 0;
|
||||
|
||||
QuicTraceLogConnVerbose(
|
||||
|
|
|
@ -1203,12 +1203,14 @@ _IRQL_requires_max_(PASSIVE_LEVEL)
|
|||
QUIC_TLS_RESULT_FLAGS
|
||||
QuicTlsProcessData(
|
||||
_In_ QUIC_TLS* TlsContext,
|
||||
_In_ QUIC_TLS_DATA_FLAGS DataFlags,
|
||||
_In_reads_bytes_(*BufferLength)
|
||||
const uint8_t * Buffer,
|
||||
_Inout_ uint32_t * BufferLength,
|
||||
_Inout_ QUIC_TLS_PROCESS_STATE* State
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(DataFlags);
|
||||
if (*BufferLength) {
|
||||
QuicTraceLogConnVerbose(
|
||||
StubTlsProcessData,
|
||||
|
|
|
@ -258,6 +258,7 @@ protected:
|
|||
auto Result =
|
||||
QuicTlsProcessData(
|
||||
Ptr,
|
||||
QUIC_TLS_CRYPTO_DATA,
|
||||
Buffer,
|
||||
BufferLength,
|
||||
&State);
|
||||
|
|
|
@ -107,6 +107,7 @@ private:
|
|||
auto Result =
|
||||
QuicTlsProcessData(
|
||||
Ptr,
|
||||
QUIC_TLS_CRYPTO_DATA,
|
||||
Buffer,
|
||||
BufferLength,
|
||||
&State);
|
||||
|
|
Загрузка…
Ссылка в новой задаче