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/ctr_drbg.h b/include/mbedtls/ctr_drbg.h
index 4c24c04..151a899 100644
--- a/include/mbedtls/ctr_drbg.h
+++ b/include/mbedtls/ctr_drbg.h
@@ -16,10 +16,9 @@
  * The security strength as defined in NIST SP 800-90A is
  * 128 bits when AES-128 is used (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY enabled)
  * and 256 bits otherwise, provided that #MBEDTLS_CTR_DRBG_ENTROPY_LEN is
- * kept at its default value (and not overridden in mbedtls_config.h) and that the
- * DRBG instance is set up with default parameters.
- * See the documentation of mbedtls_ctr_drbg_seed() for more
- * information.
+ * kept at its default value (and not overridden in mbedtls_config.h) and that
+ * the DRBG instance is set up with default parameters. See the documentation of
+ * mbedtls_ctr_drbg_seed() for more information.
  */
 /*
  *  Copyright The Mbed TLS Contributors
@@ -47,30 +46,30 @@
 #include "mbedtls/aes.h"
 
 #if defined(MBEDTLS_THREADING_C)
-#include "mbedtls/threading.h"
+#    include "mbedtls/threading.h"
 #endif
 
 /** The entropy source failed. */
-#define MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED        -0x0034
+#define MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034
 /** The requested random buffer length is too big. */
-#define MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG              -0x0036
+#define MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036
 /** The input (entropy + additional data) is too large. */
-#define MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG                -0x0038
+#define MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038
 /** Read or write error in file. */
-#define MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR                -0x003A
+#define MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A
 
 /** The block size used by the cipher. */
-#define MBEDTLS_CTR_DRBG_BLOCKSIZE          16
+#define MBEDTLS_CTR_DRBG_BLOCKSIZE 16
 
 #if defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
-#define MBEDTLS_CTR_DRBG_KEYSIZE            16
+#    define MBEDTLS_CTR_DRBG_KEYSIZE 16
 /**< The key size in bytes used by the cipher.
  *
  * Compile-time choice: 16 bytes (128 bits)
  * because #MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled.
  */
 #else
-#define MBEDTLS_CTR_DRBG_KEYSIZE            32
+#    define MBEDTLS_CTR_DRBG_KEYSIZE 32
 /**< The key size in bytes used by the cipher.
  *
  * Compile-time choice: 32 bytes (256 bits)
@@ -78,15 +77,22 @@
  */
 #endif
 
-#define MBEDTLS_CTR_DRBG_KEYBITS            ( MBEDTLS_CTR_DRBG_KEYSIZE * 8 ) /**< The key size for the DRBG operation, in bits. */
-#define MBEDTLS_CTR_DRBG_SEEDLEN            ( MBEDTLS_CTR_DRBG_KEYSIZE + MBEDTLS_CTR_DRBG_BLOCKSIZE ) /**< The seed length, calculated as (counter + AES key). */
+#define MBEDTLS_CTR_DRBG_KEYBITS                                             \
+    (MBEDTLS_CTR_DRBG_KEYSIZE * 8) /**< The key size for the DRBG operation, \
+                                      in bits. */
+#define MBEDTLS_CTR_DRBG_SEEDLEN                                              \
+    (MBEDTLS_CTR_DRBG_KEYSIZE + MBEDTLS_CTR_DRBG_BLOCKSIZE) /**< The seed     \
+                                                               length,        \
+                                                               calculated as  \
+                                                               (counter + AES \
+                                                               key). */
 
 /**
  * \name SECTION: Module settings
  *
  * The configuration options you can set for this module are in this section.
- * Either change them in mbedtls_config.h or define them using the compiler command
- * line.
+ * Either change them in mbedtls_config.h or define them using the compiler
+ * command line.
  * \{
  */
 
@@ -95,52 +101,54 @@
  * \brief The amount of entropy used per seed by default, in bytes.
  */
 #if !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN)
-#if defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256)
+#    if defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256)
 /** This is 48 bytes because the entropy module uses SHA-512
  * (\c MBEDTLS_ENTROPY_FORCE_SHA256 is disabled).
  */
-#define MBEDTLS_CTR_DRBG_ENTROPY_LEN        48
+#        define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48
 
