Fix hash selection for ECDSA P-384 keys - #52
Open
stefan-andrejevic wants to merge 1 commit into
Open
Conversation
Select the correct hash algorithm when generating and verifying ECDSA signatures. The previous implementation checked the P-256 curve twice, making the SHA-384 branch unreachable. Replace the duplicated P-256 condition with P-384 so that P-384 keys use SHA-384 as required by the ECDSA specification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix the hash algorithm selection for ECDSA P-384 keys.
The current implementation checks the
P256curve twice when selecting the hash algorithm for both signature generation and signature verification. As a result, theP384branch is never reached.Changes
P256condition withP384SHA-384for ECDSA P-384 signingSHA-384for ECDSA P-384 signature verificationWhy
According to the ECDSA specification, the hash algorithm should match the selected curve. This change ensures that P-384 keys use SHA-384 during both signing and verification.