Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Wim Lewis
nettle
Commits
67cd46aa
Commit
67cd46aa
authored
Mar 31, 2012
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ROTL32 in the aes code.
parent
f13fd113
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
ChangeLog
ChangeLog
+3
-0
aes-internal.h
aes-internal.h
+0
-2
aes-set-encrypt-key.c
aes-set-encrypt-key.c
+2
-1
No files found.
ChangeLog
View file @
67cd46aa
...
...
@@ -2,6 +2,9 @@
* macros.h (ROTL32): New macro, to replace (almost) all other
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>
...
...
aes-internal.h
View file @
67cd46aa
...
...
@@ -63,8 +63,6 @@ _aes_decrypt(const struct aes_ctx *ctx,
const
uint8_t
*
src
);
/* Macros */
#define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24))
#define ROTRBYTE(x) (((x) << 8) | (((x) >> 24) & 0xff))
#define SUBBYTE(x, box) (((box)[((x) & 0xff)]) | \
((box)[(((x) >> 8) & 0xff)] << 8) | \
((box)[(((x) >> 16) & 0xff)] << 16) | \
...
...
aes-set-encrypt-key.c
View file @
67cd46aa
...
...
@@ -32,6 +32,7 @@
#include <assert.h>
#include "aes-internal.h"
#include "macros.h"
static
unsigned
xtime
(
unsigned
x
)
...
...
@@ -83,7 +84,7 @@ aes_set_encrypt_key(struct aes_ctx *ctx,
temp
=
ctx
->
keys
[
i
-
1
];
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
);
}
else
if
(
nk
>
6
&&
(
i
%
nk
)
==
4
)
...
...
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