-
Notifications
You must be signed in to change notification settings - Fork 581
Careful resume structs + encode/decode code #5131
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
Conversation
…default - Uplevel server can accept v1 tickets but always issue v2 tickets - V2 resumption ticket has a 64-byte buffer for usage in the near future - Updated ticket tests
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5131 +/- ##
==========================================
- Coverage 87.41% 86.23% -1.18%
==========================================
Files 59 59
Lines 18086 18233 +147
==========================================
- Hits 15809 15723 -86
- Misses 2277 2510 +233 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- CR Struct encoded/decoded to/from variable length buffers - CR encoding and decoding added to custom server resumption ticket logic - Added test cases for the code changes
- Add info about updating sidecar to build documentation - Address MacOS build failures
…ures - Additional tests to cover encoding/decoding careful resume struct
I have added lots of unit tests to provide coverage for the new code. The new code is not yet hooked up to the rest of the mainline code which typically gets exercised in FVTs etc. I am unsure if the unit tests are running as part of the automation and whether this tool captures that coverage data.
|
- Additional failure unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage data suggests that the tests are not running, which seems strange to me.
We should make sure they are + that they cover the relevant path that are flagged.
I added a few other comments, I think there is a problem when the generation function fails.
@@ -450,11 +450,22 @@ CXPLAT_STATIC_ASSERT( | |||
// | |||
#define QUIC_DEFAULT_SERVER_RESUMPTION_LEVEL QUIC_SERVER_NO_RESUME | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Extra empty line
BOOLEAN | ||
QuicCryptoDecodeCRState( | ||
_Out_ QUIC_CONN_CAREFUL_RESUME_STATE * CarefulResumeState, | ||
_In_reads_(CRBufLength) const uint8_t * Buffer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: style. We tie the *
to the type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(one more argument for having a .clang-format :) )
TicketCursor = QuicVarIntEncode(AppDataLength, TicketCursor); | ||
CxPlatCopyMemory(TicketCursor, NegotiatedAlpn, AlpnLength); | ||
TicketCursor += AlpnLength; | ||
CxPlatCopyMemory(TicketCursor, EncodedHSTP + CxPlatTlsTPHeaderSize, EncodedTPLength); | ||
TicketCursor += EncodedTPLength; | ||
|
||
if (NULL != CarefulResumeState) { | ||
QuicCryptoEncodeCRState(EncodedCRLength, CarefulResumeState, Connection, &EncodedCRLength, TicketCursor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the comment above has been fixed, on failure, EncodedCRLength == 0
.
So *TicketLength = TotalTicketLength
won't be correct anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is specifically written so that it is supplied a certain min amount of buffer to be filled.
We hit asserts in the failure code paths. We are not expected to ship with that error. There is no recovery path here either. I dont want include extra validation that is not needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we have an out parameter in this function for the size if the function assumes it receive the correct amount of memory. Either the function assumes the caller provide a valid buffer and doesn't need to check it, or it doesn't, and it must handle failure.
Discussed further comments over teams. Will be merging this change. |
Discussed this over Teams.
Guillaume's comment:
"The value of annotations on the parameters is mostly about letting the analysis in the caller happen properly.
In the function itself, any assert or assume is good with me."
Addresses these sub-feature requests
Description
-- Uplevel server can accept v1 tickets but always issue v2 tickets
-- Updated ticket tests
Testing
Ran updated unit tests + running pipeline tests
Documentation
N/A