Skip to content

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

Merged
merged 19 commits into from
Jun 21, 2025
Merged

Conversation

sm-msft
Copy link
Contributor

@sm-msft sm-msft commented May 29, 2025

Addresses these sub-feature requests

Description

  • Update the version on resumption tickets and added room to include additional data for Careful Resume in the future.
    -- Uplevel server can accept v1 tickets but always issue v2 tickets
    -- Updated ticket tests
  • Define Careful Resume struct
  • Added encoding/decoding functionality for Careful Resume Structs
  • Integrated Careful Resume encoding/decoding into existing custom app resumption ticket code path
  • Added unit tests for the new code

Testing

Ran updated unit tests + running pipeline tests

Documentation

N/A

…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
Copy link

codecov bot commented May 29, 2025

Codecov Report

Attention: Patch coverage is 11.40940% with 132 lines in your changes missing coverage. Please review.

Project coverage is 86.23%. Comparing base (be90c9c) to head (4794ab3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/core/crypto.c 11.40% 132 Missing ⚠️
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.
📢 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.

sm-msft added 2 commits June 10, 2025 12:27
- 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
@sm-msft sm-msft changed the title Bump up resumption ticket version number (Scoped PR) Careful resume structs + encode/decode code Jun 17, 2025
sm-msft added 2 commits June 18, 2025 12:41
- Add info about updating sidecar to build documentation
- Address MacOS build failures
sm-msft added 2 commits June 19, 2025 12:47
…ures

- Additional tests to cover encoding/decoding careful resume struct
@sm-msft
Copy link
Contributor Author

sm-msft commented Jun 19, 2025

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.

Codecov Report

Attention: Patch coverage is 12.40876% with 120 lines in your changes missing coverage. Please review.

Project coverage is 86.16%. Comparing base (31d2b73) to head (3a61ab3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/core/crypto.c 12.40% 120 Missing ⚠️
Additional details and impacted files
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:

@ProjectsByJackHe ProjectsByJackHe self-requested a review June 20, 2025 23:29
Copy link
Contributor

@guhetier guhetier left a 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


Copy link
Contributor

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,
Copy link
Contributor

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.

Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@sm-msft
Copy link
Contributor Author

sm-msft commented Jun 21, 2025

Discussed further comments over teams. Will be merging this change.

@sm-msft sm-msft dismissed guhetier’s stale review June 21, 2025 01:37

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."

@sm-msft sm-msft merged commit 3837827 into main Jun 21, 2025
435 of 440 checks passed
@sm-msft sm-msft deleted the sm/ticket_versioning_2 branch June 21, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants