From d22f93e564a29de410e8524a5be0c41db2496190 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Wed, 30 Aug 2017 09:57:15 -0400 Subject: [PATCH] Format code. --- core/c/mpw-util.h | 2 +- platform-independent/cli-c/cli/blf.h | 15 +++++++-------- platform-independent/cli-c/cli/mpw-bench.c | 8 ++++---- platform-independent/cli-c/cli/mpw-tests-util.c | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/core/c/mpw-util.h b/core/c/mpw-util.h index 0a7406ee..f26d8a29 100644 --- a/core/c/mpw-util.h +++ b/core/c/mpw-util.h @@ -111,7 +111,7 @@ void mpw_uint64(const uint64_t number, uint8_t buf[8]); /** Push a buffer onto a buffer. reallocs the given buffer and appends the given buffer. */ bool mpw_push_buf( - uint8_t ** buffer, size_t *bufferSize, const void *pushBuffer, const size_t pushSize); + uint8_t **buffer, size_t *bufferSize, const void *pushBuffer, const size_t pushSize); /** Push a string onto a buffer. reallocs the given buffer and appends the given string. */ bool mpw_push_string( uint8_t **buffer, size_t *bufferSize, const char *pushString); diff --git a/platform-independent/cli-c/cli/blf.h b/platform-independent/cli-c/cli/blf.h index ec42b419..e1c92ab4 100644 --- a/platform-independent/cli-c/cli/blf.h +++ b/platform-independent/cli-c/cli/blf.h @@ -41,14 +41,14 @@ * of the key affect all cipherbits. */ -#define BLF_N 16 /* Number of Subkeys */ -#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */ -#define BLF_MAXUTILIZED ((BLF_N+2)*4) /* 576 bits */ +#define BLF_N 16 /* Number of Subkeys */ +#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */ +#define BLF_MAXUTILIZED ((BLF_N+2)*4) /* 576 bits */ /* Blowfish context */ typedef struct BlowfishContext { - u_int32_t S[4][256]; /* S-Boxes */ - u_int32_t P[BLF_N + 2]; /* Subkeys */ + u_int32_t S[4][256]; /* S-Boxes */ + u_int32_t P[BLF_N + 2]; /* Subkeys */ } blf_ctx; /* Raw access to customized Blowfish @@ -61,8 +61,7 @@ void Blowfish_encipher(blf_ctx *, u_int32_t *, u_int32_t *); void Blowfish_decipher(blf_ctx *, u_int32_t *, u_int32_t *); void Blowfish_initstate(blf_ctx *); void Blowfish_expand0state(blf_ctx *, const u_int8_t *, u_int16_t); -void Blowfish_expandstate -(blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t); +void Blowfish_expandstate(blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t); /* Standard Blowfish */ @@ -77,6 +76,6 @@ void blf_cbc_encrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t); void blf_cbc_decrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t); /* Converts u_int8_t to u_int32_t */ -u_int32_t Blowfish_stream2word(const u_int8_t *, u_int16_t , u_int16_t *); +u_int32_t Blowfish_stream2word(const u_int8_t *, u_int16_t, u_int16_t *); #endif diff --git a/platform-independent/cli-c/cli/mpw-bench.c b/platform-independent/cli-c/cli/mpw-bench.c index 078a38e5..fbcd4a2d 100644 --- a/platform-independent/cli-c/cli/mpw-bench.c +++ b/platform-independent/cli-c/cli/mpw-bench.c @@ -71,7 +71,7 @@ int main(int argc, char *const argv[]) { for (int i = 1; i <= iterations; ++i) { free( (void *)mpw_hash_hmac_sha256( masterKey, MPMasterKeySize, sitePasswordInfo, 128 ) ); - if (modff(100.f * i / iterations, &percent) == 0) + if (modff( 100.f * i / iterations, &percent ) == 0) fprintf( stderr, "\rhmac-sha-256: iteration %d / %d (%.0f%%)..", i, iterations, percent ); } const double hmacSha256Speed = mpw_showSpeed( startTime, iterations, "hmac-sha-256" ); @@ -85,7 +85,7 @@ int main(int argc, char *const argv[]) { for (int i = 1; i <= iterations; ++i) { bcrypt( masterPassword, bcrypt_gensalt( bcrypt_rounds ) ); - if (modff(100.f * i / iterations, &percent) == 0) + if (modff( 100.f * i / iterations, &percent ) == 0) fprintf( stderr, "\rbcrypt (rounds 10^%d): iteration %d / %d (%.0f%%)..", bcrypt_rounds, i, iterations, percent ); } const double bcrypt9Speed = mpw_showSpeed( startTime, iterations, "bcrypt" ); @@ -97,7 +97,7 @@ int main(int argc, char *const argv[]) { for (int i = 1; i <= iterations; ++i) { free( (void *)mpw_masterKey( fullName, masterPassword, MPAlgorithmVersionCurrent ) ); - if (modff(100.f * i / iterations, &percent) == 0) + if (modff( 100.f * i / iterations, &percent ) == 0) fprintf( stderr, "\rscrypt_mpw: iteration %d / %d (%.0f%%)..", i, iterations, percent ); } const double scryptSpeed = mpw_showSpeed( startTime, iterations, "scrypt_mpw" ); @@ -117,7 +117,7 @@ int main(int argc, char *const argv[]) { masterKey, siteName, siteCounter, keyPurpose, keyContext, resultType, NULL, MPAlgorithmVersionCurrent ) ); free( (void *)masterKey ); - if (modff(100.f * i / iterations, &percent) == 0) + if (modff( 100.f * i / iterations, &percent ) == 0) fprintf( stderr, "\rmpw: iteration %d / %d (%.0f%%)..", i, iterations, percent ); } const double mpwSpeed = mpw_showSpeed( startTime, iterations, "mpw" ); diff --git a/platform-independent/cli-c/cli/mpw-tests-util.c b/platform-independent/cli-c/cli/mpw-tests-util.c index 79828b83..5308a04c 100644 --- a/platform-independent/cli-c/cli/mpw-tests-util.c +++ b/platform-independent/cli-c/cli/mpw-tests-util.c @@ -38,7 +38,7 @@ xmlNodePtr mpw_xmlTestCaseNode(xmlNodePtr testCaseNode, const char *nodeName) { return child; // Missing content, try to find parent case. - if (strcmp(nodeName, "parent") == 0) + if (strcmp( nodeName, "parent" ) == 0) // Was just searching for testCaseNode's parent, none found. return NULL; xmlChar *parentId = mpw_xmlTestCaseString( testCaseNode, "parent" );