-
Notifications
You must be signed in to change notification settings - Fork 695
fix(butane,ignition): disable systemcrypto on CGO_ENABLED=0 static cross-builds #18550
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
Open
Nan Liu (liunan-ms)
wants to merge
1
commit into
4.0
Choose a base branch
from
liunan/golang-nosystemcrypto-dev
base: 4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+58
−14
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [components.butane] |
22 changes: 22 additions & 0 deletions
22
base/comps/butane/overlays/0001-disable-systemcrypto-static-cross-builds.overlay.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Azure Linux's golang is the Microsoft build of Go, whose systemcrypto (OpenSSL) | ||
| # backend is baseline-enabled for Linux targets. The -redistributable Linux binaries | ||
| # are cross-compiled static with CGO_ENABLED=0: the OpenSSL backend file is excluded | ||
| # (no cgo) but systemcrypto stays enabled, so no crypto backend file is selected and | ||
| # crypto/internal/backend/fips140 fails to compile (undefined systemFIPSMode/ | ||
| # backendEnabled). Disable systemcrypto for these cgo-free static cross-builds so the | ||
| # pure-Go crypto implementation is used, keeping the redistributable binaries | ||
| # self-contained (no runtime OpenSSL). Use the MS_GO_NOSYSTEMCRYPTO=1 env var, not | ||
| # GOEXPERIMENT=nosystemcrypto: it is the documented, forward-compatible knob (Go 1.25.2 | ||
| # through 1.27+), whereas GOEXPERIMENT=nosystemcrypto is removed and rejected in Go 1.27. | ||
| # butane supplies no GOEXPERIMENT override at all. | ||
| # Ref: https://github.com/microsoft/go/blob/8ef6cff0f34e983fb707a455292ed162e1ecc3ae/eng/doc/fips/README.md#build-option-to-use-go-crypto | ||
| [metadata] | ||
| category = "azl-compatibility" | ||
| upstream-status = "inapplicable" | ||
|
|
||
| [[overlays]] | ||
| description = "Disable systemcrypto on the CGO_ENABLED=0 static Linux cross-builds via MS_GO_NOSYSTEMCRYPTO=1 (pure-Go crypto, self-contained): Microsoft Go baseline-enables the OpenSSL backend, which cannot compile without cgo; MS_GO_NOSYSTEMCRYPTO stays valid on Go 1.27 unlike the removed GOEXPERIMENT=nosystemcrypto" | ||
| type = "spec-search-replace" | ||
| section = "%build" | ||
| regex = '^CGO_ENABLED=0 GOARCH' | ||
| replacement = "MS_GO_NOSYSTEMCRYPTO=1 CGO_ENABLED=0 GOARCH" | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [components.ignition] |
22 changes: 22 additions & 0 deletions
22
base/comps/ignition/overlays/0001-disable-systemcrypto-static-cross-builds.overlay.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Azure Linux's golang is the Microsoft build of Go, whose systemcrypto (OpenSSL) | ||
| # backend is baseline-enabled for Linux targets. The -redistributable Linux binaries | ||
| # are cross-compiled static with CGO_ENABLED=0: the OpenSSL backend file is excluded | ||
| # (no cgo) but systemcrypto stays enabled, so no crypto backend file is selected and | ||
| # crypto/internal/backend/fips140 fails to compile (undefined systemFIPSMode/ | ||
| # backendEnabled). Disable systemcrypto for these cgo-free static cross-builds so the | ||
| # pure-Go crypto implementation is used, keeping the redistributable binaries | ||
| # self-contained (no runtime OpenSSL). Use the MS_GO_NOSYSTEMCRYPTO=1 env var, not | ||
| # GOEXPERIMENT=nosystemcrypto: it is the documented, forward-compatible knob (Go 1.25.2 | ||
| # through 1.27+), whereas GOEXPERIMENT=nosystemcrypto is removed and rejected in Go 1.27. | ||
| # ignition's GOEXPERIMENT= (empty) does not clear the Microsoft Go platform baseline. | ||
| # Ref: https://github.com/microsoft/go/blob/8ef6cff0f34e983fb707a455292ed162e1ecc3ae/eng/doc/fips/README.md#build-option-to-use-go-crypto | ||
| [metadata] | ||
| category = "azl-compatibility" | ||
| upstream-status = "inapplicable" | ||
|
|
||
| [[overlays]] | ||
| description = "Disable systemcrypto on the CGO_ENABLED=0 static Linux cross-builds via MS_GO_NOSYSTEMCRYPTO=1 (pure-Go crypto, self-contained): stays valid on Go 1.27 unlike the removed GOEXPERIMENT=nosystemcrypto; the native strictfipsruntime binary is unaffected" | ||
| type = "spec-search-replace" | ||
| section = "%build" | ||
| regex = '^GOEXPERIMENT= CGO_ENABLED=0' | ||
| replacement = "MS_GO_NOSYSTEMCRYPTO=1 GOEXPERIMENT= CGO_ENABLED=0" | ||
|
liunan-ms marked this conversation as resolved.
|
||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.