From 9597255499d0885dc1b51d3efeaa7f481b168226 Mon Sep 17 00:00:00 2001 From: Mark Atwood Date: Thu, 6 Aug 2026 11:34:06 -0700 Subject: [PATCH] Document that raw ECC import does not validate 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. --- doc/dox_comments/header_files/ecc.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/dox_comments/header_files/ecc.h b/doc/dox_comments/header_files/ecc.h index 2bc782e3eb9..74c700321d5 100644 --- a/doc/dox_comments/header_files/ecc.h +++ b/doc/dox_comments/header_files/ecc.h @@ -1453,7 +1453,11 @@ int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen); \ingroup ECC \brief This function fills an ecc_key structure with the raw components - of an ECC signature. + of an ECC key. + + \note This function does not check that the imported public point lies on + the curve. Define WOLFSSL_VALIDATE_ECC_IMPORT to validate the point on + import, or call wc_ecc_check_key before the key is used. \return 0 Returned upon successfully importing into the ecc_key structure \return ECC_BAD_ARG_E Returned if any of the input values evaluate to NULL @@ -3038,6 +3042,10 @@ int wc_ecc_sig_to_rs(const byte* sig, word32 sigLen, byte* r, \ingroup ECC \brief Imports raw key with curve ID. + \note This function does not check that the imported public point lies on + the curve. Define WOLFSSL_VALIDATE_ECC_IMPORT to validate the point on + import, or call wc_ecc_check_key before the key is used. + \return 0 on success \return negative on error @@ -3063,6 +3071,10 @@ int wc_ecc_import_raw_ex(ecc_key* key, const char* qx, \ingroup ECC \brief Imports unsigned key with curve ID. + \note This function does not check that the imported public point lies on + the curve. Define WOLFSSL_VALIDATE_ECC_IMPORT to validate the point on + import, or call wc_ecc_check_key before the key is used. + \return 0 on success \return negative on error