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.
In #161 I refactored our hash implementations to only implement the
encoding.BinaryMarshaler
interface when using the built-in providers. This raises a new problem, as the standard library uses that interface to clone a hash when doing a TLS 1.3 handshake: https://github.com/golang/go/blob/2707d42966f8985a6663c93e943b9a44b9399fca/src/crypto/tls/handshake_server_tls13.go#L436.The issue can be fixed by providing a
Clone
method that is not provider-dependent and patch the standard library to use that instead. In fact, we are already following this approach with the Windows CNG backend in the Microsoft Go fork: https://github.com/microsoft/go/blob/294feac5a41d50e2ef261d6acca9feb017f873d0/patches/0005-Add-CNG-crypto-backend.patch#L1061-L1069. I plan to also use this newClone
method for the OpenSSL backend.While here, refactor the hash tests so they are a bit more atomic.