Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
e11319dd
Commit
e11319dd
authored
Feb 08, 2018
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support sha_ni sha1_compress in x86_64 fat builds.
parent
0413811a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
ChangeLog
ChangeLog
+7
-0
fat-x86_64.c
fat-x86_64.c
+20
-0
x86_64/fat/sha1-compress-2.asm
x86_64/fat/sha1-compress-2.asm
+34
-0
x86_64/fat/sha1-compress.asm
x86_64/fat/sha1-compress.asm
+34
-0
No files found.
ChangeLog
View file @
e11319dd
2018-02-07 Niels Möller <nisse@lysator.liu.se>
* x86_64/fat/sha1-compress.asm: New file.
* x86_64/fat/sha1-compress-2.asm: New file.
* fat-x86_64.c (fat_init): Select plain x86_64 assembly version or
sha_ni version for sha1_compress.
2018-02-05 Niels Möller <nisse@lysator.liu.se>
2018-02-05 Niels Möller <nisse@lysator.liu.se>
* x86_64/sha_ni/sha1-compress.asm: New implementation using sha_ni
* x86_64/sha_ni/sha1-compress.asm: New implementation using sha_ni
...
...
fat-x86_64.c
View file @
e11319dd
...
@@ -123,6 +123,10 @@ DECLARE_FAT_FUNC(nettle_memxor, memxor_func)
...
@@ -123,6 +123,10 @@ DECLARE_FAT_FUNC(nettle_memxor, memxor_func)
DECLARE_FAT_FUNC_VAR
(
memxor
,
memxor_func
,
x86_64
)
DECLARE_FAT_FUNC_VAR
(
memxor
,
memxor_func
,
x86_64
)
DECLARE_FAT_FUNC_VAR
(
memxor
,
memxor_func
,
sse2
)
DECLARE_FAT_FUNC_VAR
(
memxor
,
memxor_func
,
sse2
)
DECLARE_FAT_FUNC
(
_nettle_sha1_compress
,
sha1_compress_func
)
DECLARE_FAT_FUNC_VAR
(
sha1_compress
,
sha1_compress_func
,
x86_64
)
DECLARE_FAT_FUNC_VAR
(
sha1_compress
,
sha1_compress_func
,
sha_ni
)
/* This function should usually be called only once, at startup. But
/* This function should usually be called only once, at startup. But
it is idempotent, and on x86, pointer updates are atomic, so
it is idempotent, and on x86, pointer updates are atomic, so
there's no danger if it is called simultaneously from multiple
there's no danger if it is called simultaneously from multiple
...
@@ -163,6 +167,18 @@ fat_init (void)
...
@@ -163,6 +167,18 @@ fat_init (void)
_nettle_aes_decrypt_vec
=
_nettle_aes_decrypt_x86_64
;
_nettle_aes_decrypt_vec
=
_nettle_aes_decrypt_x86_64
;
}
}
if
(
features
.
have_sha_ni
)
{
if
(
verbose
)
fprintf
(
stderr
,
"libnettle: using sha_ni instructions.
\n
"
);
_nettle_sha1_compress_vec
=
_nettle_sha1_compress_sha_ni
;
}
else
{
if
(
verbose
)
fprintf
(
stderr
,
"libnettle: not using sha_ni instructions.
\n
"
);
_nettle_sha1_compress_vec
=
_nettle_sha1_compress_x86_64
;
}
if
(
features
.
vendor
==
X86_INTEL
)
if
(
features
.
vendor
==
X86_INTEL
)
{
{
if
(
verbose
)
if
(
verbose
)
...
@@ -194,3 +210,7 @@ DEFINE_FAT_FUNC(_nettle_aes_decrypt, void,
...
@@ -194,3 +210,7 @@ DEFINE_FAT_FUNC(_nettle_aes_decrypt, void,
DEFINE_FAT_FUNC
(
nettle_memxor
,
void
*
,
DEFINE_FAT_FUNC
(
nettle_memxor
,
void
*
,
(
void
*
dst
,
const
void
*
src
,
size_t
n
),
(
void
*
dst
,
const
void
*
src
,
size_t
n
),
(
dst
,
src
,
n
))
(
dst
,
src
,
n
))
DEFINE_FAT_FUNC
(
_nettle_sha1_compress
,
void
,
(
uint32_t
*
state
,
const
uint8_t
*
input
),
(
state
,
input
))
x86_64/fat/sha1-compress-2.asm
0 → 100644
View file @
e11319dd
C
x86_64
/
fat
/
sha1
-
compress
-
2
.asm
ifelse
(
<
Copyright
(
C
)
2018
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
/
.
>)
define
(
<
fat_transform
>
,
<
$
1
_sha_ni
>
)
include_src
(
<
x86_64
/
sha_ni
/
sha1
-
compress.asm
>
)
x86_64/fat/sha1-compress.asm
0 → 100644
View file @
e11319dd
C
x86_64
/
fat
/
sha1
-
compress.asm
ifelse
(
<
Copyright
(
C
)
2018
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
/
.
>)
define
(
<
fat_transform
>
,
<
$
1
_x86_64
>
)
include_src
(
<
x86_64
/
sha1
-
compress.asm
>
)
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