Add xcryptobackendswap, implement x/crypto SHA3 using backend #1043
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.
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 innobackend.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 OpenSSLSupportsHash
(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.