Skip to content

PSA: zero extend r and s in ECC verify callback - #12401

Open
padelsbach wants to merge 1 commit into
wolfSSL:masterfrom
padelsbach:psa-ecc-verify
Open

padelsbach wants to merge 1 commit into
wolfSSL:masterfrom
padelsbach:psa-ecc-verify

Conversation

@padelsbach

Copy link
Copy Markdown
Contributor

Description

Fixes F-7430

Fixes an occasional failure seen in CI. psa_ecc_verify_cb builds the signature by joining r and s with leading zeros removed. PSA expects r and s to be padded to the curve size, so when either has a leading zero, the sig is rejected (about 1 in 128).

Change is to zero extend/append each value to the curve size.

Testing

New unit tests

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copilot AI balanced review requested due to automatic review settings December 4, 2026 06:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the PSA ECDSA signature-padding change.

No open issues 🎉

What changed in this PR

Fixes intermittent PSA ECDSA verification failures by padding signature components to the curve size, addressing F-7430.

Changes:

  • Zero-pads r and s before passing signatures to PSA.
  • Adds regression tests for short components, an incorrect digest, and an oversized component.
File Description
wolfcrypt/​src/​port/​psa/​psa_pkcbs.c Returns the curve size and uses it to pad signature components.
tests/​api/​test_ssl_pk.h Registers the PSA verification test.
tests/​api/​test_ssl_pk.c Adds signature-padding and rejection test cases.

Review effort: Balanced

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +140 B, text +14,496 B (+5.2%, 297,108 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

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.

3 participants