Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Wim Lewis
nettle
Commits
7192dce7
Commit
7192dce7
authored
May 21, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapted sparc32 and sparc64 aes assembly to new interface.
parent
ef62d439
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
63 deletions
+76
-63
ChangeLog
ChangeLog
+5
-0
sparc32/aes-decrypt-internal.asm
sparc32/aes-decrypt-internal.asm
+17
-15
sparc32/aes-encrypt-internal.asm
sparc32/aes-encrypt-internal.asm
+17
-15
sparc64/aes-decrypt-internal.asm
sparc64/aes-decrypt-internal.asm
+18
-16
sparc64/aes-encrypt-internal.asm
sparc64/aes-encrypt-internal.asm
+19
-17
No files found.
ChangeLog
View file @
7192dce7
2013-05-21 Niels Möller <nisse@lysator.liu.se>
* sparc32/aes-encrypt-internal.asm: Adapted to new interface.
* sparc32/aes-decrypt-internal.asm: Likewise.
* sparc64/aes-encrypt-internal.asm: Likewise.
* sparc64/aes-decrypt-internal.asm: Likewise.
* x86/aes-encrypt-internal.asm: Adapted to new interface.
* x86/aes-decrypt-internal.asm: Likewise.
...
...
sparc32/aes-decrypt-internal.asm
View file @
7192dce7
C
nettle
,
low
-
level
cryptographics
library
C
C
Copyright
(
C
)
2002
,
2005
Niels
M
ö
ller
C
Copyright
(
C
)
2002
,
2005
,
2013
Niels
M
ö
ller
C
C
The
nettle
library
is
free
software
; you can redistribute it and/or modify
C
it
under
the
terms
of
the
GNU
Lesser
General
Public
License
as
published
by
...
...
@@ -20,11 +20,12 @@ C MA 02111-1301, USA.
include_src
(
<
sp
arc32
/
aes.m4
>
)
C
Arguments
define
(
<
CTX
>
,
<%
i0
>
)
define
(
<
T
>
,
<%
i1
>
)
define
(
<
LENGTH
>
,
<%
i2
>
)
define
(
<
DS
T
>
,
<%
i3
>
)
define
(
<
SRC
>
,
<%
i4
>
)
define
(
<
ROUNDS
>
,
<%
i0
>
)
define
(
<
KEYS
>
,
<%
i1
>
)
define
(
<
T
>
,
<%
i2
>
)
define
(
<
LENGTH
>
,
<%
i3
>
)
define
(
<
DS
T
>
,
<%
i4
>
)
define
(
<
SRC
>
,
<%
i5
>
)
C
AES
state
,
two
copies
for
unrolling
...
...
@@ -40,7 +41,7 @@ define(<X3>, <%l7>)
C
%
o0
-%
03
are
used
for
loop
invariants
T0
-
T3
define
(
<
KEY
>
,
<%
o4
>
)
define
(
<
R
OUN
D
>
,
<%
o5
>
)
define
(
<
C
OUN
T
>
,
<%
o5
>
)
C
%
g1
,
%
g2
,
%
g3
are
TMP1
,
TMP2
and
TMP3
...
...
@@ -53,7 +54,7 @@ define(<FRAME_SIZE>, 104)
.file
"
aes
-
decrypt
-
internal.asm
"
C
_aes_decrypt
(
struct
aes_context
*
ctx
,
C
_aes_decrypt
(
unsigned
rounds
,
const
uint32_t
*
keys
,
C
const
struct
aes_table
*
T
,
C
si
ze_t
length
,
uint8_t
*
ds
t
,
C
uint8_t
*
src
)
...
...
@@ -74,22 +75,23 @@ PROLOGUE(_nettle_aes_decrypt)
add
T
,
AES_TABLE2
,
T2
add
T
,
AES_TABLE3
,
T3
C
Must
be
even
,
and
includes
the
final
round
srl
ROUNDS
,
1
,
ROUNDS
C
Last
two
rounds
handled
sp
ecially
sub
ROUNDS
,
1
,
ROUNDS
.Lblock_loop:
C
Read
src
,
and
add
initial
subkey
add
CTX
,
AES_
KEYS
,
KEY
mov
KEYS
,
KEY
AES_LOAD
(
0
,
SRC
,
KEY
,
W0
)
AES_LOAD
(
1
,
SRC
,
KEY
,
W1
)
AES_LOAD
(
2
,
SRC
,
KEY
,
W2
)
AES_LOAD
(
3
,
SRC
,
KEY
,
W3
)
C
Must
be
even
,
and
includes
the
final
round
ld
[
AES_NROUNDS
+
CTX
],
ROUND
mov
ROUNDS
,
COUNT
add
SRC
,
16
,
SRC
add
KEY
,
16
,
KEY
srl
ROUND
,
1
,
ROUND
C
Last
two
rounds
handled
sp
ecially
sub
ROUND
,
1
,
ROUND
.Lround_loop:
C
The
AES_ROUND
macro
uses
T0
,
...
T3
C
Transform
W
->
X
...
...
@@ -104,7 +106,7 @@ PROLOGUE(_nettle_aes_decrypt)
AES_ROUND
(
6
,
X2
,
X1
,
X0
,
X3
,
KEY
,
W2
)
AES_ROUND
(
7
,
X3
,
X2
,
X1
,
X0
,
KEY
,
W3
)
subcc
R
OUN
D
,
1
,
R
OUN
D
subcc
C
OUN
T
,
1
,
C
OUN
T
bne
.Lround_loop
add
KEY
,
32
,
KEY
...
...
sparc32/aes-encrypt-internal.asm
View file @
7192dce7
C
nettle
,
low
-
level
cryptographics
library
C
C
Copyright
(
C
)
2002
,
2005
Niels
M
ö
ller
C
Copyright
(
C
)
2002
,
2005
,
2013
Niels
M
ö
ller
C
C
The
nettle
library
is
free
software
; you can redistribute it and/or modify
C
it
under
the
terms
of
the
GNU
Lesser
General
Public
License
as
published
by
...
...
@@ -20,11 +20,12 @@ C MA 02111-1301, USA.
include_src
(
<
sp
arc32
/
aes.m4
>
)
C
Arguments
define
(
<
CTX
>
,
<%
i0
>
)
define
(
<
T
>
,
<%
i1
>
)
define
(
<
LENGTH
>
,
<%
i2
>
)
define
(
<
DS
T
>
,
<%
i3
>
)
define
(
<
SRC
>
,
<%
i4
>
)
define
(
<
ROUNDS
>
,
<%
i0
>
)
define
(
<
KEYS
>
,
<%
i1
>
)
define
(
<
T
>
,
<%
i2
>
)
define
(
<
LENGTH
>
,
<%
i3
>
)
define
(
<
DS
T
>
,
<%
i4
>
)
define
(
<
SRC
>
,
<%
i5
>
)
C
AES
state
,
two
copies
for
unrolling
...
...
@@ -40,7 +41,7 @@ define(<X3>, <%l7>)
C
%
o0
-%
03
are
used
for
loop
invariants
T0
-
T3
define
(
<
KEY
>
,
<%
o4
>
)
define
(
<
R
OUN
D
>
,
<%
o5
>
)
define
(
<
C
OUN
T
>
,
<%
o5
>
)
C
%
g1
,
%
g2
,
%
g3
are
TMP1
,
TMP2
and
TMP3
...
...
@@ -58,7 +59,7 @@ define(<FRAME_SIZE>, 104)
.file
"
aes
-
encrypt
-
internal.asm
"
C
_aes_encrypt
(
struct
aes_context
*
ctx
,
C
_aes_encrypt
(
unsigned
rounds
,
const
uint32_t
*
keys
,
C
const
struct
aes_table
*
T
,
C
si
ze_t
length
,
uint8_t
*
ds
t
,
C
uint8_t
*
src
)
...
...
@@ -79,22 +80,23 @@ PROLOGUE(_nettle_aes_encrypt)
add
T
,
AES_TABLE2
,
T2
add
T
,
AES_TABLE3
,
T3
C
Must
be
even
,
and
includes
the
final
round
srl
ROUNDS
,
1
,
ROUNDS
C
Last
two
rounds
handled
sp
ecially
sub
ROUNDS
,
1
,
ROUNDS
.Lblock_loop:
C
Read
src
,
and
add
initial
subkey
add
CTX
,
AES_
KEYS
,
KEY
mov
KEYS
,
KEY
AES_LOAD
(
0
,
SRC
,
KEY
,
W0
)
AES_LOAD
(
1
,
SRC
,
KEY
,
W1
)
AES_LOAD
(
2
,
SRC
,
KEY
,
W2
)
AES_LOAD
(
3
,
SRC
,
KEY
,
W3
)
C
Must
be
even
,
and
includes
the
final
round
ld
[
AES_NROUNDS
+
CTX
],
ROUND
mov
ROUNDS
,
COUNT
add
SRC
,
16
,
SRC
add
KEY
,
16
,
KEY
srl
ROUND
,
1
,
ROUND
C
Last
two
rounds
handled
sp
ecially
sub
ROUND
,
1
,
ROUND
.Lround_loop:
C
The
AES_ROUND
macro
uses
T0
,
...
T3
C
Transform
W
->
X
...
...
@@ -109,7 +111,7 @@ PROLOGUE(_nettle_aes_encrypt)
AES_ROUND
(
6
,
X2
,
X3
,
X0
,
X1
,
KEY
,
W2
)
AES_ROUND
(
7
,
X3
,
X0
,
X1
,
X2
,
KEY
,
W3
)
subcc
R
OUN
D
,
1
,
R
OUN
D
subcc
C
OUN
T
,
1
,
C
OUN
T
bne
.Lround_loop
add
KEY
,
32
,
KEY
...
...
sparc64/aes-decrypt-internal.asm
View file @
7192dce7
C
nettle
,
low
-
level
cryptographics
library
C
C
Copyright
(
C
)
2002
,
2005
Niels
M
ö
ller
C
Copyright
(
C
)
2002
,
2005
,
2013
Niels
M
ö
ller
C
C
The
nettle
library
is
free
software
; you can redistribute it and/or modify
C
it
under
the
terms
of
the
GNU
Lesser
General
Public
License
as
published
by
...
...
@@ -23,14 +23,15 @@ C doesn't matter, since we don't access any data on the stack).
C
Use
the
same
AES
macros
as
on
sp
arc32.
include_src
(
sp
arc32
/
aes.m4
)
include_src
(
<
sp
arc32
/
aes.m4
>
)
C
Arguments
define
(
<
CTX
>
,
<%
i0
>
)
define
(
<
T
>
,
<%
i1
>
)
define
(
<
LENGTH
>
,
<%
i2
>
)
define
(
<
DS
T
>
,
<%
i3
>
)
define
(
<
SRC
>
,
<%
i4
>
)
define
(
<
ROUNDS
>
,
<%
i0
>
)
define
(
<
KEYS
>
,
<%
i1
>
)
define
(
<
T
>
,
<%
i2
>
)
define
(
<
LENGTH
>
,
<%
i3
>
)
define
(
<
DS
T
>
,
<%
i4
>
)
define
(
<
SRC
>
,
<%
i5
>
)
C
AES
state
,
two
copies
for
unrolling
...
...
@@ -46,7 +47,7 @@ define(<X3>, <%l7>)
C
%
o0
-%
03
are
used
for
loop
invariants
T0
-
T3
define
(
<
KEY
>
,
<%
o4
>
)
define
(
<
R
OUN
D
>
,
<%
o5
>
)
define
(
<
C
OUN
T
>
,
<%
o5
>
)
C
%
g1
,
%
g2
,
%
g3
are
TMP1
,
TMP2
and
TMP3
...
...
@@ -59,7 +60,7 @@ define(<FRAME_SIZE>, 192)
.file
"
aes
-
decrypt
-
internal.asm
"
C
_aes_decrypt
(
struct
aes_context
*
ctx
,
C
_aes_decrypt
(
unsigned
rounds
,
const
uint32_t
*
keys
,
C
const
struct
aes_table
*
T
,
C
si
ze_t
length
,
uint8_t
*
ds
t
,
C
uint8_t
*
src
)
...
...
@@ -80,22 +81,23 @@ PROLOGUE(_nettle_aes_decrypt)
add
T
,
AES_TABLE2
,
T2
add
T
,
AES_TABLE3
,
T3
C
Must
be
even
,
and
includes
the
final
round
srl
ROUNDS
,
1
,
ROUNDS
C
Last
two
rounds
handled
sp
ecially
sub
ROUNDS
,
1
,
ROUNDS
.Lblock_loop:
C
Read
src
,
and
add
initial
subkey
add
CTX
,
AES_
KEYS
,
KEY
mov
KEYS
,
KEY
AES_LOAD
(
0
,
SRC
,
KEY
,
W0
)
AES_LOAD
(
1
,
SRC
,
KEY
,
W1
)
AES_LOAD
(
2
,
SRC
,
KEY
,
W2
)
AES_LOAD
(
3
,
SRC
,
KEY
,
W3
)
C
Must
be
even
,
and
includes
the
final
round
ld
[
AES_NROUNDS
+
CTX
],
ROUND
mov
ROUNDS
,
COUNT
add
SRC
,
16
,
SRC
add
KEY
,
16
,
KEY
srl
ROUND
,
1
,
ROUND
C
Last
two
rounds
handled
sp
ecially
sub
ROUND
,
1
,
ROUND
.Lround_loop:
C
The
AES_ROUND
macro
uses
T0
,
...
T3
C
Transform
W
->
X
...
...
@@ -110,7 +112,7 @@ PROLOGUE(_nettle_aes_decrypt)
AES_ROUND
(
6
,
X2
,
X1
,
X0
,
X3
,
KEY
,
W2
)
AES_ROUND
(
7
,
X3
,
X2
,
X1
,
X0
,
KEY
,
W3
)
subcc
R
OUN
D
,
1
,
R
OUN
D
subcc
C
OUN
T
,
1
,
C
OUN
T
bne
.Lround_loop
add
KEY
,
32
,
KEY
...
...
sparc64/aes-encrypt-internal.asm
View file @
7192dce7
C
nettle
,
low
-
level
cryptographics
library
C
C
Copyright
(
C
)
2002
,
2005
Niels
M
ö
ller
C
Copyright
(
C
)
2002
,
2005
,
2013
Niels
M
ö
ller
C
C
The
nettle
library
is
free
software
; you can redistribute it and/or modify
C
it
under
the
terms
of
the
GNU
Lesser
General
Public
License
as
published
by
...
...
@@ -23,14 +23,15 @@ C doesn't matter, since we don't access any data on the stack).
C
Use
the
same
AES
macros
as
on
sp
arc32.
include_src
(
sp
arc32
/
aes.m4
)
include_src
(
<
sp
arc32
/
aes.m4
>
)
C
Arguments
define
(
<
CTX
>
,
<%
i0
>
)
define
(
<
T
>
,
<%
i1
>
)
define
(
<
LENGTH
>
,
<%
i2
>
)
define
(
<
DS
T
>
,
<%
i3
>
)
define
(
<
SRC
>
,
<%
i4
>
)
define
(
<
ROUNDS
>
,
<%
i0
>
)
define
(
<
KEYS
>
,
<%
i1
>
)
define
(
<
T
>
,
<%
i2
>
)
define
(
<
LENGTH
>
,
<%
i3
>
)
define
(
<
DS
T
>
,
<%
i4
>
)
define
(
<
SRC
>
,
<%
i5
>
)
C
AES
state
,
two
copies
for
unrolling
...
...
@@ -46,10 +47,10 @@ define(<X3>, <%l7>)
C
%
o0
-%
03
are
used
for
loop
invariants
T0
-
T3
define
(
<
KEY
>
,
<%
o4
>
)
define
(
<
R
OUN
D
>
,
<%
o5
>
)
define
(
<
C
OUN
T
>
,
<%
o5
>
)
C
%
g1
,
%
g2
,
%
g3
are
TMP1
,
TMP2
and
TMP3
C
The
sp
arc64
stack
frame
looks
like
C
C
%
fp
-
8
:
OS
-
dependent
link
field
...
...
@@ -59,7 +60,7 @@ define(<FRAME_SIZE>, 192)
.file
"
aes
-
encrypt
-
internal.asm
"
C
_aes_encrypt
(
struct
aes_context
*
ctx
,
C
_aes_encrypt
(
unsigned
rounds
,
const
uint32_t
*
keys
,
C
const
struct
aes_table
*
T
,
C
si
ze_t
length
,
uint8_t
*
ds
t
,
C
uint8_t
*
src
)
...
...
@@ -80,22 +81,23 @@ PROLOGUE(_nettle_aes_encrypt)
add
T
,
AES_TABLE2
,
T2
add
T
,
AES_TABLE3
,
T3
C
Must
be
even
,
and
includes
the
final
round
srl
ROUNDS
,
1
,
ROUNDS
C
Last
two
rounds
handled
sp
ecially
sub
ROUNDS
,
1
,
ROUNDS
.Lblock_loop:
C
Read
src
,
and
add
initial
subkey
add
CTX
,
AES_
KEYS
,
KEY
mov
KEYS
,
KEY
AES_LOAD
(
0
,
SRC
,
KEY
,
W0
)
AES_LOAD
(
1
,
SRC
,
KEY
,
W1
)
AES_LOAD
(
2
,
SRC
,
KEY
,
W2
)
AES_LOAD
(
3
,
SRC
,
KEY
,
W3
)
C
Must
be
even
,
and
includes
the
final
round
ld
[
AES_NROUNDS
+
CTX
],
ROUND
mov
ROUNDS
,
COUNT
add
SRC
,
16
,
SRC
add
KEY
,
16
,
KEY
srl
ROUND
,
1
,
ROUND
C
Last
two
rounds
handled
sp
ecially
sub
ROUND
,
1
,
ROUND
.Lround_loop:
C
The
AES_ROUND
macro
uses
T0
,
...
T3
C
Transform
W
->
X
...
...
@@ -110,7 +112,7 @@ PROLOGUE(_nettle_aes_encrypt)
AES_ROUND
(
6
,
X2
,
X3
,
X0
,
X1
,
KEY
,
W2
)
AES_ROUND
(
7
,
X3
,
X0
,
X1
,
X2
,
KEY
,
W3
)
subcc
R
OUN
D
,
1
,
R
OUN
D
subcc
C
OUN
T
,
1
,
C
OUN
T
bne
.Lround_loop
add
KEY
,
32
,
KEY
...
...
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