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/sha512.h b/include/mbedtls/sha512.h
index 48901cc..9df1476 100644
--- a/include/mbedtls/sha512.h
+++ b/include/mbedtls/sha512.h
@@ -3,7 +3,8 @@
* \brief This file contains SHA-384 and SHA-512 definitions and functions.
*
* The Secure Hash Algorithms 384 and 512 (SHA-384 and SHA-512) cryptographic
- * hash functions are defined in <em>FIPS 180-4: Secure Hash Standard (SHS)</em>.
+ * hash functions are defined in <em>FIPS 180-4: Secure Hash Standard
+ * (SHS)</em>.
*/
/*
* Copyright The Mbed TLS Contributors
@@ -31,7 +32,7 @@
#include <stdint.h>
/** SHA-512 input data was malformed. */
-#define MBEDTLS_ERR_SHA512_BAD_INPUT_DATA -0x0075
+#define MBEDTLS_ERR_SHA512_BAD_INPUT_DATA -0x0075
#ifdef __cplusplus
extern "C" {
@@ -48,20 +49,19 @@
* checksum calculations. The choice between these two is
* made in the call to mbedtls_sha512_starts().
*/
-typedef struct mbedtls_sha512_context
-{
- uint64_t MBEDTLS_PRIVATE(total)[2]; /*!< The number of Bytes processed. */
- uint64_t MBEDTLS_PRIVATE(state)[8]; /*!< The intermediate digest state. */
- unsigned char MBEDTLS_PRIVATE(buffer)[128]; /*!< The data block being processed. */
-#if defined(MBEDTLS_SHA384_C)
- int MBEDTLS_PRIVATE(is384); /*!< Determines which function to use:
- 0: Use SHA-512, or 1: Use SHA-384. */
-#endif
-}
-mbedtls_sha512_context;
+typedef struct mbedtls_sha512_context {
+ uint64_t MBEDTLS_PRIVATE(total)[2]; /*!< The number of Bytes processed. */
+ uint64_t MBEDTLS_PRIVATE(state)[8]; /*!< The intermediate digest state. */
+ unsigned char MBEDTLS_PRIVATE(buffer)[128]; /*!< The data block being
+ processed. */
+# if defined(MBEDTLS_SHA384_C)
+ int MBEDTLS_PRIVATE(is384); /*!< Determines which function to use:
+ 0: Use SHA-512, or 1: Use SHA-384. */
+# endif
+} mbedtls_sha512_context;
-#else /* MBEDTLS_SHA512_ALT */
-#include "sha512_alt.h"
+#else /* MBEDTLS_SHA512_ALT */
+# include "sha512_alt.h"
#endif /* MBEDTLS_SHA512_ALT */
/**
@@ -70,7 +70,7 @@
* \param ctx The SHA-512 context to initialize. This must
* not be \c NULL.
*/
-void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
+void mbedtls_sha512_init(mbedtls_sha512_context *ctx);
/**
* \brief This function clears a SHA-512 context.
@@ -80,7 +80,7 @@
* is not \c NULL, it must point to an initialized
* SHA-512 context.
*/
-void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
+void mbedtls_sha512_free(mbedtls_sha512_context *ctx);
/**
* \brief This function clones the state of a SHA-512 context.
@@ -88,8 +88,8 @@
* \param dst The destination context. This must be initialized.
* \param src The context to clone. This must be initialized.
*/
-void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
- const mbedtls_sha512_context *src );
+void mbedtls_sha512_clone(mbedtls_sha512_context *dst,
+ const mbedtls_sha512_context *src);
/**
* \brief This function starts a SHA-384 or SHA-512 checksum
@@ -106,7 +106,7 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 );
+int mbedtls_sha512_starts(mbedtls_sha512_context *ctx, int is384);
/**
* \brief This function feeds an input buffer into an ongoing
@@ -121,9 +121,9 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_sha512_update( mbedtls_sha512_context *ctx,
- const unsigned char *input,
- size_t ilen );
+int mbedtls_sha512_update(mbedtls_sha512_context *ctx,
+ const unsigned char *input,
+ size_t ilen);
/**
* \brief This function finishes the SHA-512 operation, and writes
@@ -138,8 +138,7 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
- unsigned char *output );
+int mbedtls_sha512_finish(mbedtls_sha512_context *ctx, unsigned char *output);
/**
* \brief This function processes a single data block within
@@ -153,8 +152,8 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
- const unsigned char data[128] );
+int mbedtls_internal_sha512_process(mbedtls_sha512_context *ctx,
+ const unsigned char data[128]);
/**
* \brief This function calculates the SHA-512 or SHA-384
@@ -182,20 +181,20 @@
* \return \c 0 on success.
* \return A negative error code on failure.
*/
-int mbedtls_sha512( const unsigned char *input,
- size_t ilen,
- unsigned char *output,
- int is384 );
+int mbedtls_sha512(const unsigned char *input,
+ size_t ilen,
+ unsigned char *output,
+ int is384);
#if defined(MBEDTLS_SELF_TEST)
- /**
+/**
* \brief The SHA-384 or SHA-512 checkup routine.
*
* \return \c 0 on success.
* \return \c 1 on failure.
*/
-int mbedtls_sha512_self_test( int verbose );
+int mbedtls_sha512_self_test(int verbose);
#endif /* MBEDTLS_SELF_TEST */
#ifdef __cplusplus