-#else /* defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */
+#    else /* defined(MBEDTLS_SHA512_C) && \
+             !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */
 
 /** This is 32 bytes because the entropy module uses SHA-256
  * (the SHA512 module is disabled or
  * \c MBEDTLS_ENTROPY_FORCE_SHA256 is enabled).
  */
-#if !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
+#        if !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY)
 /** \warning To achieve a 256-bit security strength, you must pass a nonce
  *           to mbedtls_ctr_drbg_seed().
  */
-#endif /* !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) */
-#define MBEDTLS_CTR_DRBG_ENTROPY_LEN        32
-#endif /* defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */
+#        endif /* !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) */
+#        define MBEDTLS_CTR_DRBG_ENTROPY_LEN 32
+#    endif /* defined(MBEDTLS_SHA512_C) && \
+              !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */
 #endif /* !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) */
 
 #if !defined(MBEDTLS_CTR_DRBG_RESEED_INTERVAL)
-#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL    10000
+#    define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000
 /**< The interval before reseed is performed by default. */
 #endif
 
 #if !defined(MBEDTLS_CTR_DRBG_MAX_INPUT)
-#define MBEDTLS_CTR_DRBG_MAX_INPUT          256
+#    define MBEDTLS_CTR_DRBG_MAX_INPUT 256
 /**< The maximum number of additional input Bytes. */
 #endif
 
 #if !defined(MBEDTLS_CTR_DRBG_MAX_REQUEST)
-#define MBEDTLS_CTR_DRBG_MAX_REQUEST        1024
+#    define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024
 /**< The maximum number of requested Bytes per call. */
 #endif
 
 #if !defined(MBEDTLS_CTR_DRBG_MAX_SEED_INPUT)
-#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT     384
+#    define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384
 /**< The maximum size of seed or reseed buffer in bytes. */
 #endif
 
 /* \} name SECTION: Module settings */
 
-#define MBEDTLS_CTR_DRBG_PR_OFF             0
+#define MBEDTLS_CTR_DRBG_PR_OFF 0
 /**< Prediction resistance is disabled. */
-#define MBEDTLS_CTR_DRBG_PR_ON              1
+#define MBEDTLS_CTR_DRBG_PR_ON 1
 /**< Prediction resistance is enabled. */
 
 #ifdef __cplusplus
@@ -154,7 +162,7 @@
  * to include a nonce.
  * See the documentation of mbedtls_ctr_drbg_seed() for more information.
  */
-#define MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN 0
+#    define MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN 0
 #else
 /** The default length of the nonce read from the entropy source.
  *
@@ -162,44 +170,47 @@
  * the entropy source does not provide enough material to form a nonce.
  * See the documentation of mbedtls_ctr_drbg_seed() for more information.
  */
-#define MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN ( MBEDTLS_CTR_DRBG_ENTROPY_LEN + 1 ) / 2
+#    define MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN \
+        (MBEDTLS_CTR_DRBG_ENTROPY_LEN + 1) / 2
 #endif
 
 /**
  * \brief          The CTR_DRBG context structure.
  */
