mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-03 19:46:42 +00:00
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:
committed by
Manuel Pégourié-Gonnard
parent
b8025c5826
commit
a310c5e42b
@@ -124,6 +124,7 @@ int mbedtls_aead_chacha20_poly1305_starts( mbedtls_aead_chacha20_poly1305_contex
|
||||
* \param aad_len The length (in bytes) of the AAD. The length has no
|
||||
* restrictions.
|
||||
* \param aad Buffer containing the AAD.
|
||||
* This pointer can be NULL if aad_len == 0.
|
||||
*
|
||||
* \return MBEDTLS_ERR_AEAD_CHACHA20_POLY1305_BAD_INPUT_DATA is returned
|
||||
* if \p ctx or \p aad are NULL.
|
||||
@@ -151,7 +152,9 @@ int mbedtls_aead_chacha20_poly1305_update_aad( mbedtls_aead_chacha20_poly1305_co
|
||||
* \param ctx The ChaCha20-Poly1305 context.
|
||||
* \param len The length (in bytes) of the data to encrypt or decrypt.
|
||||
* \param input Buffer containing the data to encrypt or decrypt.
|
||||
* This pointer can be NULL if len == 0.
|
||||
* \param output Buffer to where the encrypted or decrypted data is written.
|
||||
* This pointer can be NULL if len == 0.
|
||||
*
|
||||
* \return MBEDTLS_ERR_AEAD_CHACHA20_POLY1305_BAD_INPUT_DATA is returned
|
||||
* if \p ctx, \p input, or \p output are NULL.
|
||||
@@ -195,9 +198,12 @@ int mbedtls_aead_chacha20_poly1305_finish( mbedtls_aead_chacha20_poly1305_contex
|
||||
* parameter does not matter.
|
||||
* \param aad_len The length (in bytes) of the AAD data to process.
|
||||
* \param aad Buffer containing the additional authenticated data (AAD).
|
||||
* This pointer can be NULL if aad_len == 0.
|
||||
* \param ilen The length (in bytes) of the data to encrypt or decrypt.
|
||||
* \param input Buffer containing the data to encrypt or decrypt.
|
||||
* This pointer can be NULL if ilen == 0.
|
||||
* \param output Buffer to where the encrypted or decrypted data is written.
|
||||
* This pointer can be NULL if ilen == 0.
|
||||
* \param mac Buffer to where the computed 128-bit (16 bytes) MAC is written.
|
||||
*
|
||||
* \return MBEDTLS_ERR_AEAD_CHACHA20_POLY1305_BAD_INPUT_DATA is returned
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -85,6 +85,7 @@ int mbedtls_poly1305_setkey( mbedtls_poly1305_context *ctx,
|
||||
* \param ctx The Poly1305 context.
|
||||
* \param ilen The input length (in bytes). Any value is accepted.
|
||||
* \param input Buffer containing the input data to Process.
|
||||
* This pointer can be NULL if ilen == 0.
|
||||
*
|
||||
* \return MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA is returned if ctx
|
||||
* or input are NULL.
|
||||
|
||||
Reference in New Issue
Block a user