Skip to content

Commit

Permalink
Bit splice some operations
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinas committed Oct 2, 2023
1 parent 63b0b9b commit 01dac68
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions faest_aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,16 +1038,9 @@ static void aes_enc_backward_192_1(const uint8_t* x, const uint8_t* xk, uint8_t
// Step: 7
xtilde = x[ird / 8];
} else {
// Step: 9
uint8_t xout = 0;
for (unsigned int i = 0; i < 8; i++) {
// Step: 10..11
// delta is always \bot if called with m == 1
// TODO bit splice
xout |=
set_bit(get_bit(out[(ird - 128 * (R - 1)) / 8], i) & (1 ^ Mtag) & (1 ^ Mkey), i);
}
xtilde = xout ^ xk[(128 + ird) / 8];
// Step: 9..11 (bit spliced)
uint8_t xout = out[(ird - 128 * (R - 1)) / 8] & -((1 ^ Mtag) & (1 ^ Mkey));
xtilde = xout ^ xk[(128 + ird) / 8];
}

// Step: 12..17 (bit spliced)
Expand Down Expand Up @@ -1627,16 +1620,9 @@ static void aes_enc_backward_256_1(const uint8_t* x, const uint8_t* xk, uint8_t
// Step: 7
xtilde = x[ird / 8];
} else {
// Step: 9
uint8_t xout = 0;
for (unsigned int i = 0; i < 8; i++) {
// Step: 10..11
// delta is always \bot if called with m == 1
// TODO bit splice
xout |=
set_bit(get_bit(out[(ird - 128 * (R - 1)) / 8], i) & (1 ^ Mtag) & (1 ^ Mkey), i);
}
xtilde = xout ^ xk[(128 + ird) / 8];
// Step: 9..11 (bit spliced)
uint8_t xout = out[(ird - 128 * (R - 1)) / 8] & -((1 ^ Mtag) & (1 ^ Mkey));
xtilde = xout ^ xk[(128 + ird) / 8];
}

// Step: 12..17 (bit spliced)
Expand Down

0 comments on commit 01dac68

Please sign in to comment.