Skip to content

Fix wolfCLU_sign_data_ecc and wolfCLU_verify_signature_ecc#219

Open
embhorn wants to merge 3 commits intowolfSSL:mainfrom
embhorn:zd21558
Open

Fix wolfCLU_sign_data_ecc and wolfCLU_verify_signature_ecc#219
embhorn wants to merge 3 commits intowolfSSL:mainfrom
embhorn:zd21558

Conversation

@embhorn
Copy link
Copy Markdown
Member

@embhorn embhorn commented Apr 7, 2026

src/sign-verify/clu_sign.c — wolfCLU_sign_data_ecc():
Before calling wc_ecc_sign_hash(), the input data is now hashed with a curve-appropriate algorithm (SHA-256 for P-256, SHA-384 for P-384, SHA-512 for P-521+). The digest is passed to wc_ecc_sign_hash() instead of the raw file contents.

src/sign-verify/clu_verify.c — wolfCLU_verify_signature_ecc() :
Same treatment — the raw message is hashed before being passed to wc_ecc_verify_hash(), using the same curve-size-based hash selection so sign and verify are consistent.

Fix some build errors with clang

@embhorn embhorn self-assigned this Apr 7, 2026
Copilot AI review requested due to automatic review settings April 7, 2026 20:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates ECC signing and verification to hash the input message before calling wolfSSL’s ECDSA APIs, ensuring the functions operate on a digest rather than raw data and that sign/verify use consistent hashing by curve size.

Changes:

  • Hash message input in wolfCLU_sign_data_ecc() before calling wc_ecc_sign_hash().
  • Hash message input in wolfCLU_verify_signature_ecc() before calling wc_ecc_verify_hash().
  • Select SHA-256/SHA-384/SHA-512 based on ECC key size for consistent sign/verify behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/sign-verify/clu_sign.c Hashes input data prior to ECDSA signing and selects hash algorithm based on curve size.
src/sign-verify/clu_verify.c Hashes input data prior to ECDSA verification and mirrors the signing hash selection logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings April 7, 2026 20:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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