Skip to content

Sign ECDSA without ASN and add an external-signer-only build - #95

Merged
dgarske merged 1 commit into
wolfSSL:mainfrom
aidangarske:ecdsa-sign-no-asn
Nov 16, 2026
Merged

dgarske merged 1 commit into
wolfSSL:mainfrom
aidangarske:ecdsa-sign-no-asn

Conversation

@aidangarske

@aidangarske aidangarske commented Nov 13, 2026 •

Copy link
Copy Markdown
Member
  • ECDSA signing required wolfSSL ASN: settings.h stopped the build with NO_ASN and a signing op enabled.
  • With NO_ASN, wolfCrypt already returns fixed-width r||s, so wolfCOSE now copies it out and skips the DER conversion; ASN builds are unchanged.
  • New WOLFCOSE_NO_LOCAL_SIGN (off by default, needs WOLFCOSE_ENABLE_EXT_SIGN) compiles out every local wolfCrypt signing call, so only the external signer signs.
  • Under WOLFCOSE_NO_LOCAL_SIGN a key without a signer is refused with WOLFCOSE_E_COSE_KEY_TYPE, no RNG is required, and deterministic ECDSA needs no backend support.
  • Default builds are unchanged; both options are documented in docs/Macros.md.
  • New tests: a deterministic ES256 known-answer vector, and tests/test_no_local_sign.c covering Sign1, Sign and countersignatures through the callback, refusal of local keys, and an nm check that no signing primitive is linked.
  • CI: a NO_ASN job in lean-build.yml, two strict lean configurations, a policy case, and the external-signer-only build in c99-check.

needed for wolfSSL/wolfTrust#85

@aidangarske aidangarske self-assigned this Nov 13, 2026
Copilot AI balanced review requested due to automatic review settings November 13, 2026 23:47

Copilot AI left a comment

Copy link
Copy Markdown

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 block the NO_ASN and external-signer-only changes.

No open issues 🎉

What changed in this PR

This PR enables ECDSA signing without ASN support and adds an opt-in external-signer-only mode to wolfCOSE, supporting lean deployments while preserving default build behavior.

Changes:

  • Use wolfCrypt’s raw r || s signatures directly in NO_ASN builds.
  • Add WOLFCOSE_NO_LOCAL_SIGN to compile out local signing, require signer callbacks, and remove local RNG and deterministic-signing requirements.
  • Add known-answer and external-signer tests, build checks, CI configurations, and documentation.
File Description
tests/​test_no_local_sign.c Tests callback signing, verification, and rejection of local keys.
tests/​test_eat_psa.c Rejects external-signer-only builds for the local-signing suite.
tests/​test_cose.c Adds an ES256 known-answer test and adjusts configuration guards.
tests/​test_cose_examples.c Uses an ECC key import compatible with NO_ASN.
src/​wolfcose_sign1.c Compiles out local Sign1 signing and its RNG requirement.
src/​wolfcose_sign.c Compiles out local multi-signature signing and its RNG requirement.
src/​wolfcose_key.c Requires a callback for signing capability in external-only builds.
src/​wolfcose_internal.h Gates the local ECDSA helper and documents raw-signature support.
src/​wolfcose_ecc.c Handles raw NO_ASN signatures and gates local ECDSA signing.
src/​wolfcose_countersign.c Compiles out local countersigning and its RNG requirement.
Makefile Adds external-only tests, symbol checks, and policy/C99 checks.
include/​wolfcose/​settings.h Allows NO_ASN signing and validates external-only configuration.
docs/​Macros.md Documents both build options and their behavior.
.gitignore Ignores the new external-only test executable.
.github/​workflows/​lean-build.yml Adds NO_ASN and external-signer-only CI coverage.

Review effort: Balanced

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested 4706c80 locally; no issues found.

  • wolfSSL v5.9.4 and current master, both NO_ASN: make test (including the ES256 known-answer vector), ext-sign-test and no-local-sign-test pass, and no object references wc_ecc_sig_to_rs or wc_ecc_rs_raw_to_sig.
  • ESP256, ESP384 and ESP512 with deterministic k give byte-identical COSE_Sign1 output from NO_ASN and ASN builds, cross-verify both ways, and verify independently in Python.
  • wolfCose_EccSignRaw with a coordinate size that does not match the key returns WOLFCOSE_E_CRYPTO on both wolfSSL versions and leaves the output untouched (ASan/UBSan clean).
  • The default build, ASan/UBSan, c99-check, ecdsa-policy-test and the new Ed25519 external-signer cases pass.

Thanks for picking up the comment, docs and Ed25519 test.

@dgarske
dgarske merged commit 5aeaac0 into wolfSSL:main Nov 16, 2026
87 checks passed
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.

4 participants