ChaCha20: allow in-place en/decryption

All other ciphers so far allow this. In particular, the TLS layer depends on
this, despite what's documented in the Cipher layer, see
https://github.com/ARMmbed/mbedtls/issues/1085
https://github.com/ARMmbed/mbedtls/issues/1087

Also, this can be useful for implementing chachapoly without depending on the
semi-internal function keystream_block(), see next commit.
This commit is contained in:
Manuel Pégourié-Gonnard 2018-05-07 11:57:05 +02:00
parent dca3a5d884
commit 502f189253
2 changed files with 15 additions and 17 deletions

View file

@ -133,9 +133,8 @@ int mbedtls_chacha20_keystream_block( const mbedtls_chacha20_context *ctx,
*
* This function is used to both encrypt and decrypt data.
*
* \note The \p input and \p output buffers may overlap, but only
* if input >= output (i.e. only if input points ahead of
* the output pointer).
* \note The \p input and \p output pointers must either be equal or
* point to non-overlapping buffers.
*
* \note mbedtls_chacha20_setkey and mbedtls_chacha20_starts must be
* called at least once to setup the context before this function