Apply clang formatting.
Executed with:
`find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 clang-format-12 -i`
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/include/mbedtls/chacha20.h b/include/mbedtls/chacha20.h
index 8af16ed..dd5c7bf 100644
--- a/include/mbedtls/chacha20.h
+++ b/include/mbedtls/chacha20.h
@@ -39,7 +39,7 @@
#include <stddef.h>
/** Invalid input parameter(s). */
-#define MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA -0x0051
+#define MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA -0x0051
#ifdef __cplusplus
extern "C" {
@@ -47,16 +47,16 @@
#if !defined(MBEDTLS_CHACHA20_ALT)
-typedef struct mbedtls_chacha20_context
-{
- uint32_t MBEDTLS_PRIVATE(state)[16]; /*! The state (before round operations). */
- uint8_t MBEDTLS_PRIVATE(keystream8)[64]; /*! Leftover keystream bytes. */
- size_t MBEDTLS_PRIVATE(keystream_bytes_used); /*! Number of keystream bytes already used. */
-}
-mbedtls_chacha20_context;
+typedef struct mbedtls_chacha20_context {
+ uint32_t MBEDTLS_PRIVATE(state)[16]; /*! The state (before round
+ operations). */
+ uint8_t MBEDTLS_PRIVATE(keystream8)[64]; /*! Leftover keystream bytes. */
+ size_t MBEDTLS_PRIVATE(keystream_bytes_used); /*! Number of keystream bytes
+ already used. */
+} mbedtls_chacha20_context;
-#else /* MBEDTLS_CHACHA20_ALT */
-#include "chacha20_alt.h"
+#else /* MBEDTLS_CHACHA20_ALT */
+# include "chacha20_alt.h"
#endif /* MBEDTLS_CHACHA20_ALT */
/**
@@ -74,7 +74,7 @@
* \param ctx The ChaCha20 context to initialize.
* This must not be \c NULL.
*/
-void mbedtls_chacha20_init( mbedtls_chacha20_context *ctx );
+void mbedtls_chacha20_init(mbedtls_chacha20_context *ctx);
/**
* \brief This function releases and clears the specified
@@ -85,7 +85,7 @@
* \c NULL, it must point to an initialized context.
*
*/
-void mbedtls_chacha20_free( mbedtls_chacha20_context *ctx );
+void mbedtls_chacha20_free(mbedtls_chacha20_context *ctx);
/**
* \brief This function sets the encryption/decryption key.
@@ -103,8 +103,8 @@
* \return \c 0 on success.
* \return #MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA if ctx or key is NULL.
*/
-int mbedtls_chacha20_setkey( mbedtls_chacha20_context *ctx,
- const unsigned char key[32] );
+int mbedtls_chacha20_setkey(mbedtls_chacha20_context *ctx,
+ const unsigned char key[32]);
/**
* \brief This function sets the nonce and initial counter value.
@@ -125,9 +125,9 @@
* \return #MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA if ctx or nonce is
* NULL.
*/
-int mbedtls_chacha20_starts( mbedtls_chacha20_context* ctx,
- const unsigned char nonce[12],
- uint32_t counter );
+int mbedtls_chacha20_starts(mbedtls_chacha20_context *ctx,
+ const unsigned char nonce[12],
+ uint32_t counter);
/**
* \brief This function encrypts or decrypts data.
@@ -158,10 +158,10 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_chacha20_update( mbedtls_chacha20_context *ctx,
- size_t size,
- const unsigned char *input,
- unsigned char *output );
+int mbedtls_chacha20_update(mbedtls_chacha20_context *ctx,
+ size_t size,
+ const unsigned char *input,
+ unsigned char *output);
/**
* \brief This function encrypts or decrypts data with ChaCha20 and
@@ -191,12 +191,12 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_chacha20_crypt( const unsigned char key[32],
- const unsigned char nonce[12],
- uint32_t counter,
- size_t size,
- const unsigned char* input,
- unsigned char* output );
+int mbedtls_chacha20_crypt(const unsigned char key[32],
+ const unsigned char nonce[12],
+ uint32_t counter,
+ size_t size,
+ const unsigned char *input,
+ unsigned char *output);
#if defined(MBEDTLS_SELF_TEST)
/**
@@ -205,7 +205,7 @@
* \return \c 0 on success.
* \return \c 1 on failure.
*/
-int mbedtls_chacha20_self_test( int verbose );
+int mbedtls_chacha20_self_test(int verbose);
#endif /* MBEDTLS_SELF_TEST */
#ifdef __cplusplus