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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nettle
nettle
Commits
eb819e1e
Commit
eb819e1e
authored
19 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
* sparc/machine.m4: Don't use m4 eval, instead rely on the
assembler's arithmetic. Rev: src/nettle/sparc/machine.m4:1.12
parent
f68a96f4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sparc/machine.m4
+11
-17
11 additions, 17 deletions
sparc/machine.m4
with
11 additions
and
17 deletions
sparc/machine.m4
+
11
−
17
View file @
eb819e1e
C FIXME: Do we need an OFFSET macro? Or is it fine to use expressions such as [%i1 + 0]
C FIXME: How much can we rely on the assembler to be able to
C understand arithmetic expressions? Mayby we don't need to use m4
C eval.
C Used as temporaries by the AES macros
C Used as temporaries by the AES macros
define(<TMP1>, <%g1>)
define(<TMP1>, <%g1>)
define(<TMP2>, <%g2>)
define(<TMP2>, <%g2>)
...
@@ -17,19 +11,19 @@ define(<T3>, <%o3>)
...
@@ -17,19 +11,19 @@ define(<T3>, <%o3>)
C AES_LOAD(i, src, key, res)
C AES_LOAD(i, src, key, res)
define(<AES_LOAD>, <
define(<AES_LOAD>, <
ldub [$2 +
eval(
4*$1
)
], $4
ldub [$2 + 4*$1], $4
ldub [$2 +
eval(
4*$1 + 1
)
], TMP1
ldub [$2 + 4*$1 + 1], TMP1
ldub [$2 +
eval(
4*$1 + 2
)
], TMP2
ldub [$2 + 4*$1 + 2], TMP2
sll TMP1, 8, TMP1
sll TMP1, 8, TMP1
or $4, TMP1, $4
or $4, TMP1, $4
ldub [$2 +
eval(
4*$1+3
)
], TMP1
ldub [$2 + 4*$1+3], TMP1
sll TMP2, 16, TMP2
sll TMP2, 16, TMP2
or $4, TMP2, $4
or $4, TMP2, $4
sll TMP1, 24, TMP1
sll TMP1, 24, TMP1
C Get subkey
C Get subkey
ld [$3 +
eval(
4*$1
)
], TMP2
ld [$3 + 4*$1], TMP2
or $4, TMP1, $4
or $4, TMP1, $4
xor $4, TMP2, $4>)dnl
xor $4, TMP2, $4>)dnl
...
@@ -52,7 +46,7 @@ define(<AES_ROUND>, <
...
@@ -52,7 +46,7 @@ define(<AES_ROUND>, <
ld [T2 + TMP1], TMP1 C 2
ld [T2 + TMP1], TMP1 C 2
and TMP2, 0x3fc, TMP2 C 3
and TMP2, 0x3fc, TMP2 C 3
xor $7, TMP1, $7 C 2 E2
xor $7, TMP1, $7 C 2 E2
ld [$6 +
eval(
4*$1
)
], TMP1 C 4
ld [$6 + 4*$1], TMP1 C 4
ld [T3 + TMP2], TMP2 C 3
ld [T3 + TMP2], TMP2 C 3
xor $7, TMP1, $7 C 4 E4
xor $7, TMP1, $7 C 4 E4
xor $7, TMP2, $7 C 3 E3
xor $7, TMP2, $7 C 3 E3
...
@@ -63,7 +57,7 @@ C Compute one word in the final round function. Output is converted to
...
@@ -63,7 +57,7 @@ C Compute one word in the final round function. Output is converted to
C octets and stored at dst. Relies on AES_SBOX being zero.
C octets and stored at dst. Relies on AES_SBOX being zero.
define(<AES_FINAL_ROUND>, <
define(<AES_FINAL_ROUND>, <
C Load subkey
C Load subkey
ld [$7 +
eval(
4*$1
)
], TMP3
ld [$7 + 4*$1], TMP3
and $3, 0xff, TMP1 C 0
and $3, 0xff, TMP1 C 0
srl $4, 8, TMP2 C 1
srl $4, 8, TMP2 C 1
...
@@ -71,20 +65,20 @@ define(<AES_FINAL_ROUND>, <
...
@@ -71,20 +65,20 @@ define(<AES_FINAL_ROUND>, <
and TMP2, 0xff, TMP2 C 1
and TMP2, 0xff, TMP2 C 1
xor TMP3, TMP1, TMP1 C 0
xor TMP3, TMP1, TMP1 C 0
ldub [T + TMP2], TMP2 C 1
ldub [T + TMP2], TMP2 C 1
stb TMP1, [$8 +
eval(
4*$1
)
] C 0 E0
stb TMP1, [$8 + 4*$1] C 0 E0
srl $5, 16, TMP1 C 2
srl $5, 16, TMP1 C 2
srl TMP3, 8, TMP3 C 1
srl TMP3, 8, TMP3 C 1
and TMP1, 0xff, TMP1 C 2
and TMP1, 0xff, TMP1 C 2
xor TMP3, TMP2, TMP2 C 1
xor TMP3, TMP2, TMP2 C 1
ldub [T + TMP1], TMP1 C 2
ldub [T + TMP1], TMP1 C 2
stb TMP2, [$8 +
eval(
4*$1 + 1
)
] C 1 E1
stb TMP2, [$8 + 4*$1 + 1] C 1 E1
srl $6, 24, TMP2 C 3
srl $6, 24, TMP2 C 3
srl TMP3, 8, TMP3 C 2
srl TMP3, 8, TMP3 C 2
ldub [T + TMP2], TMP2 C 3
ldub [T + TMP2], TMP2 C 3
xor TMP3, TMP1, TMP1 C 2
xor TMP3, TMP1, TMP1 C 2
srl TMP3, 8, TMP3 C 3
srl TMP3, 8, TMP3 C 3
stb TMP1, [$8 +
eval(
4*$1 + 2
)
] C 2 E2
stb TMP1, [$8 + 4*$1 + 2] C 2 E2
xor TMP3, TMP2, TMP2 C 3
xor TMP3, TMP2, TMP2 C 3
stb TMP2, [$8 +
eval(
4*$1 + 3
)
] C 3 E3
stb TMP2, [$8 + 4*$1 + 3] C 3 E3
>)
>)
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