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/ecdh.h b/include/mbedtls/ecdh.h
index 7fa7440..d1d8484 100644
--- a/include/mbedtls/ecdh.h
+++ b/include/mbedtls/ecdh.h
@@ -51,14 +51,14 @@
  */
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
-#define MBEDTLS_ECDH_LEGACY_CONTEXT
+#    define MBEDTLS_ECDH_LEGACY_CONTEXT
 #else
-#undef MBEDTLS_ECDH_LEGACY_CONTEXT
+#    undef MBEDTLS_ECDH_LEGACY_CONTEXT
 #endif
 
 #if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
-#undef MBEDTLS_ECDH_LEGACY_CONTEXT
-#include "everest/everest.h"
+#    undef MBEDTLS_ECDH_LEGACY_CONTEXT
+#    include "everest/everest.h"
 #endif
 
 #ifdef __cplusplus
@@ -70,7 +70,7 @@
  */
 typedef enum
 {
-    MBEDTLS_ECDH_OURS,   /**< Our key. */
+    MBEDTLS_ECDH_OURS, /**< Our key. */
     MBEDTLS_ECDH_THEIRS, /**< The key of the peer. */
 } mbedtls_ecdh_side;
 
@@ -83,11 +83,12 @@
  */
 typedef enum
 {
-    MBEDTLS_ECDH_VARIANT_NONE = 0,   /*!< Implementation not defined. */
-    MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0,/*!< The default Mbed TLS implementation */
-#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
-    MBEDTLS_ECDH_VARIANT_EVEREST     /*!< Everest implementation */
-#endif
+    MBEDTLS_ECDH_VARIANT_NONE = 0, /*!< Implementation not defined. */
+    MBEDTLS_ECDH_VARIANT_MBEDTLS_2_0, /*!< The default Mbed TLS implementation
+                                       */
+#    if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
+    MBEDTLS_ECDH_VARIANT_EVEREST /*!< Everest implementation */
+#    endif
 } mbedtls_ecdh_variant;
 
 /**
@@ -97,16 +98,17 @@
  * should not make any assumptions about the structure of
  * mbedtls_ecdh_context_mbed.
  */
