Skip to content

Conversation

@dagood
Copy link
Member

@dagood dagood commented Sep 15, 2023

Updates OpenSSL and CNG patches to add SHA3 APIs and SupportsHash. Include these funcs in nobackend.go because that's being used to determine how the proxy is generated in the x/crypto fork.

Adds the xcryptobackendswap experiment, which uses -modfile plus some internal patching to replace any x/crypto usage with a fork of x/crypto contained in GOROOT/ms_mod.

The fork is generated by a tool that applies patches onto an x/crypto submodule, copies it to the specified dir, then generates "proxies" by parsing the crypto backends and nobackend then using go:linkname to access the internal funcs. This tool as well as the submodule and patches can live in microsoft/go-infra for now. The idea is that the patches are toolset- and version-agnostic and we define a common API in nobackend.go that the patched x/crypto uses. For the most part, we control what our backend API looks like (and we can always add more functions that upstream doesn't have), so this might be good enough for compatibility.

Draft things: doesn't include HKDF (will want SupportsHKDF from #1037), I wrote a temporary stand-in for OpenSSL SupportsHash (until #1036 goes in), and the x/crypto fork includes some stdout-prints as a super simple way to tell that it's being reached.

@dagood dagood force-pushed the dev/dagood/xcryptoswap branch from 943b145 to 9c4f30a Compare September 26, 2023 23:51
@karianna
Copy link
Member

karianna commented Oct 1, 2024

@dagood - needs a rebase if we are keeping

@dagood
Copy link
Member Author

dagood commented Oct 7, 2024

Indeed. But to be clear, not planning to do that now: IMO, it's been long enough since I wrote this that it would be better to wait to fix it until we truly start working on it again.

@dagood
Copy link
Member Author

dagood commented Jul 7, 2025

I don't see any chance this approach will be necessary. Between upstream FIPS consolidating algorithms and some algorithms being moved into the stdlib regardless, I doubt we'll need to do swaps.

@dagood dagood closed this Jul 7, 2025
@dagood dagood deleted the dev/dagood/xcryptoswap branch July 7, 2025 17:35
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