Skip to content

Commit

Permalink
cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
arun committed Nov 13, 2019
1 parent 168a9b1 commit 394cb92
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 209 deletions.
11 changes: 7 additions & 4 deletions freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,13 @@ static void freestyle_init_common (

freestyle_keysetup (x, key, key_length_bits);
freestyle_ivsetup (x, iv, 0);
freestyle_roundsetup (x, min_rounds, max_rounds,
num_precomputed_rounds,
pepper_bits,
num_init_hashes
freestyle_roundsetup (
x,
min_rounds,
max_rounds,
num_precomputed_rounds,
pepper_bits,
num_init_hashes
);
}

Expand Down
24 changes: 14 additions & 10 deletions optimized/8-32/freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "freestyle.h"
#include "freestyle-opt.h"

static u8 gcd (u8 a, u8 b)
{
u8 r;
Expand Down Expand Up @@ -515,10 +516,13 @@ static void freestyle_init_common (

freestyle_keysetup (x, key, key_length_bits);
freestyle_ivsetup (x, iv, 0);
freestyle_roundsetup (x, min_rounds, max_rounds,
num_precomputed_rounds,
pepper_bits,
num_init_hashes
freestyle_roundsetup (
x,
min_rounds,
max_rounds,
num_precomputed_rounds,
pepper_bits,
num_init_hashes
);
}

Expand Down Expand Up @@ -663,7 +667,7 @@ void freestyle_encrypt (
{
u32 i;

u32 block = 0;
u32 block = 0;

u8 hash;

Expand Down Expand Up @@ -799,7 +803,7 @@ void freestyle_encrypt (

bytes -= 64;

++block;
++block;

freestyle_increment_counter(x);
}
Expand All @@ -814,7 +818,7 @@ void freestyle_decrypt (
{
u32 i;

u32 block = 0;
u32 block = 0;

u8 hash;

Expand Down Expand Up @@ -982,7 +986,7 @@ void freestyle_hash_password (
}

/* Fill the key (32 bytes)
and IV (first 11 bytes) with password */
and IV (first 11 bytes) with password */
for (i = 0; i < 43; )
{
for (j = 0; i < 43 && j < password_len; ++j)
Expand Down Expand Up @@ -1075,7 +1079,7 @@ void freestyle_hash_password_with_pepper (
}

/* Fill the key (32 bytes)
and IV (first 11 bytes) with password */
and IV (first 11 bytes) with password */
for (i = 0; i < 43; )
{
for (j = 0; i < 43 && j < password_len; ++j)
Expand Down Expand Up @@ -1167,7 +1171,7 @@ bool freestyle_verify_password_hash (
}

/* Fill the key (32 bytes)
and IV (first 11 bytes) with password */
and IV (first 11 bytes) with password */
for (i = 0; i < 43; )
{
for (j = 0; i < 43 && j < password_len; ++j)
Expand Down
33 changes: 18 additions & 15 deletions optimized/merged/freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void freestyle_roundsetup (


static u8 freestyle_encrypt_block (
freestyle_ctx *x,
freestyle_ctx *x,
u8 *expected_hash)
{
u8 hash = 0;
Expand Down Expand Up @@ -154,7 +154,7 @@ static u8 freestyle_encrypt_block (
output_13 = x->input_IV0,
output_14 = x->input_IV1,
output_15 = x->input_IV2;

memset (hash_collided, 0, sizeof(hash_collided));

/* Generate a random round */
Expand Down Expand Up @@ -186,7 +186,7 @@ static u8 freestyle_encrypt_block (
}

static u8 freestyle_decrypt_block (
freestyle_ctx *x,
freestyle_ctx *x,
u8 *expected_hash)
{
u8 hash = 0;
Expand Down Expand Up @@ -268,7 +268,7 @@ static void freestyle_randomsetup_encrypt (freestyle_ctx *x)
u32 p;

/* init RNG */
freestyle_init_RNG(x);
freestyle_init_RNG(x);

if (! x->is_pepper_set)
{
Expand Down Expand Up @@ -516,10 +516,13 @@ static void freestyle_init_common (

freestyle_keysetup (x, key, key_length_bits);
freestyle_ivsetup (x, iv, 0);
freestyle_roundsetup (x, min_rounds, max_rounds,
num_precomputed_rounds,
pepper_bits,
num_init_hashes
freestyle_roundsetup (
x,
min_rounds,
max_rounds,
num_precomputed_rounds,
pepper_bits,
num_init_hashes
);
}

Expand Down Expand Up @@ -664,7 +667,7 @@ void freestyle_encrypt (
{
u32 i;

u32 block = 0;
u32 block = 0;

u8 hash;

Expand All @@ -686,9 +689,9 @@ void freestyle_encrypt (
while (bytes > 0)
{
hash = 0;

memset (hash_collided, 0, sizeof(hash_collided));

output_00 = x->input_CONSTANT0;
output_01 = x->input_CONSTANT1;
output_02 = x->input_CONSTANT2;
Expand Down Expand Up @@ -790,8 +793,8 @@ void freestyle_encrypt (
ciphertext += 64;

bytes -= 64;
++block;

++block;

freestyle_increment_counter(x);
}
Expand All @@ -806,7 +809,7 @@ void freestyle_decrypt (
{
u32 i;

u32 block = 0;
u32 block = 0;

u8 hash;

Expand Down Expand Up @@ -925,7 +928,7 @@ void freestyle_decrypt (
ciphertext += 64;

bytes -= 64;

++block;

x->input_COUNTER = PLUSONE (x->input_COUNTER);
Expand Down
Loading

0 comments on commit 394cb92

Please sign in to comment.