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
Dmitry Baryshkov
nettle
Commits
d4a216fe
Commit
d4a216fe
authored
23 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
(IDX0, IDX1, IDX2, IDX3): New macros, encapsualting the
structure of the idx table. Rev: src/nettle/aes.c:1.11
parent
ad04ac04
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aes.c
+17
-12
17 additions, 12 deletions
aes.c
with
17 additions
and
12 deletions
aes.c
+
17
−
12
View file @
d4a216fe
...
...
@@ -68,6 +68,11 @@ d2(const char *aname, uint32_t a, const char *bname, uint32_t b)
#define B2(x) (((x) >> 16) & 0xff)
#define B3(x) (((x) >> 24) & 0xff)
#define IDX0(j) (j)
#define IDX1(j) (T->idx[0][j])
#define IDX2(j) (T->idx[1][j])
#define IDX3(j) (T->idx[2][j])
void
_aes_crypt
(
const
struct
aes_ctx
*
ctx
,
const
struct
aes_table
*
T
,
...
...
@@ -105,15 +110,15 @@ _aes_crypt(const struct aes_ctx *ctx,
* in the wrong direction, but I don't think so. */
#if AES_SMALL
t
[
j
]
=
T
->
table
[
0
][
B0
(
wtxt
[
j
])
]
^
ROTRBYTE
(
T
->
table
[
0
][
B1
(
wtxt
[
T
->
idx
[
0
][
j
]
])
]
^
ROTRBYTE
(
T
->
table
[
0
][
B2
(
wtxt
[
T
->
idx
[
1
][
j
]
])
]
^
ROTRBYTE
(
T
->
table
[
0
][
B3
(
wtxt
[
T
->
idx
[
2
][
j
]
])
])));
t
[
j
]
=
T
->
table
[
0
][
B0
(
wtxt
[
IDX0
(
j
)
])
]
^
ROTRBYTE
(
T
->
table
[
0
][
B1
(
wtxt
[
IDX1
(
j
)
])
]
^
ROTRBYTE
(
T
->
table
[
0
][
B2
(
wtxt
[
IDX2
(
j
)
])
]
^
ROTRBYTE
(
T
->
table
[
0
][
B3
(
wtxt
[
IDX3
(
j
)
])
])));
#else
/* !AES_SMALL */
t
[
j
]
=
(
T
->
table
[
0
][
B0
(
wtxt
[
j
])
]
^
T
->
table
[
1
][
B1
(
wtxt
[
T
->
idx
[
0
][
j
]
])
]
^
T
->
table
[
2
][
B2
(
wtxt
[
T
->
idx
[
1
][
j
]
])
]
^
T
->
table
[
3
][
B3
(
wtxt
[
T
->
idx
[
2
][
j
]
])
]);
t
[
j
]
=
(
T
->
table
[
0
][
B0
(
wtxt
[
IDX0
(
j
)
])
]
^
T
->
table
[
1
][
B1
(
wtxt
[
IDX1
(
j
)
])
]
^
T
->
table
[
2
][
B2
(
wtxt
[
IDX2
(
j
)
])
]
^
T
->
table
[
3
][
B3
(
wtxt
[
IDX3
(
j
)
])
]);
#endif
/* !AES_SMALL */
}
D4
((
"t"
,
round
,
t
));
...
...
@@ -131,10 +136,10 @@ _aes_crypt(const struct aes_ctx *ctx,
* It looks like this code shifts the rows in the wrong
* direction, but it passes the testsuite. */
out
=
(
(
uint32_t
)
T
->
sbox
[
B0
(
wtxt
[
j
])
]
|
((
uint32_t
)
T
->
sbox
[
B1
(
wtxt
[
T
->
idx
[
0
][
j
]
])
]
<<
8
)
|
((
uint32_t
)
T
->
sbox
[
B2
(
wtxt
[
T
->
idx
[
1
][
j
]
])
]
<<
16
)
|
((
uint32_t
)
T
->
sbox
[
B3
(
wtxt
[
T
->
idx
[
2
][
j
]
])
]
<<
24
));
out
=
(
(
uint32_t
)
T
->
sbox
[
B0
(
wtxt
[
IDX0
(
j
)
])
]
|
((
uint32_t
)
T
->
sbox
[
B1
(
wtxt
[
IDX1
(
j
)
])
]
<<
8
)
|
((
uint32_t
)
T
->
sbox
[
B2
(
wtxt
[
IDX2
(
j
)
])
]
<<
16
)
|
((
uint32_t
)
T
->
sbox
[
B3
(
wtxt
[
IDX3
(
j
)
])
]
<<
24
));
D2
((
"t"
,
out
,
"key"
,
ctx
->
keys
[
4
*
round
+
j
]));
...
...
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