Conversation
To allow the function to verify that the buffer is large enough. Avoids possible future internal mishaps.
There was a problem hiding this comment.
Pull request overview
This PR updates libcurl’s internal TLS keylog writer API to accept an explicit client-random buffer length, allowing the implementation to validate the input size before formatting the NSS-style keylog line.
Changes:
- Extend
Curl_tls_keylog_write()to take arandom_sizeargument and validate it againstCLIENT_RANDOM_SIZE. - Update TLS backend call sites (OpenSSL, wolfSSL, GnuTLS, rustls) to pass the client-random length/size.
- Add defensive checks in the keylog implementation to reject undersized client-random buffers.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/vtls/keylog.h | Updates the Curl_tls_keylog_write() declaration to include random_size. |
| lib/vtls/keylog.c | Updates the definition and adds a size assertion/guard before formatting the line. |
| lib/vtls/openssl.c | Passes sizeof(client_random) to the updated keylog writer. |
| lib/vtls/wolfssl.c | Passes client-random size/length to the updated keylog writer in TLS 1.2/1.3 paths. |
| lib/vtls/gtls.c | Passes crandom.size to the updated keylog writer (after verifying it is 32). |
| lib/vtls/rustls.c | Passes client_random_len to the updated keylog writer in the rustls keylog callback. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To allow the function to verify that the buffer is large enough. Avoids possible future internal mishaps.