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/gcm.h b/include/mbedtls/gcm.h
index 9d9155f..338f938 100644
--- a/include/mbedtls/gcm.h
+++ b/include/mbedtls/gcm.h
@@ -38,13 +38,13 @@
#include <stdint.h>
-#define MBEDTLS_GCM_ENCRYPT 1
-#define MBEDTLS_GCM_DECRYPT 0
+#define MBEDTLS_GCM_ENCRYPT 1
+#define MBEDTLS_GCM_DECRYPT 0
/** Authenticated decryption failed. */
-#define MBEDTLS_ERR_GCM_AUTH_FAILED -0x0012
+#define MBEDTLS_ERR_GCM_AUTH_FAILED -0x0012
/** Bad input parameters to function. */
-#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014
+#define MBEDTLS_ERR_GCM_BAD_INPUT -0x0014
#ifdef __cplusplus
extern "C" {
@@ -55,24 +55,26 @@
/**
* \brief The GCM context structure.
*/
-typedef struct mbedtls_gcm_context
-{
- mbedtls_cipher_context_t MBEDTLS_PRIVATE(cipher_ctx); /*!< The cipher context used. */
- uint64_t MBEDTLS_PRIVATE(HL)[16]; /*!< Precalculated HTable low. */
- uint64_t MBEDTLS_PRIVATE(HH)[16]; /*!< Precalculated HTable high. */
- uint64_t MBEDTLS_PRIVATE(len); /*!< The total length of the encrypted data. */
- uint64_t MBEDTLS_PRIVATE(add_len); /*!< The total length of the additional data. */
- unsigned char MBEDTLS_PRIVATE(base_ectr)[16]; /*!< The first ECTR for tag. */
- unsigned char MBEDTLS_PRIVATE(y)[16]; /*!< The Y working value. */
- unsigned char MBEDTLS_PRIVATE(buf)[16]; /*!< The buf working value. */
- int MBEDTLS_PRIVATE(mode); /*!< The operation to perform:
- #MBEDTLS_GCM_ENCRYPT or
- #MBEDTLS_GCM_DECRYPT. */
-}
-mbedtls_gcm_context;
+typedef struct mbedtls_gcm_context {
+ mbedtls_cipher_context_t MBEDTLS_PRIVATE(cipher_ctx); /*!< The cipher
+ context used. */
+ uint64_t MBEDTLS_PRIVATE(HL)[16]; /*!< Precalculated HTable low. */
+ uint64_t MBEDTLS_PRIVATE(HH)[16]; /*!< Precalculated HTable high. */
+ uint64_t MBEDTLS_PRIVATE(len); /*!< The total length of the encrypted data.
+ */
+ uint64_t MBEDTLS_PRIVATE(add_len); /*!< The total length of the additional
+ data. */
+ unsigned char MBEDTLS_PRIVATE(base_ectr)[16]; /*!< The first ECTR for tag.
+ */
+ unsigned char MBEDTLS_PRIVATE(y)[16]; /*!< The Y working value. */
+ unsigned char MBEDTLS_PRIVATE(buf)[16]; /*!< The buf working value. */
+ int MBEDTLS_PRIVATE(mode); /*!< The operation to perform:
+ #MBEDTLS_GCM_ENCRYPT or
+ #MBEDTLS_GCM_DECRYPT. */
+} mbedtls_gcm_context;
-#else /* !MBEDTLS_GCM_ALT */
-#include "gcm_alt.h"
+#else /* !MBEDTLS_GCM_ALT */
+# include "gcm_alt.h"
#endif /* !MBEDTLS_GCM_ALT */
/**
@@ -86,7 +88,7 @@
*
* \param ctx The GCM context to initialize. This must not be \c NULL.
*/
-void mbedtls_gcm_init( mbedtls_gcm_context *ctx );
+void mbedtls_gcm_init(mbedtls_gcm_context *ctx);
/**
* \brief This function associates a GCM context with a
@@ -104,10 +106,10 @@
* \return \c 0 on success.
* \return A cipher-specific error code on failure.
*/
-int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
- mbedtls_cipher_id_t cipher,
- const unsigned char *key,
- unsigned int keybits );
+int mbedtls_gcm_setkey(mbedtls_gcm_context *ctx,
+ mbedtls_cipher_id_t cipher,
+ const unsigned char *key,
+ unsigned int keybits);
/**
* \brief This function performs GCM encryption or decryption of a buffer.
@@ -160,17 +162,17 @@
* not valid or a cipher-specific error code if the encryption
* or decryption failed.
*/
-int mbedtls_gcm_crypt_and_tag( mbedtls_gcm_context *ctx,
- int mode,
- size_t length,
- const unsigned char *iv,
- size_t iv_len,
- const unsigned char *add,
- size_t add_len,
- const unsigned char *input,
- unsigned char *output,
- size_t tag_len,
- unsigned char *tag );
+int mbedtls_gcm_crypt_and_tag(mbedtls_gcm_context *ctx,
+ int mode,
+ size_t length,
+ const unsigned char *iv,
+ size_t iv_len,
+ const unsigned char *add,
+ size_t add_len,
+ const unsigned char *input,
+ unsigned char *output,
+ size_t tag_len,
+ unsigned char *tag);
/**
* \brief This function performs a GCM authenticated decryption of a
@@ -205,16 +207,16 @@
* not valid or a cipher-specific error code if the decryption
* failed.
*/
-int mbedtls_gcm_auth_decrypt( mbedtls_gcm_context *ctx,
- size_t length,
- const unsigned char *iv,
- size_t iv_len,
- const unsigned char *add,
- size_t add_len,
- const unsigned char *tag,
- size_t tag_len,
- const unsigned char *input,
- unsigned char *output );
+int mbedtls_gcm_auth_decrypt(mbedtls_gcm_context *ctx,
+ size_t length,
+ const unsigned char *iv,
+ size_t iv_len,
+ const unsigned char *add,
+ size_t add_len,
+ const unsigned char *tag,
+ size_t tag_len,
+ const unsigned char *input,
+ unsigned char *output);
/**
* \brief This function starts a GCM encryption or decryption
@@ -229,10 +231,10 @@
*
* \return \c 0 on success.
*/
-int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
- int mode,
- const unsigned char *iv,
- size_t iv_len );
+int mbedtls_gcm_starts(mbedtls_gcm_context *ctx,
+ int mode,
+ const unsigned char *iv,
+ size_t iv_len);
/**
* \brief This function feeds an input buffer as associated data
@@ -254,9 +256,9 @@
*
* \return \c 0 on success.
*/
-int mbedtls_gcm_update_ad( mbedtls_gcm_context *ctx,
- const unsigned char *add,
- size_t add_len );
+int mbedtls_gcm_update_ad(mbedtls_gcm_context *ctx,
+ const unsigned char *add,
+ size_t add_len);
/**
* \brief This function feeds an input buffer into an ongoing GCM
@@ -309,10 +311,12 @@
* unsupported input/output buffer overlap detected,
* or \p output_size too small.
*/
-int mbedtls_gcm_update( mbedtls_gcm_context *ctx,
- const unsigned char *input, size_t input_length,
- unsigned char *output, size_t output_size,
- size_t *output_length );
+int mbedtls_gcm_update(mbedtls_gcm_context *ctx,
+ const unsigned char *input,
+ size_t input_length,
+ unsigned char *output,
+ size_t output_size,
+ size_t *output_length);
/**
* \brief This function finishes the GCM operation and generates
@@ -347,10 +351,12 @@
* invalid value of \p tag_len,
* or \p output_size too small.
*/
-int mbedtls_gcm_finish( mbedtls_gcm_context *ctx,
- unsigned char *output, size_t output_size,
- size_t *output_length,
- unsigned char *tag, size_t tag_len );
+int mbedtls_gcm_finish(mbedtls_gcm_context *ctx,
+ unsigned char *output,
+ size_t output_size,
+ size_t *output_length,
+ unsigned char *tag,
+ size_t tag_len);
/**
* \brief This function clears a GCM context and the underlying
@@ -359,7 +365,7 @@
* \param ctx The GCM context to clear. If this is \c NULL, the call has
* no effect. Otherwise, this must be initialized.
*/
-void mbedtls_gcm_free( mbedtls_gcm_context *ctx );
+void mbedtls_gcm_free(mbedtls_gcm_context *ctx);
#if defined(MBEDTLS_SELF_TEST)
@@ -369,7 +375,7 @@
* \return \c 0 on success.
* \return \c 1 on failure.
*/
-int mbedtls_gcm_self_test( int verbose );
+int mbedtls_gcm_self_test(int verbose);
#endif /* MBEDTLS_SELF_TEST */
@@ -377,5 +383,4 @@
}
#endif
-
#endif /* gcm.h */