Skip to content

[release-branch.go1.27] Honor the testing random reader in ML-KEM - #2501

Merged
George Adams (gdams) merged 1 commit into
microsoft/release-branch.go1.27from
dev/qmuntal/backport-mlkem-random-go1.27
Sep 8, 2026
Merged

[release-branch.go1.27] Honor the testing random reader in ML-KEM#2501
George Adams (gdams) merged 1 commit into
microsoft/release-branch.go1.27from
dev/qmuntal/backport-mlkem-random-go1.27

Conversation

@qmuntal

Copy link
Copy Markdown
Member

Summary

Backport the ML-KEM portion of main commit 93114c97deb03b0b112dc52d99e326661a2ba1a7 plus the dependency rule fix 29c2d8ac76.

crypto/internal/rand.Reader remains the default under testing/cryptotest.SetGlobalRandom, so check the public crypto/rand.Reader. This fixes deterministic TLS ClientHello ML-KEM replay mismatches without changing fixtures.

Changes

1.27 public-reader guards for 768/1024 and dependency updates in existing patch 0002.

Validation

Windows/arm64 CNG, existing TestSetGlobalRandom/mlkem.GenerateKey768 passed, ML-KEM tests/dependency TestDependencies passed, temporary 768/1024 deterministic/roundtrip/key-lifetime probes passed and were removed, MS_GO_NOSYSTEMCRYPTO=1 control passed, and git go-patch extract verified. One combined 1.26 run timed out; isolated checks/bounded reruns passed. No TLS replay/E2E suites were run.

The Go 1.26 toolchain was built from patched Go 1.26.8 source; the existing local devel toolchain was used against patched 1.27.1 source.

Backport the ML-KEM portion of 93114c9 and the dependency-rule fix from 29c2d8a. Check crypto/rand.Reader rather than the internal default sentinel so SetGlobalRandom uses the deterministic Go implementation. Regenerate the crypto integration patch without unrelated main changes.
Copilot AI lite review requested due to automatic review settings September 8, 2026 08:15
@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner September 8, 2026 08:15
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The change is narrowly scoped, aligns with the stated intent (public crypto/rand.Reader default-reader checks), and updates dependency rules to match.

Review tier: Lite
Findings: None

What changed in this PR

Backports the Go 1.27 ML-KEM “use public crypto/rand.Reader for default-reader checks” fix into the existing crypto-backend patch, preventing backend ML-KEM keygen/encapsulation from running when testing/cryptotest.SetGlobalRandom has overridden crypto/rand.Reader (fixing deterministic TLS ClientHello replay mismatches).

Changes:

  • Update crypto/mlkem backend gating to use rand.IsDefaultReader(crypto/rand.Reader) rather than crypto/internal/rand.Reader.
  • Adjust go/build/deps_test.go dependency rules to reflect crypto/mlkem’s dependency on crypto/rand.Reader.

Patches are happy!

File Description
patches/​0002-Add-crypto-backends.patch Backports ML-KEM reader-guard logic and updates deps rules for crypto/mlkem accordingly.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@gdams
George Adams (gdams) enabled auto-merge (squash) September 8, 2026 08:24
@gdams
George Adams (gdams) merged commit cbbd831 into microsoft/release-branch.go1.27 Sep 8, 2026
57 checks passed
@gdams
George Adams (gdams) deleted the dev/qmuntal/backport-mlkem-random-go1.27 branch September 8, 2026 09:24
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.

3 participants