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
530014f3
Commit
530014f3
authored
10 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
x86_64: new aes assembly, using aesni instructions.
parent
86dcf2f3
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
configure.ac
+7
-0
7 additions, 0 deletions
configure.ac
x86_64/aesni/aes-decrypt-internal.asm
+96
-0
96 additions, 0 deletions
x86_64/aesni/aes-decrypt-internal.asm
x86_64/aesni/aes-encrypt-internal.asm
+96
-0
96 additions, 0 deletions
x86_64/aesni/aes-encrypt-internal.asm
with
203 additions
and
0 deletions
ChangeLog
+
4
−
0
View file @
530014f3
2015-01-11 Niels Möller <nisse@lysator.liu.se>
2015-01-11 Niels Möller <nisse@lysator.liu.se>
* x86_64/aesni/aes-decrypt-internal.asm: New file.
* x86_64/aesni/aes-encrypt-internal.asm: New file.
* configure.ac: New configure flag --enable-x86-aesni.
* aclocal.m4 (LSH_RPATH_INIT): Handle freebsd, in the same way as
* aclocal.m4 (LSH_RPATH_INIT): Handle freebsd, in the same way as
gnu/linux, with -Wl,-rpath,.
gnu/linux, with -Wl,-rpath,.
...
...
This diff is collapsed.
Click to expand it.
configure.ac
+
7
−
0
View file @
530014f3
...
@@ -72,6 +72,10 @@ AC_ARG_ENABLE(arm-neon,
...
@@ -72,6 +72,10 @@ AC_ARG_ENABLE(arm-neon,
AC_HELP_STRING([--enable-arm-neon], [Enable ARM Neon assembly. (default=auto)]),,
AC_HELP_STRING([--enable-arm-neon], [Enable ARM Neon assembly. (default=auto)]),,
[enable_arm_neon=auto])
[enable_arm_neon=auto])
AC_ARG_ENABLE(x86-aesni,
AC_HELP_STRING([--enable-x86-aesni], [Enable x86_64 aes instructions. (default=no)]),,
[enable_x86_aesni=no])
AC_ARG_ENABLE(mini-gmp,
AC_ARG_ENABLE(mini-gmp,
AC_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of libgmp.]),,
AC_HELP_STRING([--enable-mini-gmp], [Enable mini-gmp, used instead of libgmp.]),,
[enable_mini_gmp=no])
[enable_mini_gmp=no])
...
@@ -239,6 +243,9 @@ if test "x$enable_assembler" = xyes ; then
...
@@ -239,6 +243,9 @@ if test "x$enable_assembler" = xyes ; then
[x86_64 | amd64])
[x86_64 | amd64])
if test "$ABI" = 64 ; then
if test "$ABI" = 64 ; then
asm_path=x86_64
asm_path=x86_64
if test "x$enable_x86_aesni" = xyes ; then
asm_path="x86_64/aesni $asm_path"
fi
else
else
asm_path=x86
asm_path=x86
fi
fi
...
...
This diff is collapsed.
Click to expand it.
x86_64/aesni/aes-decrypt-internal.asm
0 → 100644
+
96
−
0
View file @
530014f3
C
x86_64
/
aesni
/
aes
-
decrypt
-
internal.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>
)
C
Input
argument
define
(
<
ROUNDS
>
,
<%
rdi
>
)
define
(
<
KEYS
>
,
<%
rsi
>
)
C
define
(
<
TABLE
>
,
<%
rdx
>
)
C
Unused
here
define
(
<
LENGTH
>
,
<%
rcx
>
)
define
(
<
DS
T
>
,
<%
r8
>
)
define
(
<
SRC
>
,
<%
r9
>
)
C
Round
counter
define
(
<
CNT
>
,
<%
rdx
>
)
C
Subkey
pointer
define
(
<
KEY
>
,
<%
rax
>
)
.arch
bdver2
.file
"
aes
-
decrypt
-
internal.asm
"
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
)
.text
ALIGN
(
16
)
PROLOGUE
(
_nettle_aes_decrypt
)
W64_ENTRY
(
6
,
2
)
shr
$
4
,
LENGTH
test
LENGTH
,
LENGTH
jz
.Lend
decl
XREG
(
ROUNDS
)
.Lblock_loop:
mov
ROUNDS
,
CNT
mov
KEYS
,
KEY
movups
(
SRC
),
%
xmm0
C
FIXME
:
Better
al
ignment
of
subkeys
,
so
we
can
use
movaps.
movups
(
KEY
),
%
xmm1
pxor
%
xmm1
,
%
xmm0
C
FIXME
:
Could
use
some
unrolling.
Al
so
al
l
subkeys
fit
in
C
registers
,
so
they
could
be
loaded
once
(
on
W64
we
would
C
need
to
save
and
restore
some
xmm
registers
,
though
)
.
.Lround_loop:
add
$
16
,
KEY
movups
(
KEY
),
%
xmm1
aesdec
%
xmm1
,
%
xmm0
decl
XREG
(
CNT
)
jnz
.Lround_loop
movups
16
(
KEY
),
%
xmm1
aesdeclast
%
xmm1
,
%
xmm0
movups
%
xmm0
,
(
DS
T
)
add
$
16
,
SRC
add
$
16
,
DS
T
dec
LENGTH
jnz
.Lblock_loop
.Lend:
W64_EXIT
(
6
,
2
)
ret
EPILOGUE
(
_nettle_aes_decrypt
)
This diff is collapsed.
Click to expand it.
x86_64/aesni/aes-encrypt-internal.asm
0 → 100644
+
96
−
0
View file @
530014f3
C
x86_64
/
aesni
/
aes
-
encrypt
-
internal.asm
ifelse
(
<
Copyright
(
C
)
2015
Niels
M
ö
ller
This
file
is
part
of
GNU
Nettle.
GNU
Nettle
is
free
software
:
you
can
redistribute
it
and
/
or
modify
it
under
the
terms
of
either
:
*
the
GNU
Lesser
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 3 of the License, or (at your
option
)
any
later
version.
or
*
the
GNU
General
Public
License
as
published
by
the
Free
Software
Foundation
; either version 2 of the License, or (at your
option
)
any
later
version.
or
both
in
parallel
,
as
here.
GNU
Nettle
is
di
stributed
in
the
hope
that
it
will
be
useful
,
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE.
See
the
GNU
General
Public
License
for
more
details.
You
should
have
received
copies
of
the
GNU
General
Public
License
and
the
GNU
Lesser
General
Public
License
al
ong
with
this
program.
If
not
,
see
http
:
//
www.gnu.org
/
licenses
/
.
>
)
C
Input
argument
define
(
<
ROUNDS
>
,
<%
rdi
>
)
define
(
<
KEYS
>
,
<%
rsi
>
)
C
define
(
<
TABLE
>
,
<%
rdx
>
)
C
Unused
here
define
(
<
LENGTH
>
,
<%
rcx
>
)
define
(
<
DS
T
>
,
<%
r8
>
)
define
(
<
SRC
>
,
<%
r9
>
)
C
Round
counter
define
(
<
CNT
>
,
<%
rdx
>
)
C
Subkey
pointer
define
(
<
KEY
>
,
<%
rax
>
)
.arch
bdver2
.file
"
aes
-
encrypt
-
internal.asm
"
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
)
.text
ALIGN
(
16
)
PROLOGUE
(
_nettle_aes_encrypt
)
W64_ENTRY
(
6
,
2
)
shr
$
4
,
LENGTH
test
LENGTH
,
LENGTH
jz
.Lend
decl
XREG
(
ROUNDS
)
.Lblock_loop:
mov
ROUNDS
,
CNT
mov
KEYS
,
KEY
movups
(
SRC
),
%
xmm0
C
FIXME
:
Better
al
ignment
of
subkeys
,
so
we
can
use
movaps.
movups
(
KEY
),
%
xmm1
pxor
%
xmm1
,
%
xmm0
C
FIXME
:
Could
use
some
unrolling.
Al
so
al
l
subkeys
fit
in
C
registers
,
so
they
could
be
loaded
once
(
on
W64
we
would
C
need
to
save
and
restore
some
xmm
registers
,
though
)
.
.Lround_loop:
add
$
16
,
KEY
movups
(
KEY
),
%
xmm1
aesenc
%
xmm1
,
%
xmm0
decl
XREG
(
CNT
)
jnz
.Lround_loop
movups
16
(
KEY
),
%
xmm1
aesenclast
%
xmm1
,
%
xmm0
movups
%
xmm0
,
(
DS
T
)
add
$
16
,
SRC
add
$
16
,
DS
T
dec
LENGTH
jnz
.Lblock_loop
.Lend:
W64_EXIT
(
6
,
2
)
ret
EPILOGUE
(
_nettle_aes_encrypt
)
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