@@ -2025,6 +2025,11 @@ int wc_ecc_ctx_set_info(ecEncCtx* ctx, const byte* info, int sz);
20252025 \param ctx Optional: pointer to an ecEncCtx object specifying different
20262026 encryption algorithms to use
20272027
2028+ \note Selecting an AES-GCM DEM algorithm (ecAES_128_GCM, ecAES_256_GCM) in
2029+ the default IV mode requires the WOLFSSL_ECIES_STATIC_GCM_NONCE build macro;
2030+ otherwise this function returns NOT_COMPILED_IN. See wc_ecc_encrypt_ex for
2031+ the full rationale.
2032+
20282033 _Example_
20292034 \code
20302035 byte msg[] = { initialize with msg to encrypt. Ensure padded to block size };
@@ -2072,6 +2077,9 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
20722077 small to store the encrypted ciphertext
20732078 \return MEMORY_E Returned if there is an error allocating memory
20742079 for the shared secret key
2080+ \return NOT_COMPILED_IN Returned if an AES-GCM DEM algorithm
2081+ (ecAES_128_GCM or ecAES_256_GCM) is requested in the default IV mode
2082+ without the WOLFSSL_ECIES_STATIC_GCM_NONCE build macro defined
20752083
20762084 \param privKey pointer to the ecc_key object containing the
20772085 private key to use for encryption
@@ -2088,6 +2096,16 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
20882096 encryption algorithms to use
20892097 \param compressed Public key field is to be output in compressed format.
20902098
2099+ \note The AES-GCM DEM algorithms (ecAES_128_GCM, ecAES_256_GCM) in the
2100+ default IV mode use a fixed all-zero GCM nonce. That is safe only because
2101+ ECIES derives a fresh symmetric key from a fresh ephemeral key on every
2102+ encryption, so the (key, nonce) pair never repeats; reusing the ephemeral
2103+ key is catastrophic for AES-GCM. For that reason the fixed-nonce GCM DEM is
2104+ off by default and must be enabled with the WOLFSSL_ECIES_STATIC_GCM_NONCE
2105+ build macro, otherwise this function returns NOT_COMPILED_IN for a GCM
2106+ algorithm. The macro is not needed with WOLFSSL_ECIES_GEN_IV (random
2107+ per-message nonce) or WOLFSSL_ECIES_OLD (nonce derived from the KDF output).
2108+
20912109 _Example_
20922110 \code
20932111 byte msg[] = { initialize with msg to encrypt. Ensure padded to block size };
@@ -2136,6 +2154,9 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
21362154 small to store the decrypted plaintext
21372155 \return MEMORY_E Returned if there is an error allocating memory
21382156 for the shared secret key
2157+ \return NOT_COMPILED_IN Returned if an AES-GCM DEM algorithm
2158+ (ecAES_128_GCM or ecAES_256_GCM) is requested in the default IV mode
2159+ without the WOLFSSL_ECIES_STATIC_GCM_NONCE build macro defined
21392160
21402161 \param privKey pointer to the ecc_key object containing the private
21412162 key to use for decryption
@@ -2150,6 +2171,11 @@ int wc_ecc_encrypt_ex(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
21502171 \param ctx Optional: pointer to an ecEncCtx object specifying
21512172 different decryption algorithms to use
21522173
2174+ \note Selecting an AES-GCM DEM algorithm (ecAES_128_GCM, ecAES_256_GCM) in
2175+ the default IV mode requires the WOLFSSL_ECIES_STATIC_GCM_NONCE build macro;
2176+ otherwise this function returns NOT_COMPILED_IN. See wc_ecc_encrypt_ex for
2177+ the full rationale.
2178+
21532179 _Example_
21542180 \code
21552181 byte cipher[] = { initialize with
0 commit comments