-typedef struct mbedtls_ecdh_context_mbed
-{
-    mbedtls_ecp_group MBEDTLS_PRIVATE(grp);   /*!< The elliptic curve used. */
-    mbedtls_mpi MBEDTLS_PRIVATE(d);           /*!< The private key. */
-    mbedtls_ecp_point MBEDTLS_PRIVATE(Q);     /*!< The public key. */
-    mbedtls_ecp_point MBEDTLS_PRIVATE(Qp);    /*!< The value of the public key of the peer. */
-    mbedtls_mpi MBEDTLS_PRIVATE(z);           /*!< The shared secret. */
-#if defined(MBEDTLS_ECP_RESTARTABLE)
-    mbedtls_ecp_restart_ctx MBEDTLS_PRIVATE(rs); /*!< The restart context for EC computations. */
-#endif
+typedef struct mbedtls_ecdh_context_mbed {
+    mbedtls_ecp_group MBEDTLS_PRIVATE(grp); /*!< The elliptic curve used. */
+    mbedtls_mpi MBEDTLS_PRIVATE(d); /*!< The private key. */
+    mbedtls_ecp_point MBEDTLS_PRIVATE(Q); /*!< The public key. */
+    mbedtls_ecp_point MBEDTLS_PRIVATE(Qp); /*!< The value of the public key of
+                                              the peer. */
+    mbedtls_mpi MBEDTLS_PRIVATE(z); /*!< The shared secret. */
+#    if defined(MBEDTLS_ECP_RESTARTABLE)
+    mbedtls_ecp_restart_ctx MBEDTLS_PRIVATE(rs); /*!< The restart context for EC
+                                                    computations. */
+#    endif
 } mbedtls_ecdh_context_mbed;
 #endif
 
@@ -117,46 +119,49 @@
  *                  should not be shared between multiple threads.
  * \brief           The ECDH context structure.
  */
-typedef struct mbedtls_ecdh_context
-{
+typedef struct mbedtls_ecdh_context {
 #if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
-    mbedtls_ecp_group MBEDTLS_PRIVATE(grp);   /*!< The elliptic curve used. */
-    mbedtls_mpi MBEDTLS_PRIVATE(d);           /*!< The private key. */
-    mbedtls_ecp_point MBEDTLS_PRIVATE(Q);     /*!< The public key. */
-    mbedtls_ecp_point MBEDTLS_PRIVATE(Qp);    /*!< The value of the public key of the peer. */
-    mbedtls_mpi MBEDTLS_PRIVATE(z);           /*!< The shared secret. */
-    int MBEDTLS_PRIVATE(point_format);        /*!< The format of point export in TLS messages. */
-    mbedtls_ecp_point MBEDTLS_PRIVATE(Vi);    /*!< The blinding value. */
-    mbedtls_ecp_point MBEDTLS_PRIVATE(Vf);    /*!< The unblinding value. */
-    mbedtls_mpi MBEDTLS_PRIVATE(_d);          /*!< The previous \p d. */
-#if defined(MBEDTLS_ECP_RESTARTABLE)
-    int MBEDTLS_PRIVATE(restart_enabled);        /*!< The flag for restartable mode. */
-    mbedtls_ecp_restart_ctx MBEDTLS_PRIVATE(rs); /*!< The restart context for EC computations. */
-#endif /* MBEDTLS_ECP_RESTARTABLE */
+    mbedtls_ecp_group MBEDTLS_PRIVATE(grp); /*!< The elliptic curve used. */
+    mbedtls_mpi MBEDTLS_PRIVATE(d); /*!< The private key. */
+    mbedtls_ecp_point MBEDTLS_PRIVATE(Q); /*!< The public key. */
+    mbedtls_ecp_point MBEDTLS_PRIVATE(Qp); /*!< The value of the public key of
+                                              the peer. */
+    mbedtls_mpi MBEDTLS_PRIVATE(z); /*!< The shared secret. */
+    int MBEDTLS_PRIVATE(point_format); /*!< The format of point export in TLS
+                                          messages. */
+    mbedtls_ecp_point MBEDTLS_PRIVATE(Vi); /*!< The blinding value. */
+    mbedtls_ecp_point MBEDTLS_PRIVATE(Vf); /*!< The unblinding value. */
+    mbedtls_mpi MBEDTLS_PRIVATE(_d); /*!< The previous \p d. */
+#    if defined(MBEDTLS_ECP_RESTARTABLE)
+    int MBEDTLS_PRIVATE(restart_enabled); /*!< The flag for restartable mode. */
+    mbedtls_ecp_restart_ctx MBEDTLS_PRIVATE(rs); /*!< The restart context for EC
+                                                    computations. */
+#    endif /* MBEDTLS_ECP_RESTARTABLE */
 #else
-    uint8_t MBEDTLS_PRIVATE(point_format);       /*!< The format of point export in TLS messages
-                                  as defined in RFC 4492. */
-    mbedtls_ecp_group_id MBEDTLS_PRIVATE(grp_id);/*!< The elliptic curve used. */
-    mbedtls_ecdh_variant MBEDTLS_PRIVATE(var);   /*!< The ECDH implementation/structure used. */
-    union
-    {
-        mbedtls_ecdh_context_mbed   MBEDTLS_PRIVATE(mbed_ecdh);
-#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
+    uint8_t MBEDTLS_PRIVATE(point_format); /*!< The format of point export in
+                            TLS messages as defined in RFC 4492. */
+    mbedtls_ecp_group_id MBEDTLS_PRIVATE(grp_id); /*!< The elliptic curve used.
+                                                   */
+    mbedtls_ecdh_variant MBEDTLS_PRIVATE(var); /*!< The ECDH
+                                                  implementation/structure used.
+                                                */
+    union {
+        mbedtls_ecdh_context_mbed MBEDTLS_PRIVATE(mbed_ecdh);
+#    if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
         mbedtls_ecdh_context_everest MBEDTLS_PRIVATE(everest_ecdh);
-#endif
-    } MBEDTLS_PRIVATE(ctx);                      /*!< Implementation-specific context. The
-                                  context in use is specified by the \c var
-                                  field. */
-#if defined(MBEDTLS_ECP_RESTARTABLE)
-    uint8_t MBEDTLS_PRIVATE(restart_enabled);    /*!< The flag for restartable mode. Functions of
-                                  an alternative implementation not supporting
-                                  restartable mode must return
-                                  MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED error
-                                  if this flag is set. */
-#endif /* MBEDTLS_ECP_RESTARTABLE */
+#    endif
+    } MBEDTLS_PRIVATE(ctx); /*!< Implementation-specific context. The
+             context in use is specified by the \c var
+             field. */
+#    if defined(MBEDTLS_ECP_RESTARTABLE)
+    uint8_t MBEDTLS_PRIVATE(restart_enabled); /*!< The flag for restartable
+                               mode. Functions of an alternative implementation
+                               not supporting restartable mode must return
+                               MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED error
+                               if this flag is set. */
+#    endif /* MBEDTLS_ECP_RESTARTABLE */
 #endif /* MBEDTLS_ECDH_LEGACY_CONTEXT */
-}
-mbedtls_ecdh_context;
+} mbedtls_ecdh_context;
 
 /**
  * \brief          Check whether a given group can be used for ECDH.
@@ -165,7 +170,7 @@
  *
  * \return         \c 1 if the group can be used, \c 0 otherwise
  */
-int mbedtls_ecdh_can_do( mbedtls_ecp_group_id gid );
+int mbedtls_ecdh_can_do(mbedtls_ecp_group_id gid);
 
 /**
  * \brief           This function generates an ECDH keypair on an elliptic
@@ -192,9 +197,11 @@
  * \return          Another \c MBEDTLS_ERR_ECP_XXX or
  *                  \c MBEDTLS_MPI_XXX error code on failure.
  */
-int mbedtls_ecdh_gen_public( mbedtls_ecp_group *grp, mbedtls_mpi *d, mbedtls_ecp_point *Q,
-                     int (*f_rng)(void *, unsigned char *, size_t),
-                     void *p_rng );
+int mbedtls_ecdh_gen_public(mbedtls_ecp_group *grp,
+                            mbedtls_mpi *d,
+                            mbedtls_ecp_point *Q,
+                            int (*f_rng)(void *, unsigned char *, size_t),
+                            void *p_rng);
 
 /**
  * \brief           This function computes the shared secret.
@@ -227,17 +234,19 @@
  * \return          Another \c MBEDTLS_ERR_ECP_XXX or
  *                  \c MBEDTLS_MPI_XXX error code on failure.
  */
-int mbedtls_ecdh_compute_shared( mbedtls_ecp_group *grp, mbedtls_mpi *z,
-                         const mbedtls_ecp_point *Q, const mbedtls_mpi *d,
-                         int (*f_rng)(void *, unsigned char *, size_t),
-                         void *p_rng );
+int mbedtls_ecdh_compute_shared(mbedtls_ecp_group *grp,
+                                mbedtls_mpi *z,
+                                const mbedtls_ecp_point *Q,
+                                const mbedtls_mpi *d,
+                                int (*f_rng)(void *, unsigned char *, size_t),
+                                void *p_rng);
 
 /**
  * \brief           This function initializes an ECDH context.
  *
  * \param ctx       The ECDH context to initialize. This must not be \c NULL.
  */
-void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx );
+void mbedtls_ecdh_init(mbedtls_ecdh_context *ctx);
 
 /**
  * \brief           This function sets up the ECDH context with the information
@@ -255,8 +264,7 @@
  *
  * \return          \c 0 on success.
  */
