From c50dec07b29048fad532ff4b57e414ddb35e6593 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 10 Mar 2022 18:56:26 +0100 Subject: [PATCH] ChaCha20 (classic): Document that we only support 12-byte nonces Signed-off-by: Gilles Peskine --- include/mbedtls/cipher.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h index c04097dad3..9ce119576d 100644 --- a/include/mbedtls/cipher.h +++ b/include/mbedtls/cipher.h @@ -844,6 +844,12 @@ int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx, * \note Some ciphers do not use IVs nor nonce. For these * ciphers, this function has no effect. * + * \note For #MBEDTLS_CIPHER_CHACHA20, the nonce length must + * be 12, and the initial counter value is 0. + * + * \note For #MBEDTLS_CIPHER_CHACHA20_POLY1305, the nonce length + * must be 12. + * * \param ctx The generic cipher context. This must be initialized and * bound to a cipher information structure. * \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers. This