summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkokke <spam@rowdy.dk>2018-05-02 15:23:47 +0200
committerGitHub <noreply@github.com>2018-05-02 15:23:47 +0200
commit03be0caa72261696684fe9f0321371389f6c83df (patch)
tree95d9e0b622180f7050fe51b17cb86427da7e1667
parentMerge pull request #94 from lucifurtun/master (diff)
downloadtiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.tar
tiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.tar.gz
tiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.tar.bz2
tiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.tar.lz
tiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.tar.xz
tiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.tar.zst
tiny-AES-c-03be0caa72261696684fe9f0321371389f6c83df.zip
-rw-r--r--aes.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/aes.c b/aes.c
index 3e0b3e3..e68c6b0 100644
--- a/aes.c
+++ b/aes.c
@@ -319,6 +319,9 @@ static void MixColumns(state_t* state)
}
// Multiply is used to multiply numbers in the field GF(2^8)
+// Note: The last call to xtime() is unneeded, but often ends up generating a smaller binary
+// The compiler seems to be able to vectorize the operation better this way.
+// See https://github.com/kokke/tiny-AES-c/pull/34
#if MULTIPLY_AS_A_FUNCTION
static uint8_t Multiply(uint8_t x, uint8_t y)
{
@@ -326,7 +329,7 @@ static uint8_t Multiply(uint8_t x, uint8_t y)
((y>>1 & 1) * xtime(x)) ^
((y>>2 & 1) * xtime(xtime(x))) ^
((y>>3 & 1) * xtime(xtime(xtime(x)))) ^
- ((y>>4 & 1) * xtime(xtime(xtime(xtime(x))))));
+ ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))); /* this last call to xtime() can be omitted */
}
#else
#define Multiply(x, y) \