-int mbedtls_ecdh_setup( mbedtls_ecdh_context *ctx,
-                        mbedtls_ecp_group_id grp_id );
+int mbedtls_ecdh_setup(mbedtls_ecdh_context *ctx, mbedtls_ecp_group_id grp_id);
 
 /**
  * \brief           This function frees a context.
@@ -265,7 +273,7 @@
  *                  case this function does nothing. If it is not \c NULL,
  *                  it must point to an initialized ECDH context.
  */
-void mbedtls_ecdh_free( mbedtls_ecdh_context *ctx );
+void mbedtls_ecdh_free(mbedtls_ecdh_context *ctx);
 
 /**
  * \brief           This function generates an EC key pair and exports its
@@ -292,10 +300,12 @@
  *                  operations was reached: see \c mbedtls_ecp_set_max_ops().
  * \return          Another \c MBEDTLS_ERR_ECP_XXX error code on failure.
  */
-int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
-                      unsigned char *buf, size_t blen,
-                      int (*f_rng)(void *, unsigned char *, size_t),
-                      void *p_rng );
+int mbedtls_ecdh_make_params(mbedtls_ecdh_context *ctx,
+                             size_t *olen,
+                             unsigned char *buf,
+                             size_t blen,
+                             int (*f_rng)(void *, unsigned char *, size_t),
+                             void *p_rng);
 
 /**
  * \brief           This function parses the ECDHE parameters in a
@@ -321,9 +331,9 @@
  * \return          An \c MBEDTLS_ERR_ECP_XXX error code on failure.
  *
  */
