Skip to content

Commit

Permalink
better exit condition
Browse files Browse the repository at this point in the history
  • Loading branch information
pct960 authored and arun-babu committed May 9, 2022
1 parent 9dab5d7 commit 5204643
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
10 changes: 4 additions & 6 deletions freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,11 @@ static bool freestyle_randomsetup_decrypt (freestyle_ctx* const x)

++running_pepper;

if (
(running_pepper == start_pepper)
||
(running_pepper == max_pepper)
) {
if (running_pepper > max_pepper)
running_pepper = 0;

if (running_pepper == start_pepper)
return false;
}
}

if (! found_pepper)
Expand Down
10 changes: 4 additions & 6 deletions optimized/8-32/freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,11 @@ static bool freestyle_randomsetup_decrypt (freestyle_ctx* const x)

++running_pepper;

if (
(running_pepper == start_pepper)
||
(running_pepper == max_pepper)
) {
if (running_pepper > max_pepper)
running_pepper = 0;

if (running_pepper == start_pepper)
return false;
}
}

if (! found_pepper)
Expand Down
10 changes: 4 additions & 6 deletions optimized/merged/freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,11 @@ static bool freestyle_randomsetup_decrypt (freestyle_ctx* const x)

++running_pepper;

if (
(running_pepper == start_pepper)
||
(running_pepper == max_pepper)
) {
if (running_pepper > max_pepper)
running_pepper = 0;

if (running_pepper == start_pepper)
return false;
}
}

if (! found_pepper)
Expand Down
10 changes: 4 additions & 6 deletions side-channel-attack-resistance/freestyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,11 @@ static bool freestyle_randomsetup_decrypt (freestyle_ctx* const x)

++running_pepper;

if (
(running_pepper == start_pepper)
||
(running_pepper == max_pepper)
) {
if (running_pepper > max_pepper)
running_pepper = 0;

if (running_pepper == start_pepper)
return false;
}
}

if (! found_pepper)
Expand Down

0 comments on commit 5204643

Please sign in to comment.