Allow some parameters to be NULL if the length is 0.

This change permits users of the ChaCha20/Poly1305 algorithms
(and the AEAD construction thereof) to pass NULL pointers for
data that they do not need, and avoids the need to provide a valid
buffer for data that is not used.
This commit is contained in:
Daniel King 2016-05-17 15:56:26 -03:00 committed by Manuel Pégourié-Gonnard
parent b8025c5826
commit a310c5e42b
6 changed files with 33 additions and 4 deletions

View file

@ -136,7 +136,9 @@ int mbedtls_chacha20_keystream_block( const mbedtls_chacha20_context *ctx,
* \param ctx The ChaCha20 context.
* \param size The length (in bytes) to process. This can have any length.
* \param input Buffer containing the input data.
* This pointer can be NULL if size == 0.
* \param output Buffer containing the output data.
* This pointer can be NULL if size == 0.
*
* \return MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA if the ctx, input, or
* output pointers are NULL.