-int mbedtls_ecdh_read_params( mbedtls_ecdh_context *ctx,
-                              const unsigned char **buf,
-                              const unsigned char *end );
+int mbedtls_ecdh_read_params(mbedtls_ecdh_context *ctx,
+                             const unsigned char **buf,
+                             const unsigned char *end);
 
 /**
  * \brief           This function sets up an ECDH context from an EC key.
@@ -344,9 +354,9 @@
  * \return          Another \c MBEDTLS_ERR_ECP_XXX error code on failure.
  *
  */
-int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx,
-                             const mbedtls_ecp_keypair *key,
-                             mbedtls_ecdh_side side );
+int mbedtls_ecdh_get_params(mbedtls_ecdh_context *ctx,
+                            const mbedtls_ecp_keypair *key,
+                            mbedtls_ecdh_side side);
 
 /**
  * \brief           This function generates a public key and exports it
@@ -374,10 +384,12 @@
  *                  operations was reached: see \c mbedtls_ecp_set_max_ops().
  * \return          Another \c MBEDTLS_ERR_ECP_XXX error code on failure.
  */
-int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
-                      unsigned char *buf, size_t blen,
-                      int (*f_rng)(void *, unsigned char *, size_t),
-                      void *p_rng );
+int mbedtls_ecdh_make_public(mbedtls_ecdh_context *ctx,
+                             size_t *olen,
+                             unsigned char *buf,
+                             size_t blen,
+                             int (*f_rng)(void *, unsigned char *, size_t),
+                             void *p_rng);
 
 /**
  * \brief       This function parses and processes the ECDHE payload of a
@@ -398,8 +410,9 @@
  * \return      \c 0 on success.
  * \return      An \c MBEDTLS_ERR_ECP_XXX error code on failure.
  */
-int mbedtls_ecdh_read_public( mbedtls_ecdh_context *ctx,
-                              const unsigned char *buf, size_t blen );
+int mbedtls_ecdh_read_public(mbedtls_ecdh_context *ctx,
+                             const unsigned char *buf,
+                             size_t blen);
 
 /**
  * \brief           This function derives and exports the shared secret.
@@ -430,10 +443,12 @@
  *                  operations was reached: see \c mbedtls_ecp_set_max_ops().
  * \return          Another \c MBEDTLS_ERR_ECP_XXX error code on failure.
  */
-int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
-                      unsigned char *buf, size_t blen,
-                      int (*f_rng)(void *, unsigned char *, size_t),
-                      void *p_rng );
+int mbedtls_ecdh_calc_secret(mbedtls_ecdh_context *ctx,
+                             size_t *olen,
+                             unsigned char *buf,
+                             size_t blen,
+                             int (*f_rng)(void *, unsigned char *, size_t),
+                             void *p_rng);
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
 /**
@@ -448,7 +463,7 @@
  *
  * \param ctx       The ECDH context to use. This must be initialized.
  */
-void mbedtls_ecdh_enable_restart( mbedtls_ecdh_context *ctx );
+void mbedtls_ecdh_enable_restart(mbedtls_ecdh_context *ctx);
 #endif /* MBEDTLS_ECP_RESTARTABLE */
 
 #ifdef __cplusplus