Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Fábio Silva
scone-test
Commits
a04efb96
Commit
a04efb96
authored
Oct 30, 2019
by
Fábio Silva
Browse files
Add capabilities binary
parent
6b6fa0b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
cap.tar.gz
0 → 100644
View file @
a04efb96
File added
capabilities
0 → 100755
View file @
a04efb96
File added
rdrand.c
0 → 100644
View file @
a04efb96
#include <stdio.h>
#include <string.h>
#include <cpuid.h>
#define bit_RDRND (1 << 30)
void
rdrand
()
{
unsigned
int
eax
;
unsigned
int
ebx
;
unsigned
int
ecx
;
unsigned
int
edx
;
eax
=
0x01
;
__asm__
__volatile__
(
"cpuid;"
:
"=a"
(
eax
),
"=b"
(
ebx
),
"=c"
(
ecx
),
"=d"
(
edx
)
:
"a"
(
eax
)
);
if
(
ecx
&
bit_RDRND
){
//use rdrand
printf
(
"Has RDRND: %d
\n
"
,
1
);
}
else
{
printf
(
"Has RDRND: %d
\n
"
,
0
);
}
}
void
aesni
()
{
unsigned
int
eax
,
ebx
,
ecx
,
edx
;
eax
=
ebx
=
ecx
=
edx
=
0
;
__get_cpuid
(
1
,
&
eax
,
&
ebx
,
&
ecx
,
&
edx
);
printf
(
"Has AES-NI: %d
\n
"
,
(
ecx
&
bit_AES
)
>
0
);
}
int
main
(
int
argc
,
char
**
argv
)
{
rdrand
();
aesni
();
}
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