mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-27 03:40:22 +00:00
Add additiona; test programs
This commit is contained in:
parent
abd8b7a991
commit
1432ae0819
@ -614,3 +614,6 @@ TestPrograms/test_x86_sse3.cxx
|
||||
TestPrograms/test_x86_sse41.cxx
|
||||
TestPrograms/test_x86_sse42.cxx
|
||||
TestPrograms/test_x86_ssse3.cxx
|
||||
TestPrograms/test_x86_via_aes.cxx
|
||||
TestPrograms/test_x86_via_rng.cxx
|
||||
TestPrograms/test_x86_via_sha.cxx
|
||||
|
39
TestPrograms/test_x86_via_aes.cxx
Normal file
39
TestPrograms/test_x86_via_aes.cxx
Normal file
@ -0,0 +1,39 @@
|
||||
// TODO: cut-in xcrypt-ecb
|
||||
#include <cstdlib>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int msr=0;
|
||||
unsigned int divisor=2;
|
||||
unsigned int buffer;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
"mov %1, %%rdi ;\n"
|
||||
"movl %2, %%edx ;\n"
|
||||
#else
|
||||
"mov %1, %%edi ;\n"
|
||||
"movl %2, %%edx ;\n"
|
||||
#endif
|
||||
|
||||
// xstore-rng
|
||||
".byte 0x0f, 0xa7, 0xc0 ;\n"
|
||||
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
"andq %%rax, 0x1f ;\n"
|
||||
"movl %%eax, %0 ;\n"
|
||||
#else
|
||||
"andl %%eax, 0x1f ;\n"
|
||||
"movl %%eax, %0 ;\n"
|
||||
#endif
|
||||
|
||||
: "=g" (msr) : "g" (buffer), "g" (divisor)
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
: "rax", "rdx", "rdi", "cc"
|
||||
#else
|
||||
: "eax", "edx", "edi", "cc"
|
||||
#endif
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
38
TestPrograms/test_x86_via_rng.cxx
Normal file
38
TestPrograms/test_x86_via_rng.cxx
Normal file
@ -0,0 +1,38 @@
|
||||
#include <cstdlib>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int msr=0;
|
||||
unsigned int divisor=2;
|
||||
unsigned int buffer;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
"mov %1, %%rdi ;\n"
|
||||
"movl %2, %%edx ;\n"
|
||||
#else
|
||||
"mov %1, %%edi ;\n"
|
||||
"movl %2, %%edx ;\n"
|
||||
#endif
|
||||
|
||||
// xstore-rng
|
||||
".byte 0x0f, 0xa7, 0xc0 ;\n"
|
||||
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
"andq %%rax, 0x1f ;\n"
|
||||
"movl %%eax, %0 ;\n"
|
||||
#else
|
||||
"andl %%eax, 0x1f ;\n"
|
||||
"movl %%eax, %0 ;\n"
|
||||
#endif
|
||||
|
||||
: "=g" (msr) : "g" (buffer), "g" (divisor)
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
: "rax", "rdx", "rdi", "cc"
|
||||
#else
|
||||
: "eax", "edx", "edi", "cc"
|
||||
#endif
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
39
TestPrograms/test_x86_via_sha.cxx
Normal file
39
TestPrograms/test_x86_via_sha.cxx
Normal file
@ -0,0 +1,39 @@
|
||||
// TODO: cut-in xsha1
|
||||
#include <cstdlib>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int msr=0;
|
||||
unsigned int divisor=2;
|
||||
unsigned int buffer;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
"mov %1, %%rdi ;\n"
|
||||
"movl %2, %%edx ;\n"
|
||||
#else
|
||||
"mov %1, %%edi ;\n"
|
||||
"movl %2, %%edx ;\n"
|
||||
#endif
|
||||
|
||||
// xstore-rng
|
||||
".byte 0x0f, 0xa7, 0xc0 ;\n"
|
||||
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
"andq %%rax, 0x1f ;\n"
|
||||
"movl %%eax, %0 ;\n"
|
||||
#else
|
||||
"andl %%eax, 0x1f ;\n"
|
||||
"movl %%eax, %0 ;\n"
|
||||
#endif
|
||||
|
||||
: "=g" (msr) : "g" (buffer), "g" (divisor)
|
||||
#if (CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
|
||||
: "rax", "rdx", "rdi", "cc"
|
||||
#else
|
||||
: "eax", "edx", "edi", "cc"
|
||||
#endif
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user