Skip to content

Document that raw ECC import does not validate the point - #11099

Open
MarkAtwood wants to merge 1 commit into
wolfSSL:masterfrom
MarkAtwood:doc/ecc-import-raw-validation
Open

Document that raw ECC import does not validate the point#11099
MarkAtwood wants to merge 1 commit into
wolfSSL:masterfrom
MarkAtwood:doc/ecc-import-raw-validation

Conversation

@MarkAtwood

Copy link
Copy Markdown
Contributor

Description

wc_ecc_import_raw, wc_ecc_import_raw_ex and wc_ecc_import_unsigned all reach wc_ecc_import_raw_private, which validates that the imported public point lies on the curve only when WOLFSSL_VALIDATE_ECC_IMPORT is defined (wolfcrypt/src/ecc.c). That flag is off in default builds and set in FIPS builds.

The x963 and ASN.1 import paths validate unconditionally, so the raw importers are the one public entry point where the caller has to know to validate. Neither the function names nor the existing documentation said so. This adds a \note to each of the three saying the check is not performed, and pointing at both ways to get it.

Documentation only. No functional change, no behavior change, no ABI change.

This is a documentation change rather than a code change on purpose. Raw import is trusted-input-only by design, which is the intended contract; the gap was that the contract was not written down anywhere a caller would see it.

Pre-existing issue corrected in the same block

The \brief for wc_ecc_import_raw described the function as filling an ecc_key with "the raw components of an ECC signature". It fills it with the components of a key. Corrected here since it is the same doc block. Happy to drop that hunk if you would rather keep this to a single concern.

Testing

Documentation only, so no test changes. The touched file is doc/dox_comments/header_files/ecc.h, which is Doxygen input and is not compiled.

Checklist

  • added tests: N/A, documentation only
  • added documentation
  • ChangeLog entry: omitted, no user-visible behavior change

wc_ecc_import_raw, wc_ecc_import_raw_ex and wc_ecc_import_unsigned all
reach wc_ecc_import_raw_private, which only checks that the imported
public point lies on the curve when WOLFSSL_VALIDATE_ECC_IMPORT is
defined. That flag is off in default builds and set in FIPS builds. The
x963 and ASN.1 import paths validate unconditionally, so the raw
importers are the one public entry point where a caller has to know to
validate. Nothing in the name or the existing documentation said so.

Also corrects the brief for wc_ecc_import_raw, which described the
function as filling a key with the components of a signature.
@MarkAtwood
MarkAtwood requested review from JacobBarthelmeh and a lite review from Copilot August 6, 2026 18:34

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.

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