2
0

Format code.

This commit is contained in:
Maarten Billemont 2017-08-30 09:57:15 -04:00
parent 6f4f6b8d1e
commit d22f93e564
4 changed files with 13 additions and 14 deletions

View File

@ -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);

View File

@ -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

View File

@ -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" );

View File

@ -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" );