client almost builds
This commit is contained in:
7
vendor/cryptopp/TestPrograms/test_32bit.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_32bit.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <cstddef>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
enum {N = (sizeof(std::size_t) == 4 ? 4 : -1)};
|
||||
int x[N];
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_64bit.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_64bit.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <cstddef>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
enum {N = (sizeof(std::size_t) == 8 ? 8 : -1)};
|
||||
int x[N];
|
||||
return 0;
|
||||
}
|
||||
6
vendor/cryptopp/TestPrograms/test_arm_acle_header.cpp
vendored
Normal file
6
vendor/cryptopp/TestPrograms/test_arm_acle_header.cpp
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <arm_acle.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
14
vendor/cryptopp/TestPrograms/test_arm_aes.cpp
vendored
Normal file
14
vendor/cryptopp/TestPrograms/test_arm_aes.cpp
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint8x16_t x={0};
|
||||
x=vaeseq_u8(x,x);
|
||||
x=vaesmcq_u8(x);
|
||||
x=vaesdq_u8(x,x);
|
||||
x=vaesimcq_u8(x);
|
||||
return 0;
|
||||
}
|
||||
11
vendor/cryptopp/TestPrograms/test_arm_asimd.cpp
vendored
Normal file
11
vendor/cryptopp/TestPrograms/test_arm_asimd.cpp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint32x4_t x={0};
|
||||
x=veorq_u32(x,x);
|
||||
return 0;
|
||||
}
|
||||
23
vendor/cryptopp/TestPrograms/test_arm_crc.cpp
vendored
Normal file
23
vendor/cryptopp/TestPrograms/test_arm_crc.cpp
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
#if (CRYPTOPP_ARM_ACLE_HEADER)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
// Keep sync'd with arm_simd.h
|
||||
#include "../arm_simd.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t w=0xffffffff;
|
||||
|
||||
w = CRC32B(w,w);
|
||||
w = CRC32W(w,w);
|
||||
w = CRC32CB(w,w);
|
||||
w = CRC32CW(w,w);
|
||||
|
||||
return 0;
|
||||
}
|
||||
11
vendor/cryptopp/TestPrograms/test_arm_neon.cpp
vendored
Normal file
11
vendor/cryptopp/TestPrograms/test_arm_neon.cpp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint32x4_t x={0};
|
||||
x=veorq_u32(x,x);
|
||||
return 0;
|
||||
}
|
||||
6
vendor/cryptopp/TestPrograms/test_arm_neon_header.cpp
vendored
Normal file
6
vendor/cryptopp/TestPrograms/test_arm_neon_header.cpp
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <arm_neon.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
26
vendor/cryptopp/TestPrograms/test_arm_pmull.cpp
vendored
Normal file
26
vendor/cryptopp/TestPrograms/test_arm_pmull.cpp
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Keep sync'd with arm_simd.h
|
||||
#include "../arm_simd.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// Linaro is missing a lot of pmull gear. Also see http://github.com/weidai11/cryptopp/issues/233.
|
||||
const uint64_t wa1[]={0,0x9090909090909090}, wb1[]={0,0xb0b0b0b0b0b0b0b0};
|
||||
const uint64x2_t a1=vld1q_u64(wa1), b1=vld1q_u64(wb1);
|
||||
|
||||
const uint8_t wa2[]={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
|
||||
0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0},
|
||||
wb2[]={0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
|
||||
0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0};
|
||||
const uint8x16_t a2=vld1q_u8(wa2), b2=vld1q_u8(wb2);
|
||||
|
||||
const uint64x2_t r1 = PMULL_00(a1, b1);
|
||||
const uint64x2_t r2 = PMULL_11(vreinterpretq_u64_u8(a2),
|
||||
vreinterpretq_u64_u8(b2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
13
vendor/cryptopp/TestPrograms/test_arm_sha1.cpp
vendored
Normal file
13
vendor/cryptopp/TestPrograms/test_arm_sha1.cpp
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint32x4_t y = {0};
|
||||
y=vsha1cq_u32(y,0,y);
|
||||
y=vsha1mq_u32(y,1,y);
|
||||
y=vsha1pq_u32(y,2,y);
|
||||
return 0;
|
||||
}
|
||||
13
vendor/cryptopp/TestPrograms/test_arm_sha256.cpp
vendored
Normal file
13
vendor/cryptopp/TestPrograms/test_arm_sha256.cpp
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint32x4_t y = {0};
|
||||
y=vsha256hq_u32(y, y, y);
|
||||
y=vsha256h2q_u32(y, y, y);
|
||||
y=vsha256su1q_u32(y, y, y);
|
||||
return 0;
|
||||
}
|
||||
19
vendor/cryptopp/TestPrograms/test_arm_sha3.cpp
vendored
Normal file
19
vendor/cryptopp/TestPrograms/test_arm_sha3.cpp
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Keep sync'd with arm_simd.h
|
||||
#include "../arm_simd.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// SHA3 intrinsics are merely ARMv8.2 instructions.
|
||||
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics
|
||||
uint32x4_t x={0}, y={1}, z={2};
|
||||
x=VEOR3(x,y,z);
|
||||
x=VXAR(y,z,6);
|
||||
x=VRAX1(y,z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
17
vendor/cryptopp/TestPrograms/test_arm_sha512.cpp
vendored
Normal file
17
vendor/cryptopp/TestPrograms/test_arm_sha512.cpp
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// SHA512 hash
|
||||
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SHA512
|
||||
uint32x4_t w={0}, x={0}, y={0}, z={0};
|
||||
w=vsha512hq_u64(x,y,z);
|
||||
w=vsha512h2q_u64(x,y);
|
||||
w=vsha512su0q_u64(x,y);
|
||||
w=vsha512su1q_u64 (x,y,z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
vendor/cryptopp/TestPrograms/test_arm_sm3.cpp
vendored
Normal file
19
vendor/cryptopp/TestPrograms/test_arm_sm3.cpp
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// SM3 hash
|
||||
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SM3
|
||||
uint32x4_t y;
|
||||
y=vsm3ss1q_u32(x,y,y);
|
||||
y=vsm3tt1aq_u32(x,y,y,3);
|
||||
y=vsm3tt1bq_u32(x,y,y,1);
|
||||
y=vsm3tt2aq_u32(x,y,y,2);
|
||||
y=vsm3tt2bq_u32(x,y,y,3);
|
||||
y=vsm3partw1q_u32(x,y,y);
|
||||
y=vsm3partw2q_u32(x,y,y);
|
||||
return 0;
|
||||
}
|
||||
15
vendor/cryptopp/TestPrograms/test_arm_sm4.cpp
vendored
Normal file
15
vendor/cryptopp/TestPrograms/test_arm_sm4.cpp
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdint.h>
|
||||
#ifdef CRYPTOPP_ARM_NEON_HEADER
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// SM4 block cipher
|
||||
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SM4
|
||||
uint32x4_t x, y={1}, z={2};
|
||||
x=vsm4ekeyq_u32(y,z);
|
||||
x=vsm4eq_u32(y,z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
31
vendor/cryptopp/TestPrograms/test_asm_mixed.cpp
vendored
Normal file
31
vendor/cryptopp/TestPrograms/test_asm_mixed.cpp
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Most Clang cannot handle mixed asm with positional arguments, where the
|
||||
// body is Intel style with no prefix and the templates are AT&T style.
|
||||
// Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
|
||||
#include <cstddef>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
size_t ret = 1, N = 1;
|
||||
asm __volatile__
|
||||
(
|
||||
#if defined(__amd64__) || defined(__x86_64__)
|
||||
".intel_syntax noprefix ;\n"
|
||||
"xor rsi, rsi ;\n"
|
||||
"neg %1 ;\n"
|
||||
"inc %1 ;\n"
|
||||
"push %1 ;\n"
|
||||
"pop rax ;\n"
|
||||
".att_syntax prefix ;\n"
|
||||
: "=a" (ret) : "c" (N) : "%rsi"
|
||||
#else
|
||||
".intel_syntax noprefix ;\n"
|
||||
"xor esi, esi ;\n"
|
||||
"neg %1 ;\n"
|
||||
"inc %1 ;\n"
|
||||
"push %1 ;\n"
|
||||
"pop eax ;\n"
|
||||
".att_syntax prefix ;\n"
|
||||
: "=a" (ret) : "c" (N) : "%esi"
|
||||
#endif
|
||||
);
|
||||
return (int)ret;
|
||||
}
|
||||
6
vendor/cryptopp/TestPrograms/test_cxx.cpp
vendored
Normal file
6
vendor/cryptopp/TestPrograms/test_cxx.cpp
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <string>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int x=0;
|
||||
return x;
|
||||
}
|
||||
11
vendor/cryptopp/TestPrograms/test_cxx11.cpp
vendored
Normal file
11
vendor/cryptopp/TestPrograms/test_cxx11.cpp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Real C++11 libraries provide <forward_list>
|
||||
#include <forward_list>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cplusplus >= 201103L
|
||||
std::forward_list<int> x;
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
5
vendor/cryptopp/TestPrograms/test_cxx11_alignas.cpp
vendored
Normal file
5
vendor/cryptopp/TestPrograms/test_cxx11_alignas.cpp
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
alignas(8) unsigned char x[16];
|
||||
return 0;
|
||||
}
|
||||
6
vendor/cryptopp/TestPrograms/test_cxx11_alignof.cpp
vendored
Normal file
6
vendor/cryptopp/TestPrograms/test_cxx11_alignof.cpp
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <cstddef>
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
std::size_t n = alignof(int);
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_cxx11_assert.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_cxx11_assert.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// https://en.cppreference.com/w/cpp/feature_test
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cpp_static_assert >= 200410L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_cxx11_atomic.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_cxx11_atomic.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <atomic>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::atomic_flag f = ATOMIC_FLAG_INIT;
|
||||
std::atomic<bool> g (false);
|
||||
return 0;
|
||||
}
|
||||
5
vendor/cryptopp/TestPrograms/test_cxx11_auto.cpp
vendored
Normal file
5
vendor/cryptopp/TestPrograms/test_cxx11_auto.cpp
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
auto a = 1 + 2;
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_cxx11_constexpr.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_cxx11_constexpr.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
constexpr int fact(int n)
|
||||
{
|
||||
return n <= 1 ? 1 : (n * fact(n - 1));
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
fact(4);
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_cxx11_deletefn.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_cxx11_deletefn.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
struct S {
|
||||
S() = delete;
|
||||
explicit S(int n) { }
|
||||
};
|
||||
|
||||
int main (int argc, char* rgv[])
|
||||
{
|
||||
S s(1);
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_cxx11_enumtype.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_cxx11_enumtype.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <cstddef>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
enum Size : std::size_t { Zero=0, One=1, Two=2 };
|
||||
Size s(Size::Zero);
|
||||
return 0;
|
||||
}
|
||||
6
vendor/cryptopp/TestPrograms/test_cxx11_initializer.cpp
vendored
Normal file
6
vendor/cryptopp/TestPrograms/test_cxx11_initializer.cpp
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <vector>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::vector<int> v{0,1,2,3,4};
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_cxx11_lambda.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_cxx11_lambda.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// https://en.cppreference.com/w/cpp/feature_test
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cpp_lambdas >= 200907L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
29
vendor/cryptopp/TestPrograms/test_cxx11_noexcept.cpp
vendored
Normal file
29
vendor/cryptopp/TestPrograms/test_cxx11_noexcept.cpp
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#if defined(__GNUC__)
|
||||
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__apple_build_version__)
|
||||
# undef GNUC_VERSION
|
||||
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#elif defined(__clang__)
|
||||
# undef GNUC_VERSION
|
||||
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#endif
|
||||
|
||||
#if (GNUC_VERSION >= 7030)
|
||||
# pragma GCC diagnostic ignored "-Wterminate"
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
void f(int n) noexcept(false)
|
||||
{
|
||||
if (n > 2)
|
||||
throw std::runtime_error("Oops");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
f(argc);
|
||||
return 0;
|
||||
}
|
||||
6
vendor/cryptopp/TestPrograms/test_cxx11_nullptr.cpp
vendored
Normal file
6
vendor/cryptopp/TestPrograms/test_cxx11_nullptr.cpp
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <cstddef>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int* p = nullptr;
|
||||
return 0;
|
||||
}
|
||||
11
vendor/cryptopp/TestPrograms/test_cxx11_staticinit.cpp
vendored
Normal file
11
vendor/cryptopp/TestPrograms/test_cxx11_staticinit.cpp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// https://en.cppreference.com/w/cpp/feature_test
|
||||
// Apple bug https://bugs.llvm.org/show_bug.cgi?id=47012.
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cpp_threadsafe_static_init >= 200806L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_cxx11_sync.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_cxx11_sync.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <mutex>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::mutex m;
|
||||
std::lock_guard<std::mutex> l(m);
|
||||
return 0;
|
||||
}
|
||||
9
vendor/cryptopp/TestPrograms/test_cxx11_vartemplates.cpp
vendored
Normal file
9
vendor/cryptopp/TestPrograms/test_cxx11_vartemplates.cpp
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cpp_variadic_templates >= 200704L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
9
vendor/cryptopp/TestPrograms/test_cxx14.cpp
vendored
Normal file
9
vendor/cryptopp/TestPrograms/test_cxx14.cpp
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cplusplus >= 201402L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
9
vendor/cryptopp/TestPrograms/test_cxx17.cpp
vendored
Normal file
9
vendor/cryptopp/TestPrograms/test_cxx17.cpp
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cplusplus >= 201703L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_cxx17_assert.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_cxx17_assert.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// https://en.cppreference.com/w/cpp/feature_test
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cpp_static_assert >= 201411L
|
||||
int x[1];
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
11
vendor/cryptopp/TestPrograms/test_cxx17_exceptions.cpp
vendored
Normal file
11
vendor/cryptopp/TestPrograms/test_cxx17_exceptions.cpp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// https://en.cppreference.com/w/cpp/feature_test
|
||||
#include <exception>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if __cpp_lib_uncaught_exceptions >= 201411L
|
||||
int x = std::uncaught_exceptions();
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
12
vendor/cryptopp/TestPrograms/test_cxx98_exception.cpp
vendored
Normal file
12
vendor/cryptopp/TestPrograms/test_cxx98_exception.cpp
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <exception>
|
||||
struct S {
|
||||
S() {}
|
||||
virtual ~S() {
|
||||
bool b = std::uncaught_exception();
|
||||
}
|
||||
};
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
S s;
|
||||
return 0;
|
||||
}
|
||||
8
vendor/cryptopp/TestPrograms/test_glibc.cpp
vendored
Normal file
8
vendor/cryptopp/TestPrograms/test_glibc.cpp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <string>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifndef __GLIBCXX__
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
8
vendor/cryptopp/TestPrograms/test_newlib.cpp
vendored
Normal file
8
vendor/cryptopp/TestPrograms/test_newlib.cpp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <string>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifndef __NEWLIB__
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
26
vendor/cryptopp/TestPrograms/test_ppc_aes.cpp
vendored
Normal file
26
vendor/cryptopp/TestPrograms/test_ppc_aes.cpp
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
|
||||
__vector unsigned char x = {1,2,3,4,5,6,7,8};
|
||||
x=__vcipher(x,x);
|
||||
x=__vcipherlast(x,x);
|
||||
x=__vncipher(x,x);
|
||||
x=__vncipherlast(x,x);
|
||||
#elif defined(__clang__)
|
||||
__vector unsigned long long x = {1,2};
|
||||
x=__builtin_altivec_crypto_vcipher(x,x);
|
||||
x=__builtin_altivec_crypto_vcipherlast(x,x);
|
||||
x=__builtin_altivec_crypto_vncipher(x,x);
|
||||
x=__builtin_altivec_crypto_vncipherlast(x,x);
|
||||
#elif defined(__GNUC__)
|
||||
__vector unsigned long long x = {1,2};
|
||||
x=__builtin_crypto_vcipher(x,x);
|
||||
x=__builtin_crypto_vcipherlast(x,x);
|
||||
x=__builtin_crypto_vncipher(x,x);
|
||||
x=__builtin_crypto_vncipherlast(x,x);
|
||||
#else
|
||||
int XXX[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
13
vendor/cryptopp/TestPrograms/test_ppc_altivec.cpp
vendored
Normal file
13
vendor/cryptopp/TestPrograms/test_ppc_altivec.cpp
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#define GNUC_VERSION (__GNUC__*1000 + __GNUC_MAJOR__*10)
|
||||
#if (GNUC_VERSION >= 4060) || defined(__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||
#endif
|
||||
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__vector unsigned char x;
|
||||
x=vec_ld(0, (unsigned char*)argv[0]);
|
||||
x=vec_add(x,x);
|
||||
return 0;
|
||||
}
|
||||
44
vendor/cryptopp/TestPrograms/test_ppc_power7.cpp
vendored
Normal file
44
vendor/cryptopp/TestPrograms/test_ppc_power7.cpp
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
#if defined(__GNUC__)
|
||||
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__apple_build_version__)
|
||||
# undef GNUC_VERSION
|
||||
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#elif defined(__clang__)
|
||||
# undef GNUC_VERSION
|
||||
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#endif
|
||||
|
||||
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||
#endif
|
||||
|
||||
// XL C++ on AIX does not define VSX and does not
|
||||
// provide an option to set it. We have to set it
|
||||
// for the code below. This define must stay in
|
||||
// sync with the define in test_ppc_power7.cpp.
|
||||
#if defined(_AIX) && defined(_ARCH_PWR7) && defined(__xlC__)
|
||||
# define __VSX__ 1
|
||||
#endif
|
||||
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if defined(_ARCH_PWR7) && defined(__VSX__)
|
||||
// PWR7
|
||||
__vector unsigned int a = {1,2,3,4};
|
||||
__vector unsigned int b = vec_ld(0, (unsigned int*)argv[0]);
|
||||
__vector unsigned int c = vec_xor(a, b);
|
||||
|
||||
// VSX
|
||||
__vector unsigned int x = {5,6,7,8};
|
||||
__vector unsigned int y = vec_xl(0, (unsigned int*)argv[0]);
|
||||
__vector unsigned int z = vec_xor(x, y);
|
||||
__vector unsigned long long xx = {1,2};
|
||||
__vector unsigned long long yy = (__vector unsigned long long)y;
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
46
vendor/cryptopp/TestPrograms/test_ppc_power8.cpp
vendored
Normal file
46
vendor/cryptopp/TestPrograms/test_ppc_power8.cpp
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
#if defined(__GNUC__)
|
||||
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__apple_build_version__)
|
||||
# undef GNUC_VERSION
|
||||
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#elif defined(__clang__)
|
||||
# undef GNUC_VERSION
|
||||
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#endif
|
||||
|
||||
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||
#endif
|
||||
|
||||
// XL C++ on AIX does not define CRYPTO and does not
|
||||
// provide an option to set it. We have to set it
|
||||
// for the code below. This define must stay in
|
||||
// sync with the define in test_ppc_power8.cpp
|
||||
#if defined(_AIX) && defined(_ARCH_PWR8) && defined(__xlC__)
|
||||
# define __CRYPTO__ 1
|
||||
#endif
|
||||
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if defined(_ARCH_PWR8)
|
||||
__vector unsigned long long r = {1, 2};
|
||||
__vector unsigned int s = vec_xl(0, (unsigned int*)argv[0]); // Power7
|
||||
__vector unsigned long long w = (__vector unsigned long long)r;
|
||||
__vector unsigned long long x = (__vector unsigned long long)s;
|
||||
__vector unsigned long long y = vec_xor(w, x);
|
||||
__vector unsigned long long z = vec_add(y, vec_add(w, x));
|
||||
# if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
|
||||
__vector unsigned long long u = __vpmsumd (y, z);
|
||||
# elif defined(__clang__)
|
||||
__vector unsigned long long u = __builtin_altivec_crypto_vpmsumd (y, z);
|
||||
# else
|
||||
__vector unsigned long long u = __builtin_crypto_vpmsumd (y, z);
|
||||
# endif
|
||||
#else
|
||||
int x[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
33
vendor/cryptopp/TestPrograms/test_ppc_power9.cpp
vendored
Normal file
33
vendor/cryptopp/TestPrograms/test_ppc_power9.cpp
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
#if defined(__GNUC__)
|
||||
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__apple_build_version__)
|
||||
# undef GNUC_VERSION
|
||||
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#elif defined(__clang__)
|
||||
# undef GNUC_VERSION
|
||||
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
|
||||
#endif
|
||||
|
||||
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||
#endif
|
||||
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if defined(_ARCH_PWR9)
|
||||
__vector unsigned int v = vec_xl_be(0, (unsigned int*)argv[0]);
|
||||
#else
|
||||
int XXX[-1];
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__IBM_GCC_ASM)
|
||||
unsigned int y = __builtin_darn_32();
|
||||
#else
|
||||
int XXX[-1];
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
23
vendor/cryptopp/TestPrograms/test_ppc_sha.cpp
vendored
Normal file
23
vendor/cryptopp/TestPrograms/test_ppc_sha.cpp
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
|
||||
__vector unsigned int x = {1,2,3,4};
|
||||
x=__vshasigmaw(x, 0, 0);
|
||||
__vector unsigned long long y = {1,2};
|
||||
y=__vshasigmad(y, 0, 0);
|
||||
#elif defined(__clang__)
|
||||
__vector unsigned int x = {1,2,3,4};
|
||||
x=__builtin_altivec_crypto_vshasigmaw(x, 0, 0);
|
||||
__vector unsigned long long y = {1,2};
|
||||
y=__builtin_altivec_crypto_vshasigmad(y, 0, 0);
|
||||
#elif defined(__GNUC__)
|
||||
__vector unsigned int x = {1,2,3,4};
|
||||
x=__builtin_crypto_vshasigmaw(x, 0, 0);
|
||||
__vector unsigned long long y = {1,2};
|
||||
y=__builtin_crypto_vshasigmad(y, 0, 0);
|
||||
#else
|
||||
int XXX[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
17
vendor/cryptopp/TestPrograms/test_ppc_vmull.cpp
vendored
Normal file
17
vendor/cryptopp/TestPrograms/test_ppc_vmull.cpp
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <altivec.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__vector unsigned long long x = {1,2};
|
||||
__vector unsigned long long y = {3,4};
|
||||
|
||||
#if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
|
||||
__vector unsigned long long z=__vpmsumd(x,y);
|
||||
#elif defined(__clang__)
|
||||
__vector unsigned long long z=__builtin_altivec_crypto_vpmsumd(x,y);
|
||||
#elif defined(__GNUC__)
|
||||
__vector unsigned long long z=__builtin_crypto_vpmsumd(x,y);
|
||||
#else
|
||||
int XXX[-1];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
15
vendor/cryptopp/TestPrograms/test_pthreads.cpp
vendored
Normal file
15
vendor/cryptopp/TestPrograms/test_pthreads.cpp
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <string>
|
||||
#include <pthread.h>
|
||||
|
||||
void* function(void *ptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
pthread_t thread;
|
||||
int ret = pthread_create(&thread, NULL, function, (void*)0);
|
||||
pthread_join(thread, NULL);
|
||||
return 0;
|
||||
}
|
||||
11
vendor/cryptopp/TestPrograms/test_x86_aes.cpp
vendored
Normal file
11
vendor/cryptopp/TestPrograms/test_x86_aes.cpp
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <emmintrin.h>
|
||||
#include <wmmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128i x = _mm_setzero_si128();
|
||||
x=_mm_aesenc_si128(x,x);
|
||||
x=_mm_aesenclast_si128(x,x);
|
||||
x=_mm_aesdec_si128(x,x);
|
||||
x=_mm_aesdeclast_si128(x,x);
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_x86_avx.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_x86_avx.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <immintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m256d x = _mm256_setzero_pd();
|
||||
x=_mm256_addsub_pd(x,x);
|
||||
return 0;
|
||||
}
|
||||
9
vendor/cryptopp/TestPrograms/test_x86_avx2.cpp
vendored
Normal file
9
vendor/cryptopp/TestPrograms/test_x86_avx2.cpp
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <immintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// _mm256_broadcastsi128_si256 due to Clang
|
||||
__m128i x = _mm_setzero_si128 ();
|
||||
__m256i y = _mm256_broadcastsi128_si256 (x);
|
||||
y = _mm256_add_epi64 (y,y);
|
||||
return 0;
|
||||
}
|
||||
8
vendor/cryptopp/TestPrograms/test_x86_avx512.cpp
vendored
Normal file
8
vendor/cryptopp/TestPrograms/test_x86_avx512.cpp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdint.h>
|
||||
#include <immintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint64_t x[8] = {0};
|
||||
__m512i y = _mm512_loadu_si512((__m512i*)x);
|
||||
return 0;
|
||||
}
|
||||
8
vendor/cryptopp/TestPrograms/test_x86_clmul.cpp
vendored
Normal file
8
vendor/cryptopp/TestPrograms/test_x86_clmul.cpp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <emmintrin.h>
|
||||
#include <wmmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128i x = _mm_setzero_si128();
|
||||
x=_mm_clmulepi64_si128(x,x,0x11);
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_x86_cpuid.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_x86_cpuid.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int a, b, c, d;
|
||||
asm volatile ( "cpuid" : "+a"(a), "=b"(b), "+c"(c), "=d"(d) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_x86_rdrand.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_x86_rdrand.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <immintrin.h>
|
||||
#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
|
||||
# include <x86intrin.h>
|
||||
#endif
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int x=0;
|
||||
(void)_rdrand32_step (&x);
|
||||
return x == 0 ? 0 : 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_x86_rdseed.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_x86_rdseed.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <immintrin.h>
|
||||
#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
|
||||
# include <x86intrin.h>
|
||||
#endif
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int x=0;
|
||||
(void)_rdseed32_step (&x);
|
||||
return x == 0 ? 0 : 0;
|
||||
}
|
||||
14
vendor/cryptopp/TestPrograms/test_x86_sha.cpp
vendored
Normal file
14
vendor/cryptopp/TestPrograms/test_x86_sha.cpp
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <emmintrin.h>
|
||||
#include <immintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128i x = _mm_setzero_si128();
|
||||
x=_mm_sha1msg1_epu32(x,x);
|
||||
x=_mm_sha1msg2_epu32(x,x);
|
||||
x=_mm_sha1nexte_epu32(x,x);
|
||||
x=_mm_sha1rnds4_epu32(x,x,0);
|
||||
x=_mm_sha256msg1_epu32(x,x);
|
||||
x=_mm_sha256msg2_epu32(x,x);
|
||||
x=_mm_sha256rnds2_epu32(x,x,x);
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_x86_sse2.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_x86_sse2.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <emmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128i x = _mm_setzero_si128();
|
||||
x=_mm_add_epi64(x,x);
|
||||
return 0;
|
||||
}
|
||||
8
vendor/cryptopp/TestPrograms/test_x86_sse3.cpp
vendored
Normal file
8
vendor/cryptopp/TestPrograms/test_x86_sse3.cpp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <emmintrin.h>
|
||||
#include <pmmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128d x = _mm_setzero_pd();
|
||||
x=_mm_addsub_pd(x,x);
|
||||
return 0;
|
||||
}
|
||||
10
vendor/cryptopp/TestPrograms/test_x86_sse41.cpp
vendored
Normal file
10
vendor/cryptopp/TestPrograms/test_x86_sse41.cpp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <emmintrin.h>
|
||||
#include <smmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128i x = _mm_setzero_si128();
|
||||
__m128i a = _mm_setzero_si128();
|
||||
__m128i b = _mm_setzero_si128();
|
||||
x=_mm_blend_epi16(a,b,4);
|
||||
return 0;
|
||||
}
|
||||
7
vendor/cryptopp/TestPrograms/test_x86_sse42.cpp
vendored
Normal file
7
vendor/cryptopp/TestPrograms/test_x86_sse42.cpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <nmmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
unsigned int x=32;
|
||||
x=_mm_crc32_u8(x,4);
|
||||
return 0;
|
||||
}
|
||||
8
vendor/cryptopp/TestPrograms/test_x86_ssse3.cpp
vendored
Normal file
8
vendor/cryptopp/TestPrograms/test_x86_ssse3.cpp
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <emmintrin.h>
|
||||
#include <tmmintrin.h>
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
__m128i x = _mm_setzero_si128();
|
||||
x=_mm_alignr_epi8(x,x,2);
|
||||
return 0;
|
||||
}
|
||||
39
vendor/cryptopp/TestPrograms/test_x86_via_aes.cpp
vendored
Normal file
39
vendor/cryptopp/TestPrograms/test_x86_via_aes.cpp
vendored
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 defined(__x86_64__) || defined(__amd64__)
|
||||
"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 defined(__x86_64__) || defined(__amd64__)
|
||||
"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 defined(__x86_64__) || defined(__amd64__)
|
||||
: "rax", "rdx", "rdi", "cc"
|
||||
#else
|
||||
: "eax", "edx", "edi", "cc"
|
||||
#endif
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
38
vendor/cryptopp/TestPrograms/test_x86_via_rng.cpp
vendored
Normal file
38
vendor/cryptopp/TestPrograms/test_x86_via_rng.cpp
vendored
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 defined(__x86_64__) || defined(__amd64__)
|
||||
"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 defined(__x86_64__) || defined(__amd64__)
|
||||
"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 defined(__x86_64__) || defined(__amd64__)
|
||||
: "rax", "rdx", "rdi", "cc"
|
||||
#else
|
||||
: "eax", "edx", "edi", "cc"
|
||||
#endif
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
39
vendor/cryptopp/TestPrograms/test_x86_via_sha.cpp
vendored
Normal file
39
vendor/cryptopp/TestPrograms/test_x86_via_sha.cpp
vendored
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 defined(__x86_64__) || defined(__amd64__)
|
||||
"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 defined(__x86_64__) || defined(__amd64__)
|
||||
"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 defined(__x86_64__) || defined(__amd64__)
|
||||
: "rax", "rdx", "rdi", "cc"
|
||||
#else
|
||||
: "eax", "edx", "edi", "cc"
|
||||
#endif
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user