Skip to content

Fix hash selection for ECDSA P-384 keys - #52

Open
stefan-andrejevic wants to merge 1 commit into
Gurux:masterfrom
stefan-andrejevic:fix/ecdsa-p384-hash-selection
Open

Fix hash selection for ECDSA P-384 keys#52
stefan-andrejevic wants to merge 1 commit into
Gurux:masterfrom
stefan-andrejevic:fix/ecdsa-p384-hash-selection

Conversation

@stefan-andrejevic

Copy link
Copy Markdown

Summary

Fix the hash algorithm selection for ECDSA P-384 keys.

The current implementation checks the P256 curve twice when selecting the hash algorithm for both signature generation and signature verification. As a result, the P384 branch is never reached.

Changes

  • Replace the duplicated P256 condition with P384
  • Use SHA-384 for ECDSA P-384 signing
  • Use SHA-384 for ECDSA P-384 signature verification

Why

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.

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

1 participant