-typedef struct mbedtls_ctr_drbg_context
-{
-    unsigned char MBEDTLS_PRIVATE(counter)[16];  /*!< The counter (V). */
-    int MBEDTLS_PRIVATE(reseed_counter);         /*!< The reseed counter.
-                                 * This is the number of requests that have
-                                 * been made since the last (re)seeding,
-                                 * minus one.
-                                 * Before the initial seeding, this field
-                                 * contains the amount of entropy in bytes
-                                 * to use as a nonce for the initial seeding,
-                                 * or -1 if no nonce length has been explicitly
-                                 * set (see mbedtls_ctr_drbg_set_nonce_len()).
-                                 */
-    int MBEDTLS_PRIVATE(prediction_resistance);  /*!< This determines whether prediction
-                                     resistance is enabled, that is
-                                     whether to systematically reseed before
-                                     each random generation. */
-    size_t MBEDTLS_PRIVATE(entropy_len);         /*!< The amount of entropy grabbed on each
-                                     seed or reseed operation, in bytes. */
-    int MBEDTLS_PRIVATE(reseed_interval);        /*!< The reseed interval.
-                                 * This is the maximum number of requests
-                                 * that can be made between reseedings. */
+typedef struct mbedtls_ctr_drbg_context {
+    unsigned char MBEDTLS_PRIVATE(counter)[16]; /*!< The counter (V). */
+    int MBEDTLS_PRIVATE(reseed_counter); /*!< The reseed counter.
+                                          * This is the number of requests that
+                                          * have been made since the last
+                                          * (re)seeding, minus one. Before the
+                                          * initial seeding, this field contains
+                                          * the amount of entropy in bytes to
+                                          * use as a nonce for the initial
+                                          * seeding, or -1 if no nonce length
+                                          * has been explicitly set (see
+                                          * mbedtls_ctr_drbg_set_nonce_len()).
+                                          */
+    int MBEDTLS_PRIVATE(prediction_resistance); /*!< This determines whether
+                                    prediction resistance is enabled, that is
+                                    whether to systematically reseed before
+                                    each random generation. */
+    size_t MBEDTLS_PRIVATE(entropy_len); /*!< The amount of entropy grabbed on
+                             each seed or reseed operation, in bytes. */
+    int MBEDTLS_PRIVATE(reseed_interval); /*!< The reseed interval.
+                                           * This is the maximum number of
+                                           * requests that can be made between
+                                           * reseedings. */
 
-    mbedtls_aes_context MBEDTLS_PRIVATE(aes_ctx);        /*!< The AES context. */
+    mbedtls_aes_context MBEDTLS_PRIVATE(aes_ctx); /*!< The AES context. */
 
     /*
      * Callbacks (Entropy)
      */
     int (*MBEDTLS_PRIVATE(f_entropy))(void *, unsigned char *, size_t);
-                                /*!< The entropy callback function. */
+    /*!< The entropy callback function. */
 
-    void *MBEDTLS_PRIVATE(p_entropy);            /*!< The context for the entropy function. */
+    void *MBEDTLS_PRIVATE(p_entropy); /*!< The context for the entropy function.
+                                       */
 
 #if defined(MBEDTLS_THREADING_C)
     /* Invariant: the mutex is initialized if and only if f_entropy != NULL.
@@ -211,8 +222,7 @@
      */
     mbedtls_threading_mutex_t MBEDTLS_PRIVATE(mutex);
 #endif
-}
-mbedtls_ctr_drbg_context;
+} mbedtls_ctr_drbg_context;
 
 /**
  * \brief               This function initializes the CTR_DRBG context,
@@ -226,7 +236,7 @@
  *
  * \param ctx           The CTR_DRBG context to initialize.
  */
-void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx );
+void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx);
 
 /**
  * \brief               This function seeds and sets up the CTR_DRBG
@@ -327,11 +337,11 @@
  * \return              \c 0 on success.
  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure.
  */
-int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *ctx,
-                   int (*f_entropy)(void *, unsigned char *, size_t),
-                   void *p_entropy,
-                   const unsigned char *custom,
-                   size_t len );
+int mbedtls_ctr_drbg_seed(mbedtls_ctr_drbg_context *ctx,
+                          int (*f_entropy)(void *, unsigned char *, size_t),
+                          void *p_entropy,
+                          const unsigned char *custom,
+                          size_t len);
 
 /**
  * \brief               This function resets CTR_DRBG context to the state immediately
@@ -339,7 +349,7 @@
  *
  * \param ctx           The CTR_DRBG context to clear.
  */
-void mbedtls_ctr_drbg_free( mbedtls_ctr_drbg_context *ctx );
+void mbedtls_ctr_drbg_free(mbedtls_ctr_drbg_context *ctx);
 
 /**
  * \brief               This function turns prediction resistance on or off.
@@ -354,8 +364,8 @@
  * \param ctx           The CTR_DRBG context.
  * \param resistance    #MBEDTLS_CTR_DRBG_PR_ON or #MBEDTLS_CTR_DRBG_PR_OFF.
  */
-void mbedtls_ctr_drbg_set_prediction_resistance( mbedtls_ctr_drbg_context *ctx,
-                                         int resistance );
+void mbedtls_ctr_drbg_set_prediction_resistance(mbedtls_ctr_drbg_context *ctx,
+                                                int resistance);
 
 /**
  * \brief               This function sets the amount of entropy grabbed on each
@@ -381,8 +391,8 @@
  *                      and at most the maximum length accepted by the
  *                      entropy function that is set in the context.
  */
