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
614a672e
Commit
614a672e
authored
May 17, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearranged struct aes_ctx.
parent
ff29d0a9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
11 deletions
+16
-11
ChangeLog
ChangeLog
+5
-0
aes-decrypt.c
aes-decrypt.c
+1
-1
aes-encrypt.c
aes-encrypt.c
+1
-1
aes-set-decrypt-key.c
aes-set-decrypt-key.c
+7
-7
aes-set-encrypt-key.c
aes-set-encrypt-key.c
+1
-1
aes.h
aes.h
+1
-1
No files found.
ChangeLog
View file @
614a672e
2013-05-17 Niels Möller <nisse@lysator.liu.se>
2013-05-17 Niels Möller <nisse@lysator.liu.se>
* aes.h (struct aes_ctx): Renamed nrounds to rounds, and moved
first in the structure.
* aes-set-encrypt-key.c (aes_set_encrypt_key): Updated for renaming.
* aes-set-decrypt-key.c (aes_invert_key): Likewise.
* aes-encrypt-internal.c (_nettle_aes_encrypt): Take rounds and
* aes-encrypt-internal.c (_nettle_aes_encrypt): Take rounds and
subkeys as separate arguments, not a struct aes_ctx *. Updated
subkeys as separate arguments, not a struct aes_ctx *. Updated
callers.
callers.
...
...
aes-decrypt.c
View file @
614a672e
...
@@ -342,6 +342,6 @@ aes_decrypt(const struct aes_ctx *ctx,
...
@@ -342,6 +342,6 @@ aes_decrypt(const struct aes_ctx *ctx,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
_aes_decrypt
(
ctx
->
n
rounds
,
ctx
->
keys
,
&
_aes_decrypt_table
,
_aes_decrypt
(
ctx
->
rounds
,
ctx
->
keys
,
&
_aes_decrypt_table
,
length
,
dst
,
src
);
length
,
dst
,
src
);
}
}
aes-encrypt.c
View file @
614a672e
...
@@ -40,6 +40,6 @@ aes_encrypt(const struct aes_ctx *ctx,
...
@@ -40,6 +40,6 @@ aes_encrypt(const struct aes_ctx *ctx,
const
uint8_t
*
src
)
const
uint8_t
*
src
)
{
{
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
assert
(
!
(
length
%
AES_BLOCK_SIZE
)
);
_aes_encrypt
(
ctx
->
n
rounds
,
ctx
->
keys
,
&
_aes_encrypt_table
,
_aes_encrypt
(
ctx
->
rounds
,
ctx
->
keys
,
&
_aes_encrypt_table
,
length
,
dst
,
src
);
length
,
dst
,
src
);
}
}
aes-set-decrypt-key.c
View file @
614a672e
...
@@ -126,10 +126,10 @@ void
...
@@ -126,10 +126,10 @@ void
aes_invert_key
(
struct
aes_ctx
*
dst
,
aes_invert_key
(
struct
aes_ctx
*
dst
,
const
struct
aes_ctx
*
src
)
const
struct
aes_ctx
*
src
)
{
{
unsigned
n
rounds
;
unsigned
rounds
;
unsigned
i
;
unsigned
i
;
nrounds
=
src
->
n
rounds
;
rounds
=
src
->
rounds
;
/* Reverse the order of subkeys, in groups of 4. */
/* Reverse the order of subkeys, in groups of 4. */
/* FIXME: Instead of reordering the subkeys, change the access order
/* FIXME: Instead of reordering the subkeys, change the access order
...
@@ -138,7 +138,7 @@ aes_invert_key(struct aes_ctx *dst,
...
@@ -138,7 +138,7 @@ aes_invert_key(struct aes_ctx *dst,
{
{
unsigned
j
,
k
;
unsigned
j
,
k
;
for
(
i
=
0
,
j
=
n
rounds
*
4
;
for
(
i
=
0
,
j
=
rounds
*
4
;
i
<
j
;
i
<
j
;
i
+=
4
,
j
-=
4
)
i
+=
4
,
j
-=
4
)
for
(
k
=
0
;
k
<
4
;
k
++
)
for
(
k
=
0
;
k
<
4
;
k
++
)
...
@@ -148,14 +148,14 @@ aes_invert_key(struct aes_ctx *dst,
...
@@ -148,14 +148,14 @@ aes_invert_key(struct aes_ctx *dst,
{
{
unsigned
k
;
unsigned
k
;
dst
->
nrounds
=
n
rounds
;
dst
->
rounds
=
rounds
;
for
(
i
=
0
;
i
<=
n
rounds
*
4
;
i
+=
4
)
for
(
i
=
0
;
i
<=
rounds
*
4
;
i
+=
4
)
for
(
k
=
0
;
k
<
4
;
k
++
)
for
(
k
=
0
;
k
<
4
;
k
++
)
dst
->
keys
[
i
+
k
]
=
src
->
keys
[
n
rounds
*
4
-
i
+
k
];
dst
->
keys
[
i
+
k
]
=
src
->
keys
[
rounds
*
4
-
i
+
k
];
}
}
/* Transform all subkeys but the first and last. */
/* Transform all subkeys but the first and last. */
for
(
i
=
4
;
i
<
4
*
n
rounds
;
i
++
)
for
(
i
=
4
;
i
<
4
*
rounds
;
i
++
)
MIX_COLUMN
(
mtable
,
dst
->
keys
[
i
]);
MIX_COLUMN
(
mtable
,
dst
->
keys
[
i
]);
}
}
...
...
aes-set-encrypt-key.c
View file @
614a672e
...
@@ -61,7 +61,7 @@ aes_set_encrypt_key(struct aes_ctx *ctx,
...
@@ -61,7 +61,7 @@ aes_set_encrypt_key(struct aes_ctx *ctx,
}
}
lastkey
=
(
AES_BLOCK_SIZE
/
4
)
*
(
nr
+
1
);
lastkey
=
(
AES_BLOCK_SIZE
/
4
)
*
(
nr
+
1
);
ctx
->
n
rounds
=
nr
;
ctx
->
rounds
=
nr
;
for
(
i
=
0
,
rp
=
rcon
;
i
<
nk
;
i
++
)
for
(
i
=
0
,
rp
=
rcon
;
i
<
nk
;
i
++
)
ctx
->
keys
[
i
]
=
LE_READ_UINT32
(
key
+
i
*
4
);
ctx
->
keys
[
i
]
=
LE_READ_UINT32
(
key
+
i
*
4
);
...
...
aes.h
View file @
614a672e
...
@@ -53,8 +53,8 @@ extern "C" {
...
@@ -53,8 +53,8 @@ extern "C" {
sizes? */
sizes? */
struct
aes_ctx
struct
aes_ctx
{
{
unsigned
rounds
;
/* number of rounds to use for our key size */
uint32_t
keys
[
60
];
/* maximum size of key schedule */
uint32_t
keys
[
60
];
/* maximum size of key schedule */
unsigned
nrounds
;
/* number of rounds to use for our key size */
};
};
void
void
...
...
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