-
Notifications
You must be signed in to change notification settings - Fork 12
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
Make algorithms more robust to unsupported hashes #185
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I triggered the error by making the built-in default provider unavailable.
Is this a configuration that we can/should add to CI?
Co-authored-by: Davis Goodin <[email protected]>
@derekparker could someone from your team review this PR? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
While testing different provider configurations I found out that we are still panicking instead of returning an error in several places where the desired hash function is not supported by the OpenSSL provider.
This PR fixes all cases where we are calling a user-provided
func() hash.Hash
function that can panic, e.g. when callingopenssl.NewHMAC(openssl.NewSHA224, nil)
with a provider that doesn't support SHA224 (aka SymCrypt).Our azurelinux CI job hasn't triggered this situation because it is configured to use SymCrypt by default and fall back to the built-in default provider for algorithms that SymCrypt doesn't support. I triggered the error by making the built-in default provider unavailable. Anyway, I've added some tests so that we cover this situation with any provider configuration.