-void mbedtls_ctr_drbg_set_entropy_len( mbedtls_ctr_drbg_context *ctx,
-                               size_t len );
+void mbedtls_ctr_drbg_set_entropy_len(mbedtls_ctr_drbg_context *ctx,
+                                      size_t len);
 
 /**
  * \brief               This function sets the amount of entropy grabbed
@@ -403,8 +413,7 @@
  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
  *                      if the initial seeding has already taken place.
  */
-int mbedtls_ctr_drbg_set_nonce_len( mbedtls_ctr_drbg_context *ctx,
-                                    size_t len );
+int mbedtls_ctr_drbg_set_nonce_len(mbedtls_ctr_drbg_context *ctx, size_t len);
 
 /**
  * \brief               This function sets the reseed interval.
@@ -418,8 +427,8 @@
  * \param ctx           The CTR_DRBG context.
  * \param interval      The reseed interval.
  */
-void mbedtls_ctr_drbg_set_reseed_interval( mbedtls_ctr_drbg_context *ctx,
-                                   int interval );
+void mbedtls_ctr_drbg_set_reseed_interval(mbedtls_ctr_drbg_context *ctx,
+                                          int interval);
 
 /**
  * \brief               This function reseeds the CTR_DRBG context, that is
@@ -441,8 +450,9 @@
  * \return              \c 0 on success.
  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure.
  */
-int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx,
-                     const unsigned char *additional, size_t len );
+int mbedtls_ctr_drbg_reseed(mbedtls_ctr_drbg_context *ctx,
+                            const unsigned char *additional,
+                            size_t len);
 
 /**
  * \brief              This function updates the state of the CTR_DRBG context.
@@ -464,9 +474,9 @@
  *                     #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT.
  * \return             An error from the underlying AES cipher on failure.
  */
-int mbedtls_ctr_drbg_update( mbedtls_ctr_drbg_context *ctx,
-                             const unsigned char *additional,
-                             size_t add_len );
+int mbedtls_ctr_drbg_update(mbedtls_ctr_drbg_context *ctx,
+                            const unsigned char *additional,
+                            size_t add_len);
 
 /**
  * \brief   This function updates a CTR_DRBG instance with additional
@@ -499,9 +509,11 @@
  * \return    #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or
  *            #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure.
  */
-int mbedtls_ctr_drbg_random_with_add( void *p_rng,
-                              unsigned char *output, size_t output_len,
-                              const unsigned char *additional, size_t add_len );
+int mbedtls_ctr_drbg_random_with_add(void *p_rng,
+                                     unsigned char *output,
+                                     size_t output_len,
+                                     const unsigned char *additional,
+                                     size_t add_len);
 
 /**
  * \brief   This function uses CTR_DRBG to generate random data.
@@ -527,8 +539,9 @@
  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or
  *                      #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure.
  */
-int mbedtls_ctr_drbg_random( void *p_rng,
-                     unsigned char *output, size_t output_len );
+int mbedtls_ctr_drbg_random(void *p_rng,
+                            unsigned char *output,
+                            size_t output_len);
 
 #if defined(MBEDTLS_FS_IO)
 /**
@@ -542,7 +555,8 @@
  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on reseed
  *                      failure.
  */
-int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path );
+int mbedtls_ctr_drbg_write_seed_file(mbedtls_ctr_drbg_context *ctx,
+                                     const char *path);
 
 /**
  * \brief               This function reads and updates a seed file. The seed
@@ -558,7 +572,8 @@
  * \return              #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG if the existing
  *                      seed file is too large.
  */
-int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path );
+int mbedtls_ctr_drbg_update_seed_file(mbedtls_ctr_drbg_context *ctx,
+                                      const char *path);
 #endif /* MBEDTLS_FS_IO */
 
 #if defined(MBEDTLS_SELF_TEST)
@@ -569,7 +584,7 @@
  * \return              \c 0 on success.
  * \return              \c 1 on failure.
  */
-int mbedtls_ctr_drbg_self_test( int verbose );
+int mbedtls_ctr_drbg_self_test(int verbose);
 
 #endif /* MBEDTLS_SELF_TEST */