Skip to content
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

Add xcryptobackendswap, implement x/crypto SHA3 using backend #1043

Draft
wants to merge 10 commits into
base: microsoft/main
Choose a base branch
from

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.

@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.

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.

2 participants