aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-16 13:57:04 +0100
committerMattias Andrée <maandree@kth.se>2022-02-16 13:57:04 +0100
commite88f889695fa34ab65999175f868be3483a339fa (patch)
treec525eed542d0c3cae7e7126ac82fa4a52162406d
parentRemove todo (diff)
downloadlibar2-e88f889695fa34ab65999175f868be3483a339fa.tar.gz
libar2-e88f889695fa34ab65999175f868be3483a339fa.tar.bz2
libar2-e88f889695fa34ab65999175f868be3483a339fa.tar.xz
Fix style + minimal optimisation
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--libar2_hash.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libar2_hash.c b/libar2_hash.c
index 98c50cb..f1e6d9b 100644
--- a/libar2_hash.c
+++ b/libar2_hash.c
@@ -279,12 +279,11 @@ fill_segment(struct block *memory, const uint_least64_t *sbox, struct libar2_arg
inputb.w[3] = blocks;
inputb.w[4] = params->t_cost;
inputb.w[5] = (uint_least32_t)params->type;
- }
-
- if (!pass && !slice) {
- if (data_independent) {
+ if (!pass && !slice) {
next_address_block(&addrb, &inputb);
+ index = 2;
}
+ } else if (!pass && !slice) {
index = 2;
}
@@ -296,9 +295,8 @@ fill_segment(struct block *memory, const uint_least64_t *sbox, struct libar2_arg
prevoff = off - 1;
if (data_independent) {
i = index % ELEMSOF(addrb.w);
- if (!i) {
+ if (!i)
next_address_block(&addrb, &inputb);
- }
prand = addrb.w[i];
} else {
prand = memory[prevoff].w[0];