Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wim Lewis
nettle
Commits
67cd46aa
Commit
67cd46aa
authored
13 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Use ROTL32 in the aes code.
parent
f13fd113
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+3
-0
3 additions, 0 deletions
ChangeLog
aes-internal.h
+0
-2
0 additions, 2 deletions
aes-internal.h
aes-set-encrypt-key.c
+2
-1
2 additions, 1 deletion
aes-set-encrypt-key.c
with
5 additions
and
3 deletions
ChangeLog
+
3
−
0
View file @
67cd46aa
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
* macros.h (ROTL32): New macro, to replace (almost) all other
* macros.h (ROTL32): New macro, to replace (almost) all other
rotation macros.
rotation macros.
* aes-set-encrypt-key.c: Include macros.h.
(aes_set_encrypt_key): Use ROTL32.
* aes-internal.h (ROTBYTE, ROTRBYTE): Deleted macros.
2012-03-30 Niels Möller <nisse@lysator.liu.se>
2012-03-30 Niels Möller <nisse@lysator.liu.se>
...
...
This diff is collapsed.
Click to expand it.
aes-internal.h
+
0
−
2
View file @
67cd46aa
...
@@ -63,8 +63,6 @@ _aes_decrypt(const struct aes_ctx *ctx,
...
@@ -63,8 +63,6 @@ _aes_decrypt(const struct aes_ctx *ctx,
const
uint8_t
*
src
);
const
uint8_t
*
src
);
/* Macros */
/* Macros */
#define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24))
#define ROTRBYTE(x) (((x) << 8) | (((x) >> 24) & 0xff))
#define SUBBYTE(x, box) (((box)[((x) & 0xff)]) | \
#define SUBBYTE(x, box) (((box)[((x) & 0xff)]) | \
((box)[(((x) >> 8) & 0xff)] << 8) | \
((box)[(((x) >> 8) & 0xff)] << 8) | \
((box)[(((x) >> 16) & 0xff)] << 16) | \
((box)[(((x) >> 16) & 0xff)] << 16) | \
...
...
This diff is collapsed.
Click to expand it.
aes-set-encrypt-key.c
+
2
−
1
View file @
67cd46aa
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include
<assert.h>
#include
<assert.h>
#include
"aes-internal.h"
#include
"aes-internal.h"
#include
"macros.h"
static
unsigned
static
unsigned
xtime
(
unsigned
x
)
xtime
(
unsigned
x
)
...
@@ -83,7 +84,7 @@ aes_set_encrypt_key(struct aes_ctx *ctx,
...
@@ -83,7 +84,7 @@ aes_set_encrypt_key(struct aes_ctx *ctx,
temp
=
ctx
->
keys
[
i
-
1
];
temp
=
ctx
->
keys
[
i
-
1
];
if
(
i
%
nk
==
0
)
if
(
i
%
nk
==
0
)
{
{
temp
=
SUBBYTE
(
ROT
BYTE
(
temp
),
aes_sbox
)
^
rcon
;
temp
=
SUBBYTE
(
ROT
L32
(
24
,
temp
),
aes_sbox
)
^
rcon
;
rcon
=
(
uint32_t
)
xtime
((
uint8_t
)
rcon
&
0xff
);
rcon
=
(
uint32_t
)
xtime
((
uint8_t
)
rcon
&
0xff
);
}
}
else
if
(
nk
>
6
&&
(
i
%
nk
)
==
4
)
else
if
(
nk
>
6
&&
(
i
%
nk
)
==
4
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment