Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Tiny AES C
Commits
03be0caa
Unverified
Commit
03be0caa
authored
May 02, 2018
by
kokke
Committed by
GitHub
May 02, 2018
Browse files
Commenting reason for extra calls to xtime()
parent
f4b1701a
Changes
1
Show whitespace changes
Inline
Side-by-side
aes.c
View file @
03be0caa
...
@@ -319,6 +319,9 @@ static void MixColumns(state_t* state)
...
@@ -319,6 +319,9 @@ static void MixColumns(state_t* state)
}
}
// Multiply is used to multiply numbers in the field GF(2^8)
// 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
#if MULTIPLY_AS_A_FUNCTION
static
uint8_t
Multiply
(
uint8_t
x
,
uint8_t
y
)
static
uint8_t
Multiply
(
uint8_t
x
,
uint8_t
y
)
{
{
...
@@ -326,7 +329,7 @@ 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
>>
1
&
1
)
*
xtime
(
x
))
^
((
y
>>
2
&
1
)
*
xtime
(
xtime
(
x
)))
^
((
y
>>
2
&
1
)
*
xtime
(
xtime
(
x
)))
^
((
y
>>
3
&
1
)
*
xtime
(
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
#else
#define Multiply(x, y) \
#define Multiply(x, y) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment