Move TLS 1.3 key schedule to cryptobackend#2378
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR moves the TLS 1.3 key schedule implementation into github.com/microsoft/go/cryptobackend/tls13, updates the Microsoft-patched crypto/tls sources (via 0002-Add-crypto-backends.patch) to use that package, and regenerates the patch set/vendor patch accordingly.
Changes:
- Add a new
cryptobackend/tls13package implementing the TLS 1.3 key schedule with optional backend KDF acceleration behind package-local hooks. - Update the crypto backend patch to switch TLS 1.3 key schedule imports over to
github.com/microsoft/go/cryptobackend/tls13and adjust dependency rules. - Update the vendor patch to include the new vendored
cryptobackend/tls13/tls13.goand keep backend KDF hooks unexported.
Patch consistency: Patches are happy!
Show a summary per file
| File | Description |
|---|---|
| patches/0002-Add-crypto-backends.patch | Switch crypto/tls TLS 1.3 key schedule usage to cryptobackend/tls13, plus related dependency rule updates and patch regeneration cleanup. |
| patches/0001-Vendor-external-dependencies.patch | Vendor the new cryptobackend/tls13/tls13.go and adjust TLS 1.3 backend hook visibility in vendored sources. |
| cryptobackend/tls13/tls13.go | New TLS 1.3 key schedule implementation with HKDF fallback and optional backend KDF path. |
| cryptobackend/tls13/tls13_linux.go | Linux backend hook implementation delegating to OpenSSL TLS 1.3 KDF support. |
| cryptobackend/tls13/tls13_windows.go | Windows backend hook stub (currently unsupported). |
| cryptobackend/tls13/tls13_darwin.go | Darwin backend hook stub (currently unsupported). |
| cryptobackend/tls13/nobackend.go | No-backend stubs for non-goexperiment.systemcrypto builds. |
Copilot's findings
Comments suppressed due to low confidence (1)
patches/0002-Add-crypto-backends.patch:5968
- In the patch for src/crypto/tls/handshake_server_tls13.go, the
cloneHashhunk removes theif !ok { return nil }guard but leavesokdeclared (marshaler, ok := ...) and then callsmarshaler.MarshalBinary()unconditionally. This makes the patched Go source fail to compile (unusedok) and would also panic at runtime ifindoesn't implementbinaryMarshaler.
marshaler, ok := in.(binaryMarshaler)
- if !ok {
- return nil
- }
state, err := marshaler.MarshalBinary()
- Files reviewed: 7/7 changed files
- Comments generated: 0
gdams
approved these changes
Jun 18, 2026
Member
Author
|
@copilot resolve conflicts |
…e-tls13-to-cryptobackend # Conflicts: # patches/0002-Add-crypto-backends.patch
Contributor
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.
Summary
cryptobackend/tls13and switchcrypto/tlsto import it directly.cmd/go/internal/modindex/build_test.goaddition.Validation
go test ./tls13go test -run "TestACVPVectors|TestTrafficKey|TestDependencies" ./crypto/tls ./go/buildMS_GO_NOSYSTEMCRYPTO=1 go test -run "TestACVPVectors|TestTrafficKey|TestDependencies" ./crypto/tls ./go/buildgo test ./cmd/go/internal/modindexgo test -run "TestDependencies" ./go/build