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
Nettle
nettle
Commits
595e0d66
Commit
595e0d66
authored
Feb 05, 2018
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for x86_64 sha_ni extension.
parent
d4417d99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
ChangeLog
ChangeLog
+6
-0
fat-x86_64.c
fat-x86_64.c
+13
-4
x86_64/fat/cpuid.asm
x86_64/fat/cpuid.asm
+2
-1
No files found.
ChangeLog
View file @
595e0d66
2018-02-05 Niels Möller <nisse@lysator.liu.se>
* fat-x86_64.c (get_x86_features): Check for sha_ni extension.
* x86_64/fat/cpuid.asm: Clear %ecx input to cpuid instruction.
2018-02-01 Nikos Mavrogiannopoulos <nmav@redhat.com>
* gcm.c (gcm_fill): New function, for use with _ctr_crypt16.
...
...
fat-x86_64.c
View file @
595e0d66
...
...
@@ -52,6 +52,7 @@ struct x86_features
{
enum
x86_vendor
{
X86_OTHER
,
X86_INTEL
,
X86_AMD
}
vendor
;
int
have_aesni
;
int
have_sha_ni
;
};
#define SKIP(s, slen, literal, llen) \
...
...
@@ -66,6 +67,7 @@ get_x86_features (struct x86_features *features)
const
char
*
s
;
features
->
vendor
=
X86_OTHER
;
features
->
have_aesni
=
0
;
features
->
have_sha_ni
=
0
;
s
=
secure_getenv
(
ENV_OVERRIDE
);
if
(
s
)
...
...
@@ -84,9 +86,11 @@ get_x86_features (struct x86_features *features)
}
else
if
(
MATCH
(
s
,
length
,
"aesni"
,
5
))
features
->
have_aesni
=
1
;
else
if
(
MATCH
(
s
,
length
,
"sha_ni"
,
6
))
features
->
have_sha_ni
=
1
;
if
(
!
sep
)
break
;
s
=
sep
+
1
;
s
=
sep
+
1
;
}
else
{
...
...
@@ -99,7 +103,11 @@ get_x86_features (struct x86_features *features)
_nettle_cpuid
(
1
,
cpuid_data
);
if
(
cpuid_data
[
2
]
&
0x02000000
)
features
->
have_aesni
=
1
;
features
->
have_aesni
=
1
;
_nettle_cpuid
(
7
,
cpuid_data
);
if
(
cpuid_data
[
1
]
&
0x20000000
)
features
->
have_sha_ni
=
1
;
}
}
...
...
@@ -135,9 +143,10 @@ fat_init (void)
{
const
char
*
const
vendor_names
[
3
]
=
{
"other"
,
"intel"
,
"amd"
};
fprintf
(
stderr
,
"libnettle: cpu features: vendor:%s%s
\n
"
,
fprintf
(
stderr
,
"libnettle: cpu features: vendor:%s%s
%s
\n
"
,
vendor_names
[
features
.
vendor
],
features
.
have_aesni
?
",aesni"
:
""
);
features
.
have_aesni
?
",aesni"
:
""
,
features
.
have_sha_ni
?
",sha_ni"
:
""
);
}
if
(
features
.
have_aesni
)
{
...
...
x86_64/fat/cpuid.asm
View file @
595e0d66
...
...
@@ -43,8 +43,9 @@ C output pointer: %rsi
PROLOGUE
(
_nettle_cpuid
)
W64_ENTRY
(
2
)
push
%
rbx
movl
%
edi
,
%
eax
xorl
%
ecx
,
%
ecx
C
Information
we
need
use
ecx
=
0
cpuid
mov
%
eax
,
(
%
rsi
)
mov
%
ebx
,
4
(
%
rsi
)